[Libreoffice-commits] .: 2 commits - connectivity/source hsqldb/patches

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Mon Sep 24 00:53:18 PDT 2012


 connectivity/source/drivers/jdbc/Object.cxx     |    3 +++
 connectivity/source/drivers/jdbc/Throwable.cxx  |    8 +++++++-
 connectivity/source/inc/java/lang/Throwable.hxx |    4 ++++
 hsqldb/patches/jdbc-4.1.patch                   |   14 ++++++++++----
 4 files changed, 24 insertions(+), 5 deletions(-)

New commits:
commit c67fedbd56623078b6e48b0dd3c015c4b9f8b685
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Mon Sep 24 09:50:57 2012 +0200

    To ease debugging, display printStackTrace of caught exceptions in jdbc driver
    
    Change-Id: I8c48b09fcab18af196a8441351bcf3180a32005b

diff --git a/connectivity/source/drivers/jdbc/Object.cxx b/connectivity/source/drivers/jdbc/Object.cxx
index 825a8fa..4d0bdc9 100644
--- a/connectivity/source/drivers/jdbc/Object.cxx
+++ b/connectivity/source/drivers/jdbc/Object.cxx
@@ -180,6 +180,9 @@ namespace
         else if ( _pEnvironment->IsInstanceOf( jThrow, java_lang_Throwable::st_getMyClass() ) )
         {
             ::std::auto_ptr< java_lang_Throwable > pThrow( new java_lang_Throwable( _pEnvironment, jThrow ) );
+#if OSL_DEBUG_LEVEL > 0
+            pThrow->printStackTrace();
+#endif
             ::rtl::OUString sMessage = pThrow->getMessage();
             if ( sMessage.isEmpty() )
                 sMessage = pThrow->getLocalizedMessage();
diff --git a/connectivity/source/drivers/jdbc/Throwable.cxx b/connectivity/source/drivers/jdbc/Throwable.cxx
index b31cf57..e943aec 100644
--- a/connectivity/source/drivers/jdbc/Throwable.cxx
+++ b/connectivity/source/drivers/jdbc/Throwable.cxx
@@ -54,7 +54,13 @@ jclass java_lang_Throwable::st_getMyClass()
     static jmethodID mID(NULL);
     return callStringMethod("getLocalizedMessage",mID);
 }
-// -----------------------------------------------------------------------------
 
+#if OSL_DEBUG_LEVEL > 0
+void java_lang_Throwable::printStackTrace() const
+{
+    static jmethodID mID(NULL);
+    return callVoidMethod("printStackTrace",mID);
+}
+#endif
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/java/lang/Throwable.hxx b/connectivity/source/inc/java/lang/Throwable.hxx
index e0e9085..071695f 100644
--- a/connectivity/source/inc/java/lang/Throwable.hxx
+++ b/connectivity/source/inc/java/lang/Throwable.hxx
@@ -39,6 +39,10 @@ namespace connectivity
         ::rtl::OUString getMessage() const;
         ::rtl::OUString getLocalizedMessage() const;
 
+#if OSL_DEBUG_LEVEL > 0
+        void printStackTrace() const;
+#endif
+
         static jclass st_getMyClass();
     };
 }
commit 93a0d9eee0f4dced348b040961f44f977e9504a7
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Mon Sep 24 09:35:56 2012 +0200

    rhbz#836827: SQLFeatureNotSupportedException only in Java 6
    
    ...so if the patched hsqldb.jar is compiled with Java 7, it creates instances of
    SQLFeatureNotSupportedException, and when at LO runtime a Java 5 gcj is used,
    loading the relevant hsqldb.jar classes will fail with a NoClassDefFoundError
    caused by a ClassNotFoundException.
    
    Adding java.sql.Driver.getParentLogger in Java 7 was an incompatible change, but
    it appears that the java.sql framework is prepared to handle old implementations
    (for which the JVM will throw AbstractMethodError), so it appears that it works
    to fake that AbstractMethodError here.
    
    Change-Id: Id1fddc9cbdd8c88cd68fb5877ec59fe8d61e1562

diff --git a/hsqldb/patches/jdbc-4.1.patch b/hsqldb/patches/jdbc-4.1.patch
index 4c4eb85..68180a2 100644
--- a/hsqldb/patches/jdbc-4.1.patch
+++ b/hsqldb/patches/jdbc-4.1.patch
@@ -231,7 +231,7 @@
  // boucherb at users 20040411 - doc 1.7.2 - javadoc updates toward 1.7.2 final
  
  /**
-@@ -323,4 +328,12 @@
+@@ -323,4 +328,15 @@
      }
  
  //#endif JAVA6
@@ -239,7 +239,10 @@
 +//#ifdef JAVA7
 +    public Logger getParentLogger() throws SQLFeatureNotSupportedException
 +    {
-+        throw new SQLFeatureNotSupportedException("Not supported yet.");
++        throw new AbstractMethodError(
++            "org.hsqldb.jdbc.jdbcDataSource.getParentLogger should throw" +
++            " SQLFeatureNotSupportedException, but that is not yet available" +
++            " in Java 5");
 +    }
 +
 +//#endif JAVA7
@@ -299,7 +302,7 @@
  // fredt at users 20011220 - patch 1.7.0 by fredt
  // new version numbering scheme
  // fredt at users 20020320 - patch 1.7.0 - JDBC 2 support and error trapping
-@@ -321,4 +326,12 @@
+@@ -321,4 +326,15 @@
              DriverManager.registerDriver(new jdbcDriver());
          } catch (Exception e) {}
      }
@@ -307,7 +310,10 @@
 +//#ifdef JAVA7
 +    public Logger getParentLogger() throws SQLFeatureNotSupportedException
 +    {
-+        throw new SQLFeatureNotSupportedException("Not supported yet.");
++        throw new AbstractMethodError(
++            "org.hsqldb.jdbcDriver.getParentLogger should throw" +
++            " SQLFeatureNotSupportedException, but that is not yet available" +
++            " in Java 5");
 +    }
 +
 +//#endif JAVA7


More information about the Libreoffice-commits mailing list