[Libreoffice-commits] core.git: basic/source
Saurav Sachidanand
sauravsachidanand at gmail.com
Mon Feb 13 20:28:55 UTC 2017
basic/source/uno/dlgcont.cxx | 8 ++++----
basic/source/uno/namecont.cxx | 20 ++++++++------------
basic/source/uno/scriptcont.cxx | 22 +++++++++++-----------
3 files changed, 23 insertions(+), 27 deletions(-)
New commits:
commit 2bcefa7aab176bf18b45e7038e91dd07ced6edf7
Author: Saurav Sachidanand <sauravsachidanand at gmail.com>
Date: Tue Jan 17 22:16:28 2017 +0530
tdf#42982 Make UNO error reporting more descriptive
Change-Id: I0fae43ca1ab23f35e75fd6b88215940596aae09f
Reviewed-on: https://gerrit.libreoffice.org/33227
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Stephan Bergmann <sbergman at redhat.com>
diff --git a/basic/source/uno/dlgcont.cxx b/basic/source/uno/dlgcont.cxx
index a1a1f05..4bc0380 100644
--- a/basic/source/uno/dlgcont.cxx
+++ b/basic/source/uno/dlgcont.cxx
@@ -369,12 +369,12 @@ Reference< css::resource::XStringResourcePersistence >
xLibrariesStor = mxStorage->openStorageElement( maLibrariesDir, embed::ElementModes::READ );
// TODO: Should be READWRITE with new storage concept using store() instead of storeTo()
if ( !xLibrariesStor.is() )
- throw uno::RuntimeException();
+ throw uno::RuntimeException("null returned from openStorageElement");
xLibraryStor = xLibrariesStor->openStorageElement( aLibName, embed::ElementModes::READ );
// TODO: Should be READWRITE with new storage concept using store() instead of storeTo()
if ( !xLibraryStor.is() )
- throw uno::RuntimeException();
+ throw uno::RuntimeException("null returned from openStorageElement");
}
catch(const uno::Exception& )
{
@@ -422,12 +422,12 @@ void SfxDialogLibraryContainer::onNewRootStorage()
try {
xLibrariesStor = mxStorage->openStorageElement( maLibrariesDir, embed::ElementModes::READWRITE );
if ( !xLibrariesStor.is() )
- throw uno::RuntimeException();
+ throw uno::RuntimeException("null returned from openStorageElement");
OUString aLibName = pDialogLibrary->getName();
xLibraryStor = xLibrariesStor->openStorageElement( aLibName, embed::ElementModes::READWRITE );
if ( !xLibraryStor.is() )
- throw uno::RuntimeException();
+ throw uno::RuntimeException("null returned from openStorageElement");
Reference< resource::XStringResourceWithStorage >
xStringResourceWithStorage( xStringResourcePersistence, UNO_QUERY );
diff --git a/basic/source/uno/namecont.cxx b/basic/source/uno/namecont.cxx
index 4cf0c9d..ae83e5a 100644
--- a/basic/source/uno/namecont.cxx
+++ b/basic/source/uno/namecont.cxx
@@ -293,8 +293,7 @@ void SAL_CALL NameContainer::addContainerListener( const Reference< XContainerLi
{
if( !xListener.is() )
{
- throw RuntimeException("addContainerListener called with null xListener",
- static_cast< cppu::OWeakObject * >(this));
+ throw RuntimeException("addContainerListener called with null xListener");
}
maContainerListeners.addInterface( Reference<XInterface>(xListener, UNO_QUERY) );
}
@@ -303,8 +302,7 @@ void SAL_CALL NameContainer::removeContainerListener( const Reference< XContaine
{
if( !xListener.is() )
{
- throw RuntimeException("removeContainerListener called with null xListener",
- static_cast< cppu::OWeakObject * >(this));
+ throw RuntimeException("removeContainerListener called with null xListener");
}
maContainerListeners.removeInterface( Reference<XInterface>(xListener, UNO_QUERY) );
}
@@ -314,8 +312,7 @@ void SAL_CALL NameContainer::addChangesListener( const Reference< XChangesListen
{
if( !xListener.is() )
{
- throw RuntimeException("addChangesListener called with null xListener",
- static_cast< cppu::OWeakObject * >(this));
+ throw RuntimeException("addChangesListener called with null xListener");
}
maChangesListeners.addInterface( Reference<XInterface>(xListener, UNO_QUERY) );
}
@@ -324,8 +321,7 @@ void SAL_CALL NameContainer::removeChangesListener( const Reference< XChangesLis
{
if( !xListener.is() )
{
- throw RuntimeException("removeChangesListener called with null xListener",
- static_cast< cppu::OWeakObject * >(this));
+ throw RuntimeException("removeChangesListener called with null xListener");
}
maChangesListeners.removeInterface( Reference<XInterface>(xListener, UNO_QUERY) );
}
@@ -2086,7 +2082,7 @@ void SfxLibraryContainer::storeLibraries_Impl( const uno::Reference< embed::XSto
"The stream must implement XPropertySet!");
if ( !xProps.is() )
{
- throw uno::RuntimeException();
+ throw uno::RuntimeException("InfoStream doesn't implement XPropertySet");
}
OUString aMime( "text/xml" );
xProps->setPropertyValue("MediaType", uno::Any( aMime ) );
@@ -2144,7 +2140,7 @@ void SfxLibraryContainer::storeLibraries_Impl( const uno::Reference< embed::XSto
"The storage must implement XTransactedObject!");
if ( !xTransact.is() )
{
- throw uno::RuntimeException();
+ throw uno::RuntimeException("xTargetLibrariesStor doesn't implement XTransactedObject");
}
xTransact->commit();
}
@@ -2370,7 +2366,7 @@ void SAL_CALL SfxLibraryContainer::loadLibrary( const OUString& Name )
" storage!"));
if ( !xLibrariesStor.is() )
{
- throw uno::RuntimeException();
+ throw uno::RuntimeException("null returned from openStorageElement");
}
xLibraryStor = xLibrariesStor->openStorageElement( Name, embed::ElementModes::READ );
@@ -2380,7 +2376,7 @@ void SAL_CALL SfxLibraryContainer::loadLibrary( const OUString& Name )
" storage!"));
if ( !xLibrariesStor.is() )
{
- throw uno::RuntimeException();
+ throw uno::RuntimeException("null returned from openStorageElement");
}
}
catch(const uno::Exception& )
diff --git a/basic/source/uno/scriptcont.cxx b/basic/source/uno/scriptcont.cxx
index 02d76ac..cfd7447 100644
--- a/basic/source/uno/scriptcont.cxx
+++ b/basic/source/uno/scriptcont.cxx
@@ -624,7 +624,7 @@ bool SfxScriptLibraryContainer::implStorePasswordLibrary( SfxLibrary* pLib, cons
if ( !xCodeStream.is() )
{
- throw uno::RuntimeException();
+ throw uno::RuntimeException("null returned from openStreamElement");
}
SvMemoryStream aMemStream;
/*sal_Bool bStore = */pMod->StoreBinaryData( aMemStream, B_CURVERSION );
@@ -671,7 +671,7 @@ bool SfxScriptLibraryContainer::implStorePasswordLibrary( SfxLibrary* pLib, cons
uno::Reference< beans::XPropertySet > xProps( xSourceStream, uno::UNO_QUERY );
if ( !xProps.is() )
{
- throw uno::RuntimeException();
+ throw uno::RuntimeException("xSourceStream doesn't implement XPropertySet");
}
OUString aMime( "text/xml" );
xProps->setPropertyValue("MediaType", uno::Any( aMime ) );
@@ -756,7 +756,7 @@ bool SfxScriptLibraryContainer::implStorePasswordLibrary( SfxLibrary* pLib, cons
embed::ElementModes::READWRITE );
if ( !xElementRootStorage.is() )
{
- throw uno::RuntimeException();
+ throw uno::RuntimeException("null returned from GetStorageFromURL");
}
// Write binary image stream
SbModule* pMod = pBasicLib->FindModule( aElementName );
@@ -801,7 +801,7 @@ bool SfxScriptLibraryContainer::implStorePasswordLibrary( SfxLibrary* pLib, cons
"StorageStream opened for writing must implement XEncryptionProtectedSource!\n" );
if ( !xEncr.is() )
{
- throw uno::RuntimeException();
+ throw uno::RuntimeException("xSourceStream doesn't implement XEncryptionProtectedSource");
}
xEncr->setEncryptionPassword( pLib->maPassword );
}
@@ -816,7 +816,7 @@ bool SfxScriptLibraryContainer::implStorePasswordLibrary( SfxLibrary* pLib, cons
uno::Reference< beans::XPropertySet > xProps( xSourceStream, uno::UNO_QUERY );
if ( !xProps.is() )
{
- throw uno::RuntimeException();
+ throw uno::RuntimeException("xSourceStream doesn't implement XPropertySet");
}
OUString aMime( "text/xml" );
xProps->setPropertyValue("MediaType", uno::Any( aMime ) );
@@ -831,7 +831,7 @@ bool SfxScriptLibraryContainer::implStorePasswordLibrary( SfxLibrary* pLib, cons
OSL_ENSURE( xTransact.is(), "The storage must implement XTransactedObject!\n" );
if ( !xTransact.is() )
{
- throw uno::RuntimeException();
+ throw uno::RuntimeException("xElementRootStorage doesn't implement XTransactedObject");
}
xTransact->commit();
@@ -908,12 +908,12 @@ bool SfxScriptLibraryContainer::implLoadPasswordLibrary
xLibrariesStor = mxStorage->openStorageElement( maLibrariesDir, embed::ElementModes::READ );
if ( !xLibrariesStor.is() )
{
- throw uno::RuntimeException();
+ throw uno::RuntimeException("null returned from openStorageElement");
}
xLibraryStor = xLibrariesStor->openStorageElement( Name, embed::ElementModes::READ );
if ( !xLibraryStor.is() )
{
- throw uno::RuntimeException();
+ throw uno::RuntimeException("null returned from openStorageElement");
}
}
catch(const uno::Exception& )
@@ -945,7 +945,7 @@ bool SfxScriptLibraryContainer::implLoadPasswordLibrary
embed::ElementModes::READ );
if ( !xCodeStream.is() )
{
- throw uno::RuntimeException();
+ throw uno::RuntimeException("null returned from openStreamElement");
}
std::unique_ptr<SvStream> pStream(::utl::UcbStreamHelper::CreateStream( xCodeStream ));
if ( !pStream || pStream->GetError() )
@@ -980,7 +980,7 @@ bool SfxScriptLibraryContainer::implLoadPasswordLibrary
pLib->maPassword );
if ( !xSourceStream.is() )
{
- throw uno::RuntimeException();
+ throw uno::RuntimeException("null returned from openEncryptedStreamElement");
}
// if this point is reached then the password is correct
if ( !bVerifyPasswordOnly )
@@ -1094,7 +1094,7 @@ bool SfxScriptLibraryContainer::implLoadPasswordLibrary
pLib->maPassword );
if ( !xSourceStream.is() )
{
- throw uno::RuntimeException();
+ throw uno::RuntimeException("null returned from openEncryptedStreamElement");
}
if ( !bVerifyPasswordOnly )
{
More information about the Libreoffice-commits
mailing list