Kaydet (Commit) 2bcefa7a authored tarafından Saurav Sachidanand's avatar Saurav Sachidanand Kaydeden (comit) Stephan Bergmann

tdf#42982 Make UNO error reporting more descriptive

Change-Id: I0fae43ca1ab23f35e75fd6b88215940596aae09f
Reviewed-on: https://gerrit.libreoffice.org/33227Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarStephan Bergmann <sbergman@redhat.com>
üst eb399d69
......@@ -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 );
......
......@@ -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& )
......
......@@ -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 )
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment