summaryrefslogtreecommitdiff
path: root/connectivity
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2018-06-07 13:03:58 +0200
committerMike Kaganski <mike.kaganski@collabora.com>2018-06-08 01:29:32 +0200
commit5708534b942c1d0ce384f6a8473da6bb569410e7 (patch)
tree2ec4fe87624541c15bf89c8b839e8f8dba8a89f4 /connectivity
parent1e55a47e89a9d9d6cf9cb3993484022aaf2c097b (diff)
look for unnecessary calls to Reference::is() after an UNO_QUERY_THROW
Since the previous call would throw if there was nothing to be assigned to the value. Idea from tml. Used the following script to find places: git grep -A3 -n UNO_QUERY_THROW | grep -B3 -F 'is()' Change-Id: I36ba7b00bcd014bdf16c0455ab91056f82194969 Reviewed-on: https://gerrit.libreoffice.org/55417 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Tor Lillqvist <tml@collabora.com> Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'connectivity')
-rw-r--r--connectivity/source/commontools/dbtools.cxx15
-rw-r--r--connectivity/source/drivers/component/CDatabaseMetaData.cxx1
-rw-r--r--connectivity/source/drivers/hsqldb/HConnection.cxx3
3 files changed, 7 insertions, 12 deletions
diff --git a/connectivity/source/commontools/dbtools.cxx b/connectivity/source/commontools/dbtools.cxx
index 1540b49840e4..3a32d21e5a77 100644
--- a/connectivity/source/commontools/dbtools.cxx
+++ b/connectivity/source/commontools/dbtools.cxx
@@ -485,16 +485,13 @@ Reference< XNameAccess> getPrimaryKeyColumns_throw(const Reference< XPropertySet
for(sal_Int32 i = 0;i< nCount;++i)
{
xProp.set(xKeys->getByIndex(i),UNO_QUERY_THROW);
- if ( xProp.is() )
+ sal_Int32 nKeyType = 0;
+ xProp->getPropertyValue(sPropName) >>= nKeyType;
+ if(KeyType::PRIMARY == nKeyType)
{
- sal_Int32 nKeyType = 0;
- xProp->getPropertyValue(sPropName) >>= nKeyType;
- if(KeyType::PRIMARY == nKeyType)
- {
- const Reference<XColumnsSupplier> xKeyColsSup(xProp,UNO_QUERY_THROW);
- xKeyColumns = xKeyColsSup->getColumns();
- break;
- }
+ const Reference<XColumnsSupplier> xKeyColsSup(xProp,UNO_QUERY_THROW);
+ xKeyColumns = xKeyColsSup->getColumns();
+ break;
}
}
}
diff --git a/connectivity/source/drivers/component/CDatabaseMetaData.cxx b/connectivity/source/drivers/component/CDatabaseMetaData.cxx
index 7834e53c18b7..a2edb795fc1e 100644
--- a/connectivity/source/drivers/component/CDatabaseMetaData.cxx
+++ b/connectivity/source/drivers/component/CDatabaseMetaData.cxx
@@ -152,7 +152,6 @@ Reference< XResultSet > SAL_CALL OComponentDatabaseMetaData::getColumns(
if(match(tableNamePattern,*pTabIter,'\0'))
{
const Reference< XColumnsSupplier> xTable(xNames->getByName(*pTabIter),UNO_QUERY_THROW);
- OSL_ENSURE(xTable.is(),"Table not found! Normally a exception had to be thrown here!");
aRow[3] = new ORowSetValueDecorator(*pTabIter);
const Reference< XNameAccess> xColumns = xTable->getColumns();
diff --git a/connectivity/source/drivers/hsqldb/HConnection.cxx b/connectivity/source/drivers/hsqldb/HConnection.cxx
index 04d58a33a1b3..4b43df187eda 100644
--- a/connectivity/source/drivers/hsqldb/HConnection.cxx
+++ b/connectivity/source/drivers/hsqldb/HConnection.cxx
@@ -247,8 +247,7 @@ namespace connectivity { namespace hsqldb
try
{
Reference< XNameAccess > xTables( impl_getTableContainer_throw(), UNO_QUERY_THROW );
- if ( xTables.is() )
- bDoesExist = xTables->hasByName( _rTableName );
+ bDoesExist = xTables->hasByName( _rTableName );
}
catch( const Exception& )
{