summaryrefslogtreecommitdiff
path: root/dbaccess
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2015-02-05 10:30:48 +0000
committerLionel Elie Mamane <lionel@mamane.lu>2015-02-05 20:56:31 +0000
commiteaf6618df939ac5c41281ddf6744c4e8a0f687c5 (patch)
treef5a954ffb2c2d979db3e6afb1f18952bc1c3da12 /dbaccess
parentdf967d58b8e7aa640370819c1d4c5728f937c39d (diff)
Resolves: tdf#88825 absent datasource causes exception / abort
::dbtools::ensureRowSetConnection throws on failure, and it can fail of course if the database doesn't exist its not generally useful to throw through a vcl event handler as that just leads back to the dispatch loop. (cherry picked from commit 863122b9adecedfcf35ffac1354ef8a85d5b6827) Conflicts: dbaccess/source/ui/browser/sbagrid.cxx Change-Id: I8e8f4cff06de5684f163ed1b658a8794f54a7df2 Reviewed-on: https://gerrit.libreoffice.org/14330 Reviewed-by: Lionel Elie Mamane <lionel@mamane.lu> Tested-by: Lionel Elie Mamane <lionel@mamane.lu>
Diffstat (limited to 'dbaccess')
-rw-r--r--dbaccess/source/ui/browser/sbagrid.cxx35
1 files changed, 21 insertions, 14 deletions
diff --git a/dbaccess/source/ui/browser/sbagrid.cxx b/dbaccess/source/ui/browser/sbagrid.cxx
index 1fd968578621..889e94a0722b 100644
--- a/dbaccess/source/ui/browser/sbagrid.cxx
+++ b/dbaccess/source/ui/browser/sbagrid.cxx
@@ -971,9 +971,9 @@ Reference< XPropertySet > SbaGridControl::getField(sal_uInt16 nModelPos)
else
OSL_FAIL("SbaGridControl::getField getColumns returns NULL or ModelPos is > than count!");
}
- catch (const Exception&)
+ catch (const Exception& e)
{
- OSL_FAIL("SbaGridControl::getField Exception occurred!");
+ SAL_WARN("dbaccess", "SbaGridControl::getField Exception occurred: " << e.Message);
}
return xEmptyReturn;
@@ -984,24 +984,31 @@ bool SbaGridControl::IsReadOnlyDB() const
// assume yes if anything fails
bool bDBIsReadOnly = true;
- // the db is the implemented by the parent of the grid control's model ...
- Reference< XChild > xColumns(GetPeer()->getColumns(), UNO_QUERY);
- if (xColumns.is())
+ try
{
- Reference< XRowSet > xDataSource(xColumns->getParent(), UNO_QUERY);
- Reference< XChild > xConn(::dbtools::getConnection(xDataSource),UNO_QUERY);
- if (xConn.is())
+ // the db is the implemented by the parent of the grid control's model ...
+ Reference< XChild > xColumns(GetPeer()->getColumns(), UNO_QUERY);
+ if (xColumns.is())
{
- // ... and the RO-flag simply is implemented by a property
- Reference< XPropertySet > xDbProps(xConn->getParent(), UNO_QUERY);
- if (xDbProps.is())
+ Reference< XRowSet > xDataSource(xColumns->getParent(), UNO_QUERY);
+ Reference< XChild > xConn(::dbtools::getConnection(xDataSource),UNO_QUERY);
+ if (xConn.is())
{
- Reference< XPropertySetInfo > xInfo = xDbProps->getPropertySetInfo();
- if (xInfo->hasPropertyByName(PROPERTY_ISREADONLY))
- bDBIsReadOnly = ::comphelper::getBOOL(xDbProps->getPropertyValue(PROPERTY_ISREADONLY));
+ // ... and the RO-flag simply is implemented by a property
+ Reference< XPropertySet > xDbProps(xConn->getParent(), UNO_QUERY);
+ if (xDbProps.is())
+ {
+ Reference< XPropertySetInfo > xInfo = xDbProps->getPropertySetInfo();
+ if (xInfo->hasPropertyByName(PROPERTY_ISREADONLY))
+ bDBIsReadOnly = ::comphelper::getBOOL(xDbProps->getPropertyValue(PROPERTY_ISREADONLY));
+ }
}
}
}
+ catch (const Exception& e)
+ {
+ SAL_WARN("dbaccess", "SbaGridControl::IsReadOnlyDB Exception occurred: " << e.Message);
+ }
return bDBIsReadOnly;
}