summaryrefslogtreecommitdiff
path: root/scripting
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2014-05-23 12:03:21 +0200
committerNoel Grandin <noel@peralex.com>2014-05-23 15:06:00 +0200
commite7bc3cab019fbf040f9fb8b53ae2cf3f977d200b (patch)
treebc507bccee9fb71134e362b72d22991561e32aa0 /scripting
parentc5d47c327a57df55fa3dac0fff6b65888d0345e4 (diff)
remove boilerplate in UNO Exception constructor calls
Now that we have default values for Exception constructor params, remove lots of boilerplate code. Change-Id: I620bd641eecfed38e6123873b3b94aaf47922e74
Diffstat (limited to 'scripting')
-rw-r--r--scripting/source/basprov/basmethnode.cxx6
-rw-r--r--scripting/source/basprov/basprov.cxx3
-rw-r--r--scripting/source/dlgprov/dlgprov.cxx10
-rw-r--r--scripting/source/protocolhandler/scripthandler.cxx6
-rw-r--r--scripting/source/provider/BrowseNodeFactoryImpl.cxx2
-rw-r--r--scripting/source/provider/MasterScriptProvider.cxx45
-rw-r--r--scripting/source/provider/ProviderCache.cxx4
-rw-r--r--scripting/source/provider/ScriptImpl.cxx6
-rw-r--r--scripting/source/provider/URIHelper.cxx12
-rw-r--r--scripting/source/stringresource/stringresource.cxx19
-rw-r--r--scripting/source/vbaevents/eventhelper.cxx6
11 files changed, 43 insertions, 76 deletions
diff --git a/scripting/source/basprov/basmethnode.cxx b/scripting/source/basprov/basmethnode.cxx
index 8a1f823c4c35..70ddb1f249e3 100644
--- a/scripting/source/basprov/basmethnode.cxx
+++ b/scripting/source/basprov/basmethnode.cxx
@@ -293,8 +293,7 @@ namespace basprov
(void)aValue;
throw UnknownPropertyException(
- OUString( "BasicMethodNodeImpl::setValue: property name is unknown!" ),
- Reference< XInterface >() );
+ "BasicMethodNodeImpl::setValue: property name is unknown!" );
}
@@ -304,8 +303,7 @@ namespace basprov
(void)aPropertyName;
throw UnknownPropertyException(
- OUString( "BasicMethodNodeImpl::getValue: property name is unknown!" ),
- Reference< XInterface >() );
+ "BasicMethodNodeImpl::getValue: property name is unknown!" );
}
diff --git a/scripting/source/basprov/basprov.cxx b/scripting/source/basprov/basprov.cxx
index 96ff21564a21..915c2d5b4f5e 100644
--- a/scripting/source/basprov/basprov.cxx
+++ b/scripting/source/basprov/basprov.cxx
@@ -274,8 +274,7 @@ namespace basprov
{
/*
throw RuntimeException(
- OUString( "BasicProviderImpl::initialize: no scripting context!" ),
- Reference< XInterface >() );
+ "BasicProviderImpl::initialize: no scripting context!" );
*/
}
}
diff --git a/scripting/source/dlgprov/dlgprov.cxx b/scripting/source/dlgprov/dlgprov.cxx
index 70a82c30480e..63178ad88e70 100644
--- a/scripting/source/dlgprov/dlgprov.cxx
+++ b/scripting/source/dlgprov/dlgprov.cxx
@@ -269,7 +269,7 @@ static OUString aResourceResolverPropName("ResourceResolver");
{
if ( !m_BasicInfo.get() )
// shouln't get here
- throw RuntimeException("No information to create dialog", Reference< XInterface >() );
+ throw RuntimeException("No information to create dialog" );
Reference< resource::XStringResourceManager > xStringResourceManager = getStringResourceFromDialogLibrary( m_BasicInfo->mxDlgLib );
OUString aURL("" );
@@ -617,9 +617,7 @@ static OUString aResourceResolverPropName("ResourceResolver");
if ( !m_xModel.is() )
{
- throw RuntimeException(
- OUString( "DialogProviderImpl::initialize: invalid argument format!" ),
- Reference< XInterface >() );
+ throw RuntimeException( "DialogProviderImpl::initialize: invalid argument format!" );
}
}
else if ( aArguments.getLength() == 4 )
@@ -639,9 +637,7 @@ static OUString aResourceResolverPropName("ResourceResolver");
}
else if ( aArguments.getLength() > 4 )
{
- throw RuntimeException(
- OUString( "DialogProviderImpl::initialize: invalid number of arguments!" ),
- Reference< XInterface >() );
+ throw RuntimeException( "DialogProviderImpl::initialize: invalid number of arguments!" );
}
}
diff --git a/scripting/source/protocolhandler/scripthandler.cxx b/scripting/source/protocolhandler/scripthandler.cxx
index d2c6f75a16f2..79c6ffb99b6e 100644
--- a/scripting/source/protocolhandler/scripthandler.cxx
+++ b/scripting/source/protocolhandler/scripthandler.cxx
@@ -84,7 +84,7 @@ void SAL_CALL ScriptProtocolHandler::initialize(
if ( aArguments.getLength() && !( aArguments[ 0 ] >>= m_xFrame ) )
{
OUString temp = "ScriptProtocolHandler::initialize: could not extract reference to the frame";
- throw RuntimeException( temp, Reference< XInterface >() );
+ throw RuntimeException( temp );
}
ENSURE_OR_THROW( m_xContext.is(), "ScriptProtocolHandler::initialize: No Service Manager available" );
@@ -430,12 +430,12 @@ void ScriptProtocolHandler::createScriptProvider()
catch ( const RuntimeException & e )
{
OUString temp = "ScriptProtocolHandler::createScriptProvider(), ";
- throw RuntimeException( temp.concat( e.Message ), Reference< XInterface >() );
+ throw RuntimeException( temp.concat( e.Message ) );
}
catch ( const Exception & e )
{
OUString temp = "ScriptProtocolHandler::createScriptProvider: ";
- throw RuntimeException( temp.concat( e.Message ), Reference< XInterface >() );
+ throw RuntimeException( temp.concat( e.Message ) );
}
}
diff --git a/scripting/source/provider/BrowseNodeFactoryImpl.cxx b/scripting/source/provider/BrowseNodeFactoryImpl.cxx
index 9941f6b6f1da..61581f55459a 100644
--- a/scripting/source/provider/BrowseNodeFactoryImpl.cxx
+++ b/scripting/source/provider/BrowseNodeFactoryImpl.cxx
@@ -680,7 +680,7 @@ BrowseNodeFactoryImpl::createView( sal_Int16 viewType )
case browse::BrowseNodeFactoryViewTypes::MACROORGANIZER:
return getOrganizerHierarchy();
default:
- throw RuntimeException( "Unknown view type", Reference< XInterface >() );
+ throw RuntimeException( "Unknown view type" );
}
}
diff --git a/scripting/source/provider/MasterScriptProvider.cxx b/scripting/source/provider/MasterScriptProvider.cxx
index 0ae25ec6a3a0..3b02a10a8cf1 100644
--- a/scripting/source/provider/MasterScriptProvider.cxx
+++ b/scripting/source/provider/MasterScriptProvider.cxx
@@ -106,8 +106,7 @@ throw ( Exception, RuntimeException, std::exception )
if ( len > 1 )
{
throw RuntimeException(
- "MasterScriptProvider::initialize: invalid number of arguments",
- Reference< XInterface >() );
+ "MasterScriptProvider::initialize: invalid number of arguments" );
}
Sequence< Any > invokeArgs( len );
@@ -498,15 +497,13 @@ MasterScriptProvider::insertByName( const OUString& aName, const Any& aElement )
if ( !xCont.is() )
{
throw RuntimeException(
- "PackageMasterScriptProvider doesn't implement XNameContainer",
- Reference< XInterface >() );
+ "PackageMasterScriptProvider doesn't implement XNameContainer" );
}
xCont->insertByName( aName, aElement );
}
else
{
- throw RuntimeException( "PackageMasterScriptProvider is unitialised",
- Reference< XInterface >() );
+ throw RuntimeException( "PackageMasterScriptProvider is unitialised" );
}
}
@@ -530,8 +527,7 @@ MasterScriptProvider::insertByName( const OUString& aName, const Any& aElement )
{
throw RuntimeException(
"insertByName cannot instantiate "
- "child script providers.",
- Reference< XInterface >() );
+ "child script providers." );
}
Sequence < Reference< provider::XScriptProvider > > xSProviders =
providerCache()->getAllProviders();
@@ -578,15 +574,13 @@ MasterScriptProvider::removeByName( const OUString& Name ) throw ( container::No
if ( !xCont.is() )
{
throw RuntimeException(
- "PackageMasterScriptProvider doesn't implement XNameContainer",
- Reference< XInterface >() );
+ "PackageMasterScriptProvider doesn't implement XNameContainer" );
}
xCont->removeByName( Name );
}
else
{
- throw RuntimeException( "PackageMasterScriptProvider is unitialised",
- Reference< XInterface >() );
+ throw RuntimeException( "PackageMasterScriptProvider is unitialised" );
}
}
@@ -605,8 +599,7 @@ MasterScriptProvider::removeByName( const OUString& Name ) throw ( container::No
{
throw RuntimeException(
"removeByName() cannot instantiate "
- "child script providers.",
- Reference< XInterface >() );
+ "child script providers." );
}
Sequence < Reference< provider::XScriptProvider > > xSProviders =
providerCache()->getAllProviders();
@@ -650,8 +643,7 @@ MasterScriptProvider::replaceByName( const OUString& aName, const Any& aElement
// TODO needs implementing
if ( true )
{
- throw RuntimeException( "replaceByName not implemented!!!!" ,
- Reference< XInterface >() );
+ throw RuntimeException( "replaceByName not implemented!!!!" );
}
}
@@ -664,8 +656,7 @@ MasterScriptProvider::getByName( const OUString& aName ) throw ( container::NoSu
Any result;
if ( true )
{
- throw RuntimeException( "getByName not implemented!!!!" ,
- Reference< XInterface >() );
+ throw RuntimeException( "getByName not implemented!!!!" );
}
return result;
}
@@ -682,8 +673,7 @@ MasterScriptProvider::hasByName( const OUString& aName ) throw (RuntimeException
if ( !xCont.is() )
{
throw RuntimeException(
- "PackageMasterScriptProvider doesn't implement XNameContainer",
- Reference< XInterface >() );
+ "PackageMasterScriptProvider doesn't implement XNameContainer" );
}
result = xCont->hasByName( aName );
@@ -692,8 +682,7 @@ MasterScriptProvider::hasByName( const OUString& aName ) throw (RuntimeException
// have a PackageProvider
else if (!m_xModel.is())
{
- throw RuntimeException( "PackageMasterScriptProvider is unitialised",
- Reference< XInterface >() );
+ throw RuntimeException( "PackageMasterScriptProvider is unitialised" );
}
}
@@ -713,8 +702,7 @@ MasterScriptProvider::hasByName( const OUString& aName ) throw (RuntimeException
{
throw RuntimeException(
"removeByName() cannot instantiate "
- "child script providers.",
- Reference< XInterface >() );
+ "child script providers." );
}
Sequence < Reference< provider::XScriptProvider > > xSProviders =
providerCache()->getAllProviders();
@@ -750,8 +738,7 @@ MasterScriptProvider::getElementNames( ) throw ( RuntimeException, std::excepti
Sequence< OUString > names;
if ( true )
{
- throw RuntimeException( "getElementNames not implemented!!!!" ,
- Reference< XInterface >() );
+ throw RuntimeException( "getElementNames not implemented!!!!" );
}
return names;
}
@@ -769,8 +756,7 @@ sal_Bool SAL_CALL MasterScriptProvider::hasElements( ) throw ( RuntimeException
// TODO needs implementing
if ( true )
{
- throw RuntimeException( "hasElements not implemented!!!!" ,
- Reference< XInterface >() );
+ throw RuntimeException( "hasElements not implemented!!!!" );
}
return false;
}
@@ -787,8 +773,7 @@ MasterScriptProvider::getAllProviders() throw ( css::uno::RuntimeException )
{
OUString errorMsg(
"MasterScriptProvider::getAllProviders, cache not initialised");
- throw RuntimeException( errorMsg.concat( errorMsg ),
- Reference< XInterface >() );
+ throw RuntimeException( errorMsg.concat( errorMsg ) );
}
}
diff --git a/scripting/source/provider/ProviderCache.cxx b/scripting/source/provider/ProviderCache.cxx
index 71bba4c84e29..b094e2e224de 100644
--- a/scripting/source/provider/ProviderCache.cxx
+++ b/scripting/source/provider/ProviderCache.cxx
@@ -176,7 +176,7 @@ ProviderCache::populateCache() throw ( RuntimeException )
OUString temp =
"ProviderCache::populateCache: couldn't obtain XSingleComponentFactory for "
+ serviceName;
- throw RuntimeException( temp.concat( e.Message ), Reference< XInterface >() );
+ throw RuntimeException( temp.concat( e.Message ) );
}
}
@@ -191,7 +191,7 @@ ProviderCache::createProvider( ProviderDetails& details ) throw ( RuntimeExcepti
catch ( const Exception& e )
{
OUString temp("ProviderCache::createProvider() Error creating provider from factory!!!\n");
- throw RuntimeException( temp.concat( e.Message ), Reference< XInterface >() );
+ throw RuntimeException( temp.concat( e.Message ) );
}
return details.provider;
diff --git a/scripting/source/provider/ScriptImpl.cxx b/scripting/source/provider/ScriptImpl.cxx
index f06075164287..f17bb9a2f006 100644
--- a/scripting/source/provider/ScriptImpl.cxx
+++ b/scripting/source/provider/ScriptImpl.cxx
@@ -92,15 +92,13 @@ throw ( lang::IllegalArgumentException, script::CannotConvertException,
catch ( const RuntimeException & re )
{
OUString temp = "ScriptImpl::invoke RuntimeException : ";
- throw RuntimeException( temp.concat( re.Message ),
- Reference< XInterface > () );
+ throw RuntimeException( temp.concat( re.Message ) );
}
#ifdef _DEBUG
catch ( ... )
{
throw RuntimeException(
- "ScriptImpl::invoke Unknown Exception caught - RuntimeException rethrown",
- Reference< XInterface > () );
+ "ScriptImpl::invoke Unknown Exception caught - RuntimeException rethrown" );
}
#endif
return result;
diff --git a/scripting/source/provider/URIHelper.cxx b/scripting/source/provider/URIHelper.cxx
index a8498b33f9a7..1464e6ad3557 100644
--- a/scripting/source/provider/URIHelper.cxx
+++ b/scripting/source/provider/URIHelper.cxx
@@ -89,16 +89,12 @@ throw ( uno::Exception, uno::RuntimeException, std::exception )
args[0].getValueType() != ::cppu::UnoType<OUString>::get() ||
args[1].getValueType() != ::cppu::UnoType<OUString>::get() )
{
- throw uno::RuntimeException( OUString(
- "ScriptingFrameworkURIHelper got invalid argument list" ),
- uno::Reference< uno::XInterface >() );
+ throw uno::RuntimeException( "ScriptingFrameworkURIHelper got invalid argument list" );
}
if ( !(args[0] >>= m_sLanguage) || !(args[1] >>= m_sLocation) )
{
- throw uno::RuntimeException( OUString(
- "ScriptingFrameworkURIHelper error parsing args" ),
- uno::Reference< uno::XInterface >() );
+ throw uno::RuntimeException( "ScriptingFrameworkURIHelper error parsing args" );
}
SCRIPTS_PART = "/Scripts/";
@@ -106,9 +102,7 @@ throw ( uno::Exception, uno::RuntimeException, std::exception )
if ( !initBaseURI() )
{
- throw uno::RuntimeException( OUString(
- "ScriptingFrameworkURIHelper cannot find script directory"),
- uno::Reference< uno::XInterface >() );
+ throw uno::RuntimeException( "ScriptingFrameworkURIHelper cannot find script directory" );
}
}
diff --git a/scripting/source/stringresource/stringresource.cxx b/scripting/source/stringresource/stringresource.cxx
index 983bd2ca5811..1ecfd8e96487 100644
--- a/scripting/source/stringresource/stringresource.cxx
+++ b/scripting/source/stringresource/stringresource.cxx
@@ -195,7 +195,7 @@ OUString StringResourceImpl::implResolveString
{
OUString errorMsg("StringResourceImpl: No entry for ResourceID: ");
errorMsg = errorMsg.concat( ResourceID );
- throw ::com::sun::star::resource::MissingResourceException( errorMsg, Reference< XInterface >() );
+ throw ::com::sun::star::resource::MissingResourceException( errorMsg );
}
return aRetStr;
}
@@ -330,7 +330,7 @@ void StringResourceImpl::implCheckReadOnly( const sal_Char* pExceptionMsg )
if( m_bReadOnly )
{
OUString errorMsg = OUString::createFromAscii( pExceptionMsg );
- throw NoSupportException( errorMsg, Reference< XInterface >() );
+ throw NoSupportException( errorMsg );
}
}
@@ -443,7 +443,7 @@ void StringResourceImpl::implRemoveId( const OUString& ResourceID, LocaleItem* p
{
OUString errorMsg("StringResourceImpl: No entries for ResourceID: ");
errorMsg = errorMsg.concat( ResourceID );
- throw ::com::sun::star::resource::MissingResourceException( errorMsg, Reference< XInterface >() );
+ throw ::com::sun::star::resource::MissingResourceException( errorMsg );
}
rHashMap.erase( it );
pLocaleItem->m_bModified = true;
@@ -477,7 +477,7 @@ void StringResourceImpl::newLocale( const Locale& locale )
if( getItemForLocale( locale, false ) != NULL )
{
OUString errorMsg("StringResourceImpl: locale already exists");
- throw ElementExistException( errorMsg, Reference< XInterface >() );
+ throw ElementExistException( errorMsg );
}
// TODO?: Check if locale is valid? How?
@@ -632,7 +632,7 @@ sal_Int32 StringResourceImpl::getUniqueNumericId( )
if( m_nNextUniqueNumericId < UNIQUE_NUMBER_NEEDS_INITIALISATION )
{
OUString errorMsg("getUniqueNumericId: Extended sal_Int32 range");
- throw NoSupportException( errorMsg, Reference< XInterface >() );
+ throw NoSupportException( errorMsg );
}
return m_nNextUniqueNumericId;
}
@@ -746,8 +746,7 @@ Reference< XMultiComponentFactory > StringResourceImpl::getMultiComponentFactory
if( !xSMgr.is() )
{
throw RuntimeException(
- OUString( "StringResourceImpl::getMultiComponentFactory: Couldn't instantiate MultiComponentFactory" ),
- Reference< XInterface >() );
+ "StringResourceImpl::getMultiComponentFactory: Couldn't instantiate MultiComponentFactory" );
}
m_xMCF = xSMgr;
}
@@ -2329,8 +2328,7 @@ void StringResourceWithStorageImpl::initialize( const Sequence< Any >& aArgument
if ( aArguments.getLength() != 5 )
{
throw RuntimeException(
- OUString( "StringResourceWithStorageImpl::initialize: invalid number of arguments!" ),
- Reference< XInterface >() );
+ "StringResourceWithStorageImpl::initialize: invalid number of arguments!" );
}
bool bOk = (aArguments[0] >>= m_xStorage);
@@ -2656,8 +2654,7 @@ void StringResourceWithLocationImpl::initialize( const Sequence< Any >& aArgumen
if ( aArguments.getLength() != 6 )
{
throw RuntimeException(
- OUString( "XInitialization::initialize: invalid number of arguments!" ),
- Reference< XInterface >() );
+ "XInitialization::initialize: invalid number of arguments!" );
}
bool bOk = (aArguments[0] >>= m_aLocation);
diff --git a/scripting/source/vbaevents/eventhelper.cxx b/scripting/source/vbaevents/eventhelper.cxx
index 6a3a1df73987..2ac54c9a6f69 100644
--- a/scripting/source/vbaevents/eventhelper.cxx
+++ b/scripting/source/vbaevents/eventhelper.cxx
@@ -471,18 +471,18 @@ public:
virtual void SAL_CALL insertByName( const OUString&, const Any& ) throw (lang::IllegalArgumentException, container::ElementExistException, lang::WrappedTargetException, RuntimeException, std::exception) SAL_OVERRIDE
{
- throw RuntimeException("ReadOnly container", Reference< XInterface >() );
+ throw RuntimeException("ReadOnly container" );
}
virtual void SAL_CALL removeByName( const OUString& ) throw (::com::sun::star::container::NoSuchElementException, lang::WrappedTargetException, RuntimeException, std::exception) SAL_OVERRIDE
{
- throw RuntimeException("ReadOnly container", Reference< XInterface >() );
+ throw RuntimeException("ReadOnly container" );
}
// XNameReplace
virtual void SAL_CALL replaceByName( const OUString&, const Any& ) throw (lang::IllegalArgumentException, container::NoSuchElementException, lang::WrappedTargetException, RuntimeException, std::exception) SAL_OVERRIDE
{
- throw RuntimeException("ReadOnly container", Reference< XInterface >() );
+ throw RuntimeException("ReadOnly container" );
}