diff options
author | Oliver Bolte <obo@openoffice.org> | 2008-10-16 06:57:26 +0000 |
---|---|---|
committer | Oliver Bolte <obo@openoffice.org> | 2008-10-16 06:57:26 +0000 |
commit | ae562e931a98e708a75e8d140cf1ff24854acfc7 (patch) | |
tree | 4ccb1ec3b4d4a9157e03f949d62b6687b8aa88eb /scripting/source | |
parent | 7bf29c44efa5985f59c160ba5a75dc212f955d42 (diff) |
CWS-TOOLING: integrate CWS odbmacros3
Diffstat (limited to 'scripting/source')
-rw-r--r-- | scripting/source/basprov/basprov.cxx | 6 | ||||
-rw-r--r-- | scripting/source/basprov/basscript.cxx | 4 | ||||
-rw-r--r-- | scripting/source/protocolhandler/scripthandler.cxx | 80 |
3 files changed, 40 insertions, 50 deletions
diff --git a/scripting/source/basprov/basprov.cxx b/scripting/source/basprov/basprov.cxx index d0a028329e7f..522df92c68d3 100644 --- a/scripting/source/basprov/basprov.cxx +++ b/scripting/source/basprov/basprov.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: basprov.cxx,v $ - * $Revision: 1.23 $ + * $Revision: 1.21.6.3 $ * * This file is part of OpenOffice.org. * @@ -365,7 +365,7 @@ namespace basprov throw provider::ScriptFrameworkErrorException( errorMsg, Reference< XInterface >(), scriptURI, OUSTR("Basic"), - provider::ScriptFrameworkErrorType::UNKNOWN ); + provider::ScriptFrameworkErrorType::MALFORMED_URL ); } @@ -440,7 +440,7 @@ namespace basprov aMessage.makeStringAndClear(), Reference< XInterface >(), scriptURI, OUSTR("Basic"), - provider::ScriptFrameworkErrorType::UNKNOWN ); + provider::ScriptFrameworkErrorType::NO_SUCH_SCRIPT ); } return xScript; diff --git a/scripting/source/basprov/basscript.cxx b/scripting/source/basprov/basscript.cxx index 2dab59a4944c..55f17a9c1725 100644 --- a/scripting/source/basprov/basscript.cxx +++ b/scripting/source/basprov/basscript.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: basscript.cxx,v $ - * $Revision: 1.16 $ + * $Revision: 1.16.6.1 $ * * This file is part of OpenOffice.org. * @@ -136,7 +136,7 @@ namespace basprov m_funcName, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Basic" ) ), - provider::ScriptFrameworkErrorType::UNKNOWN ); + provider::ScriptFrameworkErrorType::NO_SUCH_SCRIPT ); } } diff --git a/scripting/source/protocolhandler/scripthandler.cxx b/scripting/source/protocolhandler/scripthandler.cxx index 10ef25b2c4c2..e1a8ba99790f 100644 --- a/scripting/source/protocolhandler/scripthandler.cxx +++ b/scripting/source/protocolhandler/scripthandler.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: scripthandler.cxx,v $ - * $Revision: 1.29 $ + * $Revision: 1.29.6.1 $ * * This file is part of OpenOffice.org. * @@ -46,6 +46,7 @@ #include <com/sun/star/script/provider/XScriptProviderSupplier.hpp> #include <com/sun/star/script/provider/XScriptProviderFactory.hpp> +#include <com/sun/star/script/provider/ScriptFrameworkErrorType.hpp> #include <sfx2/objsh.hxx> #include <sfx2/frame.hxx> @@ -53,6 +54,7 @@ #include <vcl/abstdlg.hxx> #include <cppuhelper/factory.hxx> +#include <cppuhelper/exc_hlp.hxx> #include <util/util.hxx> #include "com/sun/star/uno/XComponentContext.hpp" @@ -207,58 +209,46 @@ void SAL_CALL ScriptProtocolHandler::dispatchWithNotification( } } } - invokeResult = xFunc->invoke( inArgs, outIndex, outArgs ); - bSuccess = sal_True; + + bSuccess = sal_False; + while ( !bSuccess ) + { + Any aFirstCaughtException; + try + { + invokeResult = xFunc->invoke( inArgs, outIndex, outArgs ); + bSuccess = sal_True; + } + catch( const provider::ScriptFrameworkErrorException& se ) + { + if ( !aFirstCaughtException.hasValue() ) + aFirstCaughtException = ::cppu::getCaughtException(); + + if ( se.errorType != provider::ScriptFrameworkErrorType::NO_SUCH_SCRIPT ) + // the only condition which allows us to retry is if there is no method with the + // given name/signature + ::cppu::throwException( aFirstCaughtException ); + + if ( inArgs.getLength() == 0 ) + // no chance to retry if we can't strip more in-args + ::cppu::throwException( aFirstCaughtException ); + + // strip one argument, then retry + inArgs.realloc( inArgs.getLength() - 1 ); + } + } } // Office doesn't handle exceptions rethrown here very well, it cores, // all we can is log them and then set fail for the dispatch event! // (if there is a listener of course) - catch ( reflection::InvocationTargetException & ite ) + catch ( const Exception & e ) { - ::rtl::OUString reason = ::rtl::OUString::createFromAscii( - "ScriptProtocolHandler::dispatch: caught InvocationTargetException: " ); + aException = ::cppu::getCaughtException(); - reason = reason.concat( ite.Message ); + ::rtl::OUString reason = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ScriptProtocolHandler::dispatch: caught " ) ); - invokeResult <<= reason; - - aException = makeAny( ite ); - bCaughtException = TRUE; - } - catch ( provider::ScriptFrameworkErrorException& se ) - { - ::rtl::OUString reason = ::rtl::OUString::createFromAscii( - "ScriptProtocolHandler::dispatch: caught ScriptFrameworkErrorException: " ); - - reason = reason.concat( se.Message ); - - invokeResult <<= reason; - - aException = makeAny( se ); - bCaughtException = TRUE; - } - catch ( ::com::sun::star::uno::RuntimeException& rte ) - { - ::rtl::OUString reason = ::rtl::OUString::createFromAscii( - "ScriptProtocolHandler::dispatch: caught RuntimeException: " ); - - reason = reason.concat( rte.Message ); - - invokeResult <<= reason; - - aException = makeAny( rte ); - bCaughtException = TRUE; - } - catch ( Exception & e ) - { - ::rtl::OUString reason = ::rtl::OUString::createFromAscii( - "ScriptProtocolHandler::dispatch: caught Exception: " ); - - reason = reason.concat( e.Message ); - - invokeResult <<= reason; + invokeResult <<= reason.concat( aException.getValueTypeName() ).concat( e.Message ); - aException = makeAny( e ); bCaughtException = TRUE; } #ifdef _DEBUG |