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 | |
parent | 7bf29c44efa5985f59c160ba5a75dc212f955d42 (diff) |
CWS-TOOLING: integrate CWS odbmacros3
Diffstat (limited to 'scripting')
8 files changed, 54 insertions, 66 deletions
diff --git a/scripting/java/com/sun/star/script/framework/provider/PathUtils.java b/scripting/java/com/sun/star/script/framework/provider/PathUtils.java index 5c6d8a9d6192..85c8ecfe4393 100644 --- a/scripting/java/com/sun/star/script/framework/provider/PathUtils.java +++ b/scripting/java/com/sun/star/script/framework/provider/PathUtils.java @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: PathUtils.java,v $ - * $Revision: 1.8 $ + * $Revision: 1.8.6.1 $ * * This file is part of OpenOffice.org. * @@ -76,7 +76,7 @@ public class PathUtils { { try { - Method getOid = IQueryInterface.class.getMethod("getOid", null); + Method getOid = IQueryInterface.class.getMethod("getOid", (java.lang.Class[])null); if ( getOid != null ) { oid = (String)getOid.invoke( xModel, new Object[0] ); diff --git a/scripting/java/com/sun/star/script/framework/provider/ScriptProvider.java b/scripting/java/com/sun/star/script/framework/provider/ScriptProvider.java index c3059617ebf8..c9484f55a3fe 100755 --- a/scripting/java/com/sun/star/script/framework/provider/ScriptProvider.java +++ b/scripting/java/com/sun/star/script/framework/provider/ScriptProvider.java @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: ScriptProvider.java,v $ - * $Revision: 1.13 $ + * $Revision: 1.13.6.1 $ * * This file is part of OpenOffice.org. * @@ -365,9 +365,8 @@ public abstract class ScriptProvider ScriptMetaData scriptData = m_container.findScript( details ); if ( scriptData == null ) { - // TODO specify the correct error Type throw new ScriptFrameworkErrorException( details.function + " does not exist", - null, details.function, language, ScriptFrameworkErrorType.UNKNOWN ); + null, details.function, language, ScriptFrameworkErrorType.NO_SUCH_SCRIPT ); } return scriptData; } @@ -379,9 +378,8 @@ public abstract class ScriptProvider } catch ( com.sun.star.container.NoSuchElementException nse ) { - // TODO specify the correct error Type throw new ScriptFrameworkErrorException( nse.getMessage(), - null, details.function, language, ScriptFrameworkErrorType.UNKNOWN ); + null, details.function, language, ScriptFrameworkErrorType.NO_SUCH_SCRIPT ); } catch ( com.sun.star.lang.WrappedTargetException wta ) { diff --git a/scripting/java/com/sun/star/script/framework/provider/beanshell/ScriptProviderForBeanShell.java b/scripting/java/com/sun/star/script/framework/provider/beanshell/ScriptProviderForBeanShell.java index 871152167b87..00f6f1c7eb75 100755 --- a/scripting/java/com/sun/star/script/framework/provider/beanshell/ScriptProviderForBeanShell.java +++ b/scripting/java/com/sun/star/script/framework/provider/beanshell/ScriptProviderForBeanShell.java @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: ScriptProviderForBeanShell.java,v $ - * $Revision: 1.11 $ + * $Revision: 1.11.6.1 $ * * This file is part of OpenOffice.org. * @@ -244,7 +244,7 @@ class ScriptImpl implements XScript throw new ScriptFrameworkErrorException( mfu.getMessage(), null, metaData.getLanguageName(), metaData.getLanguage(), - ScriptFrameworkErrorType.UNKNOWN ); + ScriptFrameworkErrorType.MALFORMED_URL ); } catch ( NoSuitableClassLoaderException nsc ) { @@ -307,7 +307,7 @@ class ScriptImpl implements XScript throw new ScriptFrameworkErrorException( "Failed to read script", null, metaData.getLanguageName(), metaData.getLanguage(), - ScriptFrameworkErrorType.UNKNOWN ); + ScriptFrameworkErrorType.NO_SUCH_SCRIPT ); } result = interpreter.eval( source ); diff --git a/scripting/java/com/sun/star/script/framework/provider/java/ScriptProviderForJava.java b/scripting/java/com/sun/star/script/framework/provider/java/ScriptProviderForJava.java index c63fcc0c861e..d36821ece7bd 100755 --- a/scripting/java/com/sun/star/script/framework/provider/java/ScriptProviderForJava.java +++ b/scripting/java/com/sun/star/script/framework/provider/java/ScriptProviderForJava.java @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: ScriptProviderForJava.java,v $ - * $Revision: 1.10 $ + * $Revision: 1.10.6.1 $ * * This file is part of OpenOffice.org. * @@ -253,7 +253,7 @@ class ScriptImpl implements XScript throw new ScriptFrameworkErrorException( mfe.getMessage(), null, metaData.getLanguageName(), metaData.getLanguage(), - ScriptFrameworkErrorType.UNKNOWN ); + ScriptFrameworkErrorType.MALFORMED_URL ); } catch (NoSuitableClassLoaderException ncl ) { @@ -323,7 +323,7 @@ class ScriptImpl implements XScript throw new ScriptFrameworkErrorException( e.getMessage(), null, metaData.getLanguageName(), metaData.getLanguage(), - ScriptFrameworkErrorType.UNKNOWN ); + ScriptFrameworkErrorType.NO_SUCH_SCRIPT ); } } catch ( ClassNotFoundException e ) @@ -332,7 +332,7 @@ class ScriptImpl implements XScript throw new ScriptFrameworkErrorException( e.getMessage(), null, metaData.getLanguageName(), metaData.getLanguage(), - ScriptFrameworkErrorType.UNKNOWN ); + ScriptFrameworkErrorType.NO_SUCH_SCRIPT ); } LogUtils.DEBUG( "Starting Invoke on Proxy ..." ); diff --git a/scripting/java/com/sun/star/script/framework/provider/javascript/ScriptProviderForJavaScript.java b/scripting/java/com/sun/star/script/framework/provider/javascript/ScriptProviderForJavaScript.java index e70ebd7013f4..04b4a8e60990 100755 --- a/scripting/java/com/sun/star/script/framework/provider/javascript/ScriptProviderForJavaScript.java +++ b/scripting/java/com/sun/star/script/framework/provider/javascript/ScriptProviderForJavaScript.java @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: ScriptProviderForJavaScript.java,v $ - * $Revision: 1.10 $ + * $Revision: 1.10.6.1 $ * * This file is part of OpenOffice.org. * @@ -260,7 +260,7 @@ class ScriptImpl implements XScript throw new ScriptFrameworkErrorException( mfu.getMessage(), null, metaData.getLanguageName(), metaData.getLanguage(), - ScriptFrameworkErrorType.UNKNOWN ); + ScriptFrameworkErrorType.MALFORMED_URL ); } catch ( com.sun.star.script.framework.provider.NoSuitableClassLoaderException nsc ) { 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 |