diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-06-07 13:03:58 +0200 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2018-06-08 01:29:32 +0200 |
commit | 5708534b942c1d0ce384f6a8473da6bb569410e7 (patch) | |
tree | 2ec4fe87624541c15bf89c8b839e8f8dba8a89f4 /test | |
parent | 1e55a47e89a9d9d6cf9cb3993484022aaf2c097b (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 'test')
-rw-r--r-- | test/source/container/xindexaccess.cxx | 2 | ||||
-rw-r--r-- | test/source/container/xnamereplace.cxx | 1 | ||||
-rw-r--r-- | test/source/sheet/tableautoformatfield.cxx | 3 | ||||
-rw-r--r-- | test/source/sheet/xconsolidatable.cxx | 2 | ||||
-rw-r--r-- | test/source/sheet/xdatabaserange.cxx | 1 | ||||
-rw-r--r-- | test/source/sheet/xdatapilotdescriptor.cxx | 3 | ||||
-rw-r--r-- | test/source/sheet/xdatapilottable2.cxx | 1 | ||||
-rw-r--r-- | test/source/sheet/xdatapilottables.cxx | 1 | ||||
-rw-r--r-- | test/source/sheet/xdatapilottablessupplier.cxx | 1 | ||||
-rw-r--r-- | test/source/sheet/xscenariossupplier.cxx | 2 | ||||
-rw-r--r-- | test/source/sheet/xsheetannotationssupplier.cxx | 1 | ||||
-rw-r--r-- | test/source/sheet/xspreadsheet.cxx | 2 | ||||
-rw-r--r-- | test/source/sheet/xspreadsheets2.cxx | 3 |
13 files changed, 0 insertions, 23 deletions
diff --git a/test/source/container/xindexaccess.cxx b/test/source/container/xindexaccess.cxx index c17942507fe5..3791e2b76393 100644 --- a/test/source/container/xindexaccess.cxx +++ b/test/source/container/xindexaccess.cxx @@ -48,8 +48,6 @@ void XIndexAccess::testGetByIndex() void XIndexAccess::testGetByIndexException() { uno::Reference< container::XIndexAccess > xIndexAccess(init(), UNO_QUERY_THROW); - CPPUNIT_ASSERT(xIndexAccess.is()); - xIndexAccess->getByIndex(mnItems); } diff --git a/test/source/container/xnamereplace.cxx b/test/source/container/xnamereplace.cxx index 77badb46a0c2..cd2a05ae8f9a 100644 --- a/test/source/container/xnamereplace.cxx +++ b/test/source/container/xnamereplace.cxx @@ -22,7 +22,6 @@ void XNameReplace::testReplaceByName() xNameReplace->replaceByName(maTestReplacementName, getAnyElementForNameReplace()); Any aAny = xNameReplace->getByName( maTestReplacementName ); uno::Reference< uno::XInterface > xElement(aAny, UNO_QUERY_THROW); - CPPUNIT_ASSERT(xElement.is()); } } diff --git a/test/source/sheet/tableautoformatfield.cxx b/test/source/sheet/tableautoformatfield.cxx index ebcc50d26c89..63387e5e388c 100644 --- a/test/source/sheet/tableautoformatfield.cxx +++ b/test/source/sheet/tableautoformatfield.cxx @@ -19,11 +19,8 @@ namespace apitest { uno::Reference< beans::XPropertySet > TableAutoFormatField::initTest() { uno::Reference< container::XIndexAccess > xAutoFormatFields( getServiceFactory()->createInstance("com.sun.star.sheet.TableAutoFormats"), UNO_QUERY_THROW ); - CPPUNIT_ASSERT(xAutoFormatFields.is()); uno::Reference< container::XIndexAccess > xIndex( xAutoFormatFields->getByIndex(0), UNO_QUERY_THROW ); - CPPUNIT_ASSERT(xIndex.is()); uno::Reference< beans::XPropertySet > xReturn( xIndex->getByIndex(0), UNO_QUERY_THROW ); - CPPUNIT_ASSERT_MESSAGE("could not create table auto formats", xReturn.is()); return xReturn; } diff --git a/test/source/sheet/xconsolidatable.cxx b/test/source/sheet/xconsolidatable.cxx index f5616e78c43e..77f6943bc008 100644 --- a/test/source/sheet/xconsolidatable.cxx +++ b/test/source/sheet/xconsolidatable.cxx @@ -27,8 +27,6 @@ void XConsolidatable::testCreateConsolidationDescriptor() uno::Reference<sheet::XConsolidationDescriptor> xConsolidationDescriptor( xConsolidatable->createConsolidationDescriptor(true), UNO_QUERY_THROW); - CPPUNIT_ASSERT_MESSAGE("Unable to create ConsolidationDescriptor", - xConsolidationDescriptor.is()); } void XConsolidatable::testConsolidate() diff --git a/test/source/sheet/xdatabaserange.cxx b/test/source/sheet/xdatabaserange.cxx index 94caccec9374..d00631820647 100644 --- a/test/source/sheet/xdatabaserange.cxx +++ b/test/source/sheet/xdatabaserange.cxx @@ -130,7 +130,6 @@ void XDatabaseRange::testGetFilterDescriptor() { uno::Reference< sheet::XDatabaseRange > xDBRange( init("FilterDescriptor"), UNO_QUERY_THROW); uno::Reference< uno::XInterface > xFilterDescr( xDBRange->getFilterDescriptor(), UNO_QUERY_THROW); - CPPUNIT_ASSERT(xFilterDescr.is()); } void XDatabaseRange::testGetImportDescriptor() diff --git a/test/source/sheet/xdatapilotdescriptor.cxx b/test/source/sheet/xdatapilotdescriptor.cxx index 33557a72fa99..eb3b69636315 100644 --- a/test/source/sheet/xdatapilotdescriptor.cxx +++ b/test/source/sheet/xdatapilotdescriptor.cxx @@ -70,7 +70,6 @@ void XDataPilotDescriptor::testGetFilterDescriptor() void XDataPilotDescriptor::testGetDataPilotFields_Impl( uno::Reference< sheet::XDataPilotDescriptor > const & xDescr) { uno::Reference< container::XIndexAccess > xIndex(xDescr->getDataPilotFields(), UNO_QUERY_THROW); - CPPUNIT_ASSERT( xIndex.is()); sal_Int32 nCount = xIndex->getCount(); @@ -78,13 +77,11 @@ void XDataPilotDescriptor::testGetDataPilotFields_Impl( uno::Reference< sheet::X for (sal_Int32 i = 0; i < nCount && i < 5; ++i) { uno::Reference< container::XNamed > xNamed( xIndex->getByIndex( i ), UNO_QUERY_THROW); - CPPUNIT_ASSERT(xNamed.is()); OUString aName = xNamed->getName(); maFieldNames.push_back(aName); CPPUNIT_ASSERT( aName != "Data" ); uno::Reference< beans::XPropertySet > xPropSet( xNamed, UNO_QUERY_THROW); - CPPUNIT_ASSERT( xPropSet.is() ); switch ( i % 5 ) { diff --git a/test/source/sheet/xdatapilottable2.cxx b/test/source/sheet/xdatapilottable2.cxx index 471996627d28..5d49871bc620 100644 --- a/test/source/sheet/xdatapilottable2.cxx +++ b/test/source/sheet/xdatapilottable2.cxx @@ -161,7 +161,6 @@ void XDataPilotTable2::testInsertDrillDownSheet() { CPPUNIT_ASSERT(aData.getLength() >= 2); uno::Reference< sheet::XSpreadsheet > xSheet(xIA->getByIndex(aAddr.Sheet),UNO_QUERY_THROW); - CPPUNIT_ASSERT(xSheet.is()); checkDrillDownSheetContent(xSheet, aData); diff --git a/test/source/sheet/xdatapilottables.cxx b/test/source/sheet/xdatapilottables.cxx index e99bbea4c893..543bf48d6db4 100644 --- a/test/source/sheet/xdatapilottables.cxx +++ b/test/source/sheet/xdatapilottables.cxx @@ -30,7 +30,6 @@ void XDataPilotTables::testXDataPilotTables() uno::Reference<sheet::XDataPilotDescriptor> xDPD(xDPT->createDataPilotDescriptor(), UNO_QUERY_THROW); - CPPUNIT_ASSERT_MESSAGE("Unable to create DataPilotDescriptor", xDPD.is()); xDPT->insertNewByName("XDataPilotTables", table::CellAddress(0, 9, 8), xDPD); CPPUNIT_ASSERT_EQUAL_MESSAGE("Unable to insert new DataPilotTable", OUString("Filter"), diff --git a/test/source/sheet/xdatapilottablessupplier.cxx b/test/source/sheet/xdatapilottablessupplier.cxx index 5a761d98d65c..b9ea30d3d173 100644 --- a/test/source/sheet/xdatapilottablessupplier.cxx +++ b/test/source/sheet/xdatapilottablessupplier.cxx @@ -25,7 +25,6 @@ void XDataPilotTablesSupplier::testGetDataPilotTables() uno::Reference<sheet::XDataPilotTablesSupplier> xDPTS(init(), UNO_QUERY_THROW); uno::Reference<sheet::XDataPilotTables> xDPT(xDPTS->getDataPilotTables(), UNO_QUERY_THROW); - CPPUNIT_ASSERT_MESSAGE("Unable to get XDataPilotTables", xDPT.is()); } } diff --git a/test/source/sheet/xscenariossupplier.cxx b/test/source/sheet/xscenariossupplier.cxx index c9819d5e8389..e54c923e3438 100644 --- a/test/source/sheet/xscenariossupplier.cxx +++ b/test/source/sheet/xscenariossupplier.cxx @@ -23,9 +23,7 @@ namespace apitest void XScenariosSupplier::testGetScenarios() { uno::Reference<sheet::XScenariosSupplier> xSupplier(init(), UNO_QUERY_THROW); - uno::Reference<sheet::XScenarios> xScenarios(xSupplier->getScenarios(), UNO_QUERY_THROW); - CPPUNIT_ASSERT_MESSAGE("Unable to get XScenarios", xScenarios.is()); } } diff --git a/test/source/sheet/xsheetannotationssupplier.cxx b/test/source/sheet/xsheetannotationssupplier.cxx index 82e4bb41e6c9..622ea2bc202a 100644 --- a/test/source/sheet/xsheetannotationssupplier.cxx +++ b/test/source/sheet/xsheetannotationssupplier.cxx @@ -26,7 +26,6 @@ void XSheetAnnotationsSupplier::testGetAnnotations() uno::Reference<sheet::XSheetAnnotations> xAnnotations(xSupplier->getAnnotations(), UNO_QUERY_THROW); - CPPUNIT_ASSERT_MESSAGE("Unable to get XSheetAnnotations", xAnnotations.is()); } } diff --git a/test/source/sheet/xspreadsheet.cxx b/test/source/sheet/xspreadsheet.cxx index 2b6d0a0fec27..d1df8a690ddc 100644 --- a/test/source/sheet/xspreadsheet.cxx +++ b/test/source/sheet/xspreadsheet.cxx @@ -27,7 +27,6 @@ void XSpreadsheet::testCreateCursor() uno::Reference< sheet::XSpreadsheet > xSheet(init(), UNO_QUERY_THROW); uno::Reference< sheet::XSheetCellCursor > xCursor(xSheet->createCursor(), UNO_QUERY_THROW); - CPPUNIT_ASSERT_MESSAGE("Unable to create XSheetCellCursor", xCursor.is()); } void XSpreadsheet::testCreateCursorByRange() @@ -36,7 +35,6 @@ void XSpreadsheet::testCreateCursorByRange() uno::Reference< sheet::XSheetCellRange > xCellRange(xSheet->getCellRangeByPosition(1, 1, 2, 3), UNO_QUERY_THROW); uno::Reference< sheet::XSheetCellCursor > xCursor(xSheet->createCursorByRange(xCellRange), UNO_QUERY_THROW); - CPPUNIT_ASSERT_MESSAGE("Unable to create XSheetCellCursor", xCursor.is()); } } diff --git a/test/source/sheet/xspreadsheets2.cxx b/test/source/sheet/xspreadsheets2.cxx index 5171d0a04291..162198b00fad 100644 --- a/test/source/sheet/xspreadsheets2.cxx +++ b/test/source/sheet/xspreadsheets2.cxx @@ -285,7 +285,6 @@ uno::Reference< sheet::XSpreadsheetDocument> XSpreadsheets2::getDoc(const OUStri CPPUNIT_ASSERT(xComp.is()); uno::Reference< sheet::XSpreadsheetDocument > xDoc(xComp, UNO_QUERY_THROW); - CPPUNIT_ASSERT(xDoc.is()); return xDoc; } @@ -293,8 +292,6 @@ uno::Reference< sheet::XNamedRanges> XSpreadsheets2::getNamedRanges(uno::Referen { uno::Reference< beans::XPropertySet > xPropSet (xDoc, UNO_QUERY_THROW); uno::Reference< sheet::XNamedRanges > xNamedRanges(xPropSet->getPropertyValue("NamedRanges"), UNO_QUERY_THROW); - CPPUNIT_ASSERT(xNamedRanges.is()); - return xNamedRanges; } |