ucbhelper/source/provider/resultsethelper.cxx |   45 ++++++++++++++++----------
 1 file changed, 28 insertions(+), 17 deletions(-)

New commits:
commit cea03b42ca0e2cd4d93c01879dec388295b8f771
Author: Damjan Jovanovic <dam...@apache.org>
Date:   Tue Oct 18 17:52:44 2016 +0000

    #i125868# AOO crashes if JRE (Java) is not installed (using help search or 
picture/makros)
    
    ucbhelper::ResultSetHelper methods calling init() can only throw
    RuntimeException, yet Exception or its other subclasses are
    thrown in some cases (eg. with Java disabled, try searching
    the Help index), resulting in unexpected() on at least FreeBSD
    and MacOS that crashes AOO.
    
    Fix this by catching Exception and instead throwing a
    RuntimeException with its message.
    
    Patch by: me

diff --git a/ucbhelper/source/provider/resultsethelper.cxx 
b/ucbhelper/source/provider/resultsethelper.cxx
index 4cde2c4..08cc0b3 100644
--- a/ucbhelper/source/provider/resultsethelper.cxx
+++ b/ucbhelper/source/provider/resultsethelper.cxx
@@ -298,27 +298,38 @@ void ResultSetImplHelper::init( sal_Bool bStatic )
 
     if ( !m_bInitDone )
     {
-        if ( bStatic )
+        try
         {
-            // virtual... derived class fills m_xResultSet1
-            initStatic();
-
-            OSL_ENSURE( m_xResultSet1.is(),
-                        "ResultSetImplHelper::init - No 1st result set!" );
-            m_bStatic = sal_True;
+            if ( bStatic )
+            {
+                // virtual... derived class fills m_xResultSet1
+                initStatic();
+
+                OSL_ENSURE( m_xResultSet1.is(),
+                            "ResultSetImplHelper::init - No 1st result set!" );
+                m_bStatic = sal_True;
+            }
+            else
+            {
+                // virtual... derived class fills m_xResultSet1 and 
m_xResultSet2
+                initDynamic();
+
+                OSL_ENSURE( m_xResultSet1.is(),
+                            "ResultSetImplHelper::init - No 1st result set!" );
+                OSL_ENSURE( m_xResultSet2.is(),
+                            "ResultSetImplHelper::init - No 2nd result set!" );
+                m_bStatic = sal_False;
+            }
+            m_bInitDone = sal_True;
+        }
+        catch ( uno::RuntimeException const &runtimeException )
+        {
+            throw runtimeException;
         }
-        else
+        catch ( uno::Exception const &exception )
         {
-            // virtual... derived class fills m_xResultSet1 and m_xResultSet2
-            initDynamic();
-
-            OSL_ENSURE( m_xResultSet1.is(),
-                        "ResultSetImplHelper::init - No 1st result set!" );
-            OSL_ENSURE( m_xResultSet2.is(),
-                        "ResultSetImplHelper::init - No 2nd result set!" );
-            m_bStatic = sal_False;
+            throw uno::RuntimeException( exception.Message, uno::Reference< 
XInterface >() );
         }
-        m_bInitDone = sal_True;
     }
 }
 
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to