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 | db4c719a825e0c5b8d13133a1c8a33d4f3b53753 (patch) | |
tree | 7c16f150485662d25afe7b89d15884ec5e6bc3dd /scripting/source | |
parent | 0a6f995f4e6739636123a9829b5e22ea04b52f72 (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 b0f768955c..da5b3b5ccf 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 5fbfb99d65..1d0fb3a4be 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 c653a43e0d..983e13f8cd 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 |