[Libreoffice-commits] core.git: bean/com jurt/com

Stephan Bergmann sbergman at redhat.com
Thu Feb 13 23:23:05 CET 2014


 bean/com/sun/star/beans/LocalOfficeConnection.java  |    9 +++++++++
 jurt/com/sun/star/lib/util/NativeLibraryLoader.java |   11 ++++++++++-
 2 files changed, 19 insertions(+), 1 deletion(-)

New commits:
commit 0d396800021684a8c0875e45ed1440011fd7f9b0
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Thu Feb 13 23:20:28 2014 +0100

    More java.lang.System.mapLibraryName dylib vs. jnilib confusion
    
    ...like a76261ac9e40eb57e942db2c7aea8b8a5e904ff2
    
    Change-Id: I803dc81344efb5e8021d9ef4146c06ecf82ca63b

diff --git a/bean/com/sun/star/beans/LocalOfficeConnection.java b/bean/com/sun/star/beans/LocalOfficeConnection.java
index dd2ed07..d8e7b3b 100644
--- a/bean/com/sun/star/beans/LocalOfficeConnection.java
+++ b/bean/com/sun/star/beans/LocalOfficeConnection.java
@@ -78,6 +78,15 @@ public class LocalOfficeConnection
         // load libofficebean.so/officebean.dll
         String aSharedLibName = getProgramPath() + java.io.File.separator +
             System.mapLibraryName(OFFICE_LIB_NAME);
+        // At least Oracle's 1.7.0_51 now maps to .dylib rather than .jnilib:
+        if (System.getProperty("os.name").startsWith("Mac")
+            && aSharedLibName.endsWith(".dylib"))
+        {
+            aSharedLibName
+                = aSharedLibName.substring(
+                    0, aSharedLibName.length() - "dylib".length())
+                + "jnilib";
+        }
         System.load( aSharedLibName );
     }
 
diff --git a/jurt/com/sun/star/lib/util/NativeLibraryLoader.java b/jurt/com/sun/star/lib/util/NativeLibraryLoader.java
index 9a98cfc..749dcb1 100644
--- a/jurt/com/sun/star/lib/util/NativeLibraryLoader.java
+++ b/jurt/com/sun/star/lib/util/NativeLibraryLoader.java
@@ -43,7 +43,16 @@ public final class NativeLibraryLoader {
         library name is system dependent
      */
     public static void loadLibrary(ClassLoader loader, String libname) {
-        File path = getResource(loader, System.mapLibraryName(libname));
+        String sysname = System.mapLibraryName(libname);
+        // At least Oracle's 1.7.0_51 now maps to .dylib rather than .jnilib:
+        if (System.getProperty("os.name").startsWith("Mac")
+            && sysname.endsWith(".dylib"))
+        {
+            sysname
+                = sysname.substring(0, sysname.length() - "dylib".length())
+                + "jnilib";
+        }
+        File path = getResource(loader, sysname);
         if (path == null) {
             // If the library cannot be found as a class loader resource, try
             // the global System.loadLibrary as a last resort:


More information about the Libreoffice-commits mailing list