[Libreoffice-commits] core.git: jvmfwk/plugins

Stephan Bergmann (via logerrit) logerrit at kemper.freedesktop.org
Tue Sep 22 19:44:37 UTC 2020


 jvmfwk/plugins/sunmajor/pluginlib/util_cocoa.mm |   38 ++++--------------------
 1 file changed, 7 insertions(+), 31 deletions(-)

New commits:
commit 7db048f62929a9d267b63db3a6ea2b58b47ec757
Author:     Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Tue Sep 22 20:41:49 2020 +0200
Commit:     Stephan Bergmann <sbergman at redhat.com>
CommitDate: Tue Sep 22 21:43:56 2020 +0200

    Manually select JDK outside /Library/Java/JavaVirtualMachines on macOS
    
    32bc8ddbf335dd26019edcf12758643b4cff9913 "tdf#94716 allow Oracle's JDK to be
    used on OS X 10.10 and 10.11" had restricted both addJavaInfosDirScan
    (jvmfwk/plugins/sunmajor/pluginlib/util.cxx, relevant when LO scans for
    available Java runtimes) and JvmfwkUtil_isLoadableJVM (which is more central and
    also relevant when manually adding a Java installation on the Advanced options
    page) to JDK installations under /Library/Java/JavaVirtualMachines.
    
    Recent versions of OpenJDK for macOS are provided as *.tar.gz files (e.g.,
    <https://download.java.net/java/GA/jdk15/779bf45e88a44cbd9ea6621d33e33db1/36/GPL
    /openjdk-15_osx-x64_bin.tar.gz> avaiable at <http://jdk.java.net/15/>) that can
    potentially be installed anywhere, so it looks useful to remove the
    /Library/Java/JavaVirtualMachines restriction from JvmfwkUtil_isLoadableJVM.
    
    I'm not sure whether that would have any nagative impact, esp. for any scenario
    that would still be relevant today.  When I unpacked the above
    openjdk-15_osx-x64_bin.tar.gz to ~/OpenJDK/ on my macOS 10.15.6, and manually
    added /Users/stephan/OpenJDK/jdk-15.jdk/Contents/Home on the Advanced options
    page, everything appeared to work fine.
    
    Change-Id: I15545cc786a4a423f3bfe22ba477a45d6ef7fdf1
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103212
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <sbergman at redhat.com>

diff --git a/jvmfwk/plugins/sunmajor/pluginlib/util_cocoa.mm b/jvmfwk/plugins/sunmajor/pluginlib/util_cocoa.mm
index 136518253cde..8c745f8d98db 100644
--- a/jvmfwk/plugins/sunmajor/pluginlib/util_cocoa.mm
+++ b/jvmfwk/plugins/sunmajor/pluginlib/util_cocoa.mm
@@ -21,40 +21,16 @@ bool JvmfwkUtil_isLoadableJVM( OUString const & aURL )
         NSString *pString = [NSString stringWithCharacters:reinterpret_cast<unichar const *>(aURL.getStr()) length:aURL.getLength()];
         if ( pString )
         {
-            NSURL *pURL = nil;
-
             // Ignore all but Oracle's JDK as loading Apple's Java and Oracle's
             // JRE will cause macOS's JavaVM framework to display a dialog and
             // invoke exit() when loaded via JNI on macOS 10.10
-            NSURL *pTmpURL = [NSURL URLWithString:pString];
-            if ( pTmpURL )
-                pTmpURL = [pTmpURL filePathURL];
-            if ( pTmpURL )
-                pTmpURL = [pTmpURL URLByStandardizingPath];
-            if ( pTmpURL )
-                pTmpURL = [pTmpURL URLByResolvingSymlinksInPath];
-            if ( pTmpURL )
-            {
-                NSURL *pJVMsDirURL = [NSURL URLWithString:@"file:///Library/Java/JavaVirtualMachines/"];
-                if ( pJVMsDirURL )
-                    pJVMsDirURL= [pJVMsDirURL filePathURL];
-                if ( pJVMsDirURL )
-                    pJVMsDirURL = [pJVMsDirURL URLByStandardizingPath];
-                // The JVM directory must not contain softlinks or the JavaVM
-                // framework bug will occur so don't resolve softlinks in the
-                // JVM directory
-                if ( pJVMsDirURL )
-                {
-                    NSString *pTmpURLString = [pTmpURL absoluteString];
-                    NSString *pJVMsDirURLString = [pJVMsDirURL absoluteString];
-                    if ( pTmpURLString && pJVMsDirURLString && [pJVMsDirURLString length] )
-                    {
-                        NSRange aJVMsDirURLRange = [pTmpURLString rangeOfString:pJVMsDirURLString];
-                        if ( !aJVMsDirURLRange.location && aJVMsDirURLRange.length )
-                            pURL = pTmpURL;
-                    }
-                }
-            }
+            NSURL *pURL = [NSURL URLWithString:pString];
+            if ( pURL )
+                pURL = [pURL filePathURL];
+            if ( pURL )
+                pURL = [pURL URLByStandardizingPath];
+            if ( pURL )
+                pURL = [pURL URLByResolvingSymlinksInPath];
 
             while ( pURL )
             {


More information about the Libreoffice-commits mailing list