summaryrefslogtreecommitdiff
path: root/dbaccess
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2017-09-22 14:52:24 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2017-09-23 09:01:46 +0200
commit2684aefcf5d2804351bda01a2d2fe7bbbd351451 (patch)
tree5c19a705883a068a4945d7e49376296e341cb191 /dbaccess
parent1fde962b71860d77fb10e9b16c9d5b6c124d9b61 (diff)
new loplugin unnecessarycatchthrow
Change-Id: Iabab71ee076227bc38447ec109afaea1e53a86a6 Reviewed-on: https://gerrit.libreoffice.org/42643 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'dbaccess')
-rw-r--r--dbaccess/source/core/api/tablecontainer.cxx86
-rw-r--r--dbaccess/source/ui/misc/linkeddocuments.cxx20
2 files changed, 44 insertions, 62 deletions
diff --git a/dbaccess/source/core/api/tablecontainer.cxx b/dbaccess/source/core/api/tablecontainer.cxx
index c900a5e4ec0e..a7ce9d8981e2 100644
--- a/dbaccess/source/core/api/tablecontainer.cxx
+++ b/dbaccess/source/core/api/tablecontainer.cxx
@@ -271,7 +271,6 @@ ObjectType OTableContainer::appendObject( const OUString& _rForName, const Refer
PContainerApprove pApprove( new ObjectNameApproval( xConnection, ObjectNameApproval::TypeTable ) );
pApprove->approveElement( aName, descriptor );
- try
{
EnsureReset aReset(m_nInAppend);
Reference<XAppend> xAppend(m_xMasterContainer,UNO_QUERY);
@@ -294,10 +293,6 @@ ObjectType OTableContainer::appendObject( const OUString& _rForName, const Refer
}
}
}
- catch(const Exception&)
- {
- throw;
- }
Reference<XPropertySet> xTableDefinition;
Reference<XNameAccess> xColumnDefinitions;
@@ -343,61 +338,54 @@ ObjectType OTableContainer::appendObject( const OUString& _rForName, const Refer
// XDrop
void OTableContainer::dropObject(sal_Int32 _nPos, const OUString& _sElementName)
{
- try
+ Reference< XDrop > xDrop(m_xMasterContainer,UNO_QUERY);
+ if(xDrop.is())
+ xDrop->dropByName(_sElementName);
+ else
{
- Reference< XDrop > xDrop(m_xMasterContainer,UNO_QUERY);
- if(xDrop.is())
- xDrop->dropByName(_sElementName);
- else
- {
- OUString sCatalog,sSchema,sTable,sComposedName;
+ OUString sCatalog,sSchema,sTable,sComposedName;
- bool bIsView = false;
- Reference<XPropertySet> xTable(getObject(_nPos),UNO_QUERY);
- if ( xTable.is() && m_xMetaData.is() )
- {
- if( m_xMetaData.is() && m_xMetaData->supportsCatalogsInTableDefinitions() )
- xTable->getPropertyValue(PROPERTY_CATALOGNAME) >>= sCatalog;
- if( m_xMetaData.is() && m_xMetaData->supportsSchemasInTableDefinitions() )
- xTable->getPropertyValue(PROPERTY_SCHEMANAME) >>= sSchema;
- xTable->getPropertyValue(PROPERTY_NAME) >>= sTable;
+ bool bIsView = false;
+ Reference<XPropertySet> xTable(getObject(_nPos),UNO_QUERY);
+ if ( xTable.is() && m_xMetaData.is() )
+ {
+ if( m_xMetaData.is() && m_xMetaData->supportsCatalogsInTableDefinitions() )
+ xTable->getPropertyValue(PROPERTY_CATALOGNAME) >>= sCatalog;
+ if( m_xMetaData.is() && m_xMetaData->supportsSchemasInTableDefinitions() )
+ xTable->getPropertyValue(PROPERTY_SCHEMANAME) >>= sSchema;
+ xTable->getPropertyValue(PROPERTY_NAME) >>= sTable;
- sComposedName = ::dbtools::composeTableName( m_xMetaData, sCatalog, sSchema, sTable, true, ::dbtools::EComposeRule::InTableDefinitions );
+ sComposedName = ::dbtools::composeTableName( m_xMetaData, sCatalog, sSchema, sTable, true, ::dbtools::EComposeRule::InTableDefinitions );
- OUString sType;
- xTable->getPropertyValue(PROPERTY_TYPE) >>= sType;
- bIsView = sType.equalsIgnoreAsciiCase("VIEW");
- }
+ OUString sType;
+ xTable->getPropertyValue(PROPERTY_TYPE) >>= sType;
+ bIsView = sType.equalsIgnoreAsciiCase("VIEW");
+ }
- if(sComposedName.isEmpty())
- ::dbtools::throwFunctionSequenceException(static_cast<XTypeProvider*>(static_cast<OFilteredContainer*>(this)));
+ if(sComposedName.isEmpty())
+ ::dbtools::throwFunctionSequenceException(static_cast<XTypeProvider*>(static_cast<OFilteredContainer*>(this)));
- OUString aSql("DROP ");
+ OUString aSql("DROP ");
- if ( bIsView ) // here we have a view
- aSql += "VIEW ";
- else
- aSql += "TABLE ";
- aSql += sComposedName;
- Reference<XConnection> xCon = m_xConnection;
- OSL_ENSURE(xCon.is(),"Connection is null!");
- if ( xCon.is() )
- {
- Reference< XStatement > xStmt = xCon->createStatement( );
- if(xStmt.is())
- xStmt->execute(aSql);
- ::comphelper::disposeComponent(xStmt);
- }
- }
-
- if ( m_xTableDefinitions.is() && m_xTableDefinitions->hasByName(_sElementName) )
+ if ( bIsView ) // here we have a view
+ aSql += "VIEW ";
+ else
+ aSql += "TABLE ";
+ aSql += sComposedName;
+ Reference<XConnection> xCon = m_xConnection;
+ OSL_ENSURE(xCon.is(),"Connection is null!");
+ if ( xCon.is() )
{
- m_xTableDefinitions->removeByName(_sElementName);
+ Reference< XStatement > xStmt = xCon->createStatement( );
+ if(xStmt.is())
+ xStmt->execute(aSql);
+ ::comphelper::disposeComponent(xStmt);
}
}
- catch(const Exception&)
+
+ if ( m_xTableDefinitions.is() && m_xTableDefinitions->hasByName(_sElementName) )
{
- throw;
+ m_xTableDefinitions->removeByName(_sElementName);
}
}
diff --git a/dbaccess/source/ui/misc/linkeddocuments.cxx b/dbaccess/source/ui/misc/linkeddocuments.cxx
index d4e41b2e5385..102f7eca51a6 100644
--- a/dbaccess/source/ui/misc/linkeddocuments.cxx
+++ b/dbaccess/source/ui/misc/linkeddocuments.cxx
@@ -151,23 +151,17 @@ namespace dbaui
aArguments.put( "OpenMode", sOpenMode );
aArguments.put( OUString(PROPERTY_ACTIVE_CONNECTION), m_xConnection );
- try
- {
- Reference<XHierarchicalNameContainer> xHier(m_xDocumentContainer,UNO_QUERY);
- if ( xHier.is() && xHier->hasByHierarchicalName(_rLinkName) )
- {
- _xDefinition.set(xHier->getByHierarchicalName(_rLinkName),UNO_QUERY);
- }
-
- aArguments.merge( _rAdditionalArgs, true );
- xRet = xComponentLoader->loadComponentFromURL( _rLinkName, OUString(), 0, aArguments.getPropertyValues() );
- }
- catch(const Exception&)
+ Reference<XHierarchicalNameContainer> xHier(m_xDocumentContainer,UNO_QUERY);
+ if ( xHier.is() && xHier->hasByHierarchicalName(_rLinkName) )
{
- throw;
+ _xDefinition.set(xHier->getByHierarchicalName(_rLinkName),UNO_QUERY);
}
+ aArguments.merge( _rAdditionalArgs, true );
+
+ xRet = xComponentLoader->loadComponentFromURL( _rLinkName, OUString(), 0, aArguments.getPropertyValues() );
+
return xRet;
}
void OLinkedDocumentsAccess::impl_newWithPilot( const char* _pWizardService,