[Libreoffice-commits] core.git: 2 commits - comphelper/source connectivity/source

Stephan Bergmann sbergman at redhat.com
Wed Feb 15 14:19:26 UTC 2017


 comphelper/source/container/embeddedobjectcontainer.cxx |    4 -
 comphelper/source/misc/mimeconfighelper.cxx             |    5 --
 comphelper/source/misc/storagehelper.cxx                |   40 +++-------------
 connectivity/source/drivers/firebird/Tables.cxx         |    4 -
 4 files changed, 12 insertions(+), 41 deletions(-)

New commits:
commit 20d648625b991318793bbc7eacfa7c0f2c23f5da
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Tue Feb 14 16:11:11 2017 +0100

    Some simplifications, using UNO_QUERY_THROW
    
    Change-Id: I143ec0287421675fb13a03e8cf3c7054a17be37f
    Reviewed-on: https://gerrit.libreoffice.org/34271
    Tested-by: Stephan Bergmann <sbergman at redhat.com>
    Reviewed-by: Stephan Bergmann <sbergman at redhat.com>

diff --git a/comphelper/source/container/embeddedobjectcontainer.cxx b/comphelper/source/container/embeddedobjectcontainer.cxx
index 4e0324a..c05d143 100644
--- a/comphelper/source/container/embeddedobjectcontainer.cxx
+++ b/comphelper/source/container/embeddedobjectcontainer.cxx
@@ -1156,9 +1156,7 @@ bool EmbeddedObjectContainer::InsertGraphicStream( const css::uno::Reference < c
         ::comphelper::OStorageHelper::CopyInputToOutput( rStream, xOutStream );
         xOutStream->flush();
 
-        uno::Reference< beans::XPropertySet > xPropSet( xGraphicStream, uno::UNO_QUERY );
-        if ( !xPropSet.is() )
-            throw uno::RuntimeException();
+        uno::Reference< beans::XPropertySet > xPropSet( xGraphicStream, uno::UNO_QUERY_THROW );
 
         xPropSet->setPropertyValue("UseCommonStoragePasswordEncryption",
                                     uno::Any( true ) );
diff --git a/comphelper/source/misc/mimeconfighelper.cxx b/comphelper/source/misc/mimeconfighelper.cxx
index ef41ce3..a24e4ab 100644
--- a/comphelper/source/misc/mimeconfighelper.cxx
+++ b/comphelper/source/misc/mimeconfighelper.cxx
@@ -579,10 +579,7 @@ OUString MimeConfigurationHelper::UpdateMediaDescriptorWithFilterName(
 
         uno::Reference< document::XTypeDetection > xTypeDetection(
                 m_xContext->getServiceManager()->createInstanceWithContext("com.sun.star.document.TypeDetection", m_xContext),
-                uno::UNO_QUERY );
-
-        if ( !xTypeDetection.is() )
-            throw uno::RuntimeException(); // TODO
+                uno::UNO_QUERY_THROW );
 
         // typedetection can change the mode, add a stream and so on, thus a copy should be used
         uno::Sequence< beans::PropertyValue > aTempMD( aMediaDescr );
diff --git a/comphelper/source/misc/storagehelper.cxx b/comphelper/source/misc/storagehelper.cxx
index 0157843..d6229e9 100644
--- a/comphelper/source/misc/storagehelper.cxx
+++ b/comphelper/source/misc/storagehelper.cxx
@@ -74,10 +74,7 @@ uno::Reference< embed::XStorage > OStorageHelper::GetTemporaryStorage(
             const uno::Reference< uno::XComponentContext >& rxContext )
 {
     uno::Reference< embed::XStorage > xTempStorage( GetStorageFactory( rxContext )->createInstance(),
-                                                    uno::UNO_QUERY );
-    if ( !xTempStorage.is() )
-        throw uno::RuntimeException();
-
+                                                    uno::UNO_QUERY_THROW );
     return xTempStorage;
 }
 
@@ -92,10 +89,7 @@ uno::Reference< embed::XStorage > OStorageHelper::GetStorageFromURL(
     aArgs[1] <<= nStorageMode;
 
     uno::Reference< embed::XStorage > xTempStorage( GetStorageFactory( rxContext )->createInstanceWithArguments( aArgs ),
-                                                    uno::UNO_QUERY );
-    if ( !xTempStorage.is() )
-        throw uno::RuntimeException();
-
+                                                    uno::UNO_QUERY_THROW );
     return xTempStorage;
 }
 
@@ -124,10 +118,7 @@ uno::Reference< embed::XStorage > OStorageHelper::GetStorageFromURL2(
     if (!xFact.is()) throw uno::RuntimeException();
 
     uno::Reference< embed::XStorage > xTempStorage(
-        xFact->createInstanceWithArguments( aArgs ), uno::UNO_QUERY );
-    if ( !xTempStorage.is() )
-        throw uno::RuntimeException();
-
+        xFact->createInstanceWithArguments( aArgs ), uno::UNO_QUERY_THROW );
     return xTempStorage;
 }
 
@@ -141,10 +132,7 @@ uno::Reference< embed::XStorage > OStorageHelper::GetStorageFromInputStream(
     aArgs[1] <<= embed::ElementModes::READ;
 
     uno::Reference< embed::XStorage > xTempStorage( GetStorageFactory( rxContext )->createInstanceWithArguments( aArgs ),
-                                                    uno::UNO_QUERY );
-    if ( !xTempStorage.is() )
-        throw uno::RuntimeException();
-
+                                                    uno::UNO_QUERY_THROW );
     return xTempStorage;
 }
 
@@ -159,10 +147,7 @@ uno::Reference< embed::XStorage > OStorageHelper::GetStorageFromStream(
     aArgs[1] <<= nStorageMode;
 
     uno::Reference< embed::XStorage > xTempStorage( GetStorageFactory( rxContext )->createInstanceWithArguments( aArgs ),
-                                                    uno::UNO_QUERY );
-    if ( !xTempStorage.is() )
-        throw uno::RuntimeException();
-
+                                                    uno::UNO_QUERY_THROW );
     return xTempStorage;
 }
 
@@ -294,10 +279,7 @@ uno::Reference< embed::XStorage > OStorageHelper::GetStorageOfFormatFromURL(
     aArgs[2] <<= aProps;
 
     uno::Reference< embed::XStorage > xTempStorage( GetStorageFactory( rxContext )->createInstanceWithArguments( aArgs ),
-                                                    uno::UNO_QUERY );
-    if ( !xTempStorage.is() )
-        throw uno::RuntimeException();
-
+                                                    uno::UNO_QUERY_THROW );
     return xTempStorage;
 }
 
@@ -335,10 +317,7 @@ uno::Reference< embed::XStorage > OStorageHelper::GetStorageOfFormatFromInputStr
     aArgs[2] <<= aProps;
 
     uno::Reference< embed::XStorage > xTempStorage( GetStorageFactory( rxContext )->createInstanceWithArguments( aArgs ),
-                                                    uno::UNO_QUERY );
-    if ( !xTempStorage.is() )
-        throw uno::RuntimeException();
-
+                                                    uno::UNO_QUERY_THROW );
     return xTempStorage;
 }
 
@@ -377,10 +356,7 @@ uno::Reference< embed::XStorage > OStorageHelper::GetStorageOfFormatFromStream(
     aArgs[2] <<= aProps;
 
     uno::Reference< embed::XStorage > xTempStorage( GetStorageFactory( rxContext )->createInstanceWithArguments( aArgs ),
-                                                    uno::UNO_QUERY );
-    if ( !xTempStorage.is() )
-        throw uno::RuntimeException();
-
+                                                    uno::UNO_QUERY_THROW );
     return xTempStorage;
 }
 
commit 367baee6ed2aa6e043333e04724831e095c5fead
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Tue Feb 14 16:11:06 2017 +0100

    Some simplifications, using UNO_QUERY_THROW
    
    Change-Id: I3bfa7b8896c9eb191047edf469749bb7f0128dfd
    Reviewed-on: https://gerrit.libreoffice.org/34270
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Stephan Bergmann <sbergman at redhat.com>

diff --git a/connectivity/source/drivers/firebird/Tables.cxx b/connectivity/source/drivers/firebird/Tables.cxx
index 2643a7a..bc21f08 100644
--- a/connectivity/source/drivers/firebird/Tables.cxx
+++ b/connectivity/source/drivers/firebird/Tables.cxx
@@ -51,9 +51,9 @@ ObjectType Tables::createObject(const OUString& rName)
     if (!xTables.is())
         throw RuntimeException();
 
-    uno::Reference< XRow > xRow(xTables,UNO_QUERY);
+    uno::Reference< XRow > xRow(xTables,UNO_QUERY_THROW);
 
-    if (!xRow.is() || !xTables->next())
+    if (!xTables->next())
         throw RuntimeException();
 
     ObjectType xRet(new Table(this,


More information about the Libreoffice-commits mailing list