[Libreoffice-commits] core.git: dbaccess/source

Caolán McNamara caolanm at redhat.com
Thu Feb 5 02:35:08 PST 2015


 dbaccess/source/ui/browser/sbagrid.cxx |   38 +++++++++++++++++++--------------
 1 file changed, 23 insertions(+), 15 deletions(-)

New commits:
commit 863122b9adecedfcf35ffac1354ef8a85d5b6827
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Feb 5 10:30:48 2015 +0000

    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.
    
    Change-Id: I8e8f4cff06de5684f163ed1b658a8794f54a7df2

diff --git a/dbaccess/source/ui/browser/sbagrid.cxx b/dbaccess/source/ui/browser/sbagrid.cxx
index dcd42dc..632e7fd 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,25 +984,33 @@ 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);
-        ::dbtools::ensureRowSetConnection( xDataSource, getContext(), false ); // NOT SURE ABOUT FALSE
-        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);
+            ::dbtools::ensureRowSetConnection( xDataSource, getContext(), false ); // NOT SURE ABOUT FALSE
+            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;
 }
 


More information about the Libreoffice-commits mailing list