tdf#100501: Adapt to Java 9 (at least on Linux x86-64)
authorStephan Bergmann <sbergman@redhat.com>
Mon, 28 Aug 2017 13:35:43 +0000 (15:35 +0200)
committerRene Engelhard <rene@debian.org>
Tue, 29 Aug 2017 16:39:44 +0000 (17:39 +0100)
Checking with both jdk-9+181_linux-x64_bin.tar.gz and
jre-9+181_linux-x64_bin.tar.gz as currently available at
<http://jdk.java.net/9/> "JDK 9 Early-Access Builds":

For one, make SunVersion::init understand <http://openjdk.java.net/jeps/223>
"JEP 223: New Version-String Scheme" at least insofar as to accept strings like
"9" with less than three dot-separated segments (where the missing segments are
treated like "0").

For another, at least for Linux x86-64, libjvm.so is now apparently located in a
path without an "amd64" architecture segment, "lib/server/libjvm.so".  (But
could that also be "client"?)  Other platforms may need further adjustments.

Change-Id: Idcebc833472c81a1dc74dcdd481b0a37274a8713

Gbp-Pq: Name java9.diff

jvmfwk/plugins/sunmajor/pluginlib/sunjre.cxx
jvmfwk/plugins/sunmajor/pluginlib/sunversion.cxx

index 7f7c4943c8be4fab4d982b0b33314a116cf534cc..7543f497eb83dbbc1adaf39d31fd256d79a4413d 100644 (file)
@@ -68,7 +68,8 @@ char const* const* SunInfo::getRuntimePaths(int * size)
         "/lib/" JFW_PLUGIN_ARCH "/client/libjvm.so",
         "/lib/" JFW_PLUGIN_ARCH "/server/libjvm.so",
         "/lib/" JFW_PLUGIN_ARCH "/classic/libjvm.so",
-        "/lib/" JFW_PLUGIN_ARCH "/jrockit/libjvm.so"
+        "/lib/" JFW_PLUGIN_ARCH "/jrockit/libjvm.so",
+        "/lib/server/libjvm.so"
 #endif
     };
     *size = SAL_N_ELEMENTS(ar);
index 85f31a383fc61916292c88cd63e56eebf7d75a22..fb4227da1964d3e21536884f3cb0a5e16f75e456 100644 (file)
@@ -88,7 +88,7 @@ bool SunVersion::init(const char *szVersion)
             ! (nPartPos == 0) // prevents: ".4.1", "..1", part must start with digit
             && (
                 //separators after maintenance (1.4.1_01, 1.4.1-beta, or 1.4.1)
-                ((pCur == pEnd || *pCur == '_' || *pCur == '-') && (nPart == 2 ))
+                (pCur == pEnd || *pCur == '_' || *pCur == '-')
                 ||
                 //separators between major-minor and minor-maintenance
                 (nPart < 2 && *pCur == '.') )
@@ -97,6 +97,8 @@ bool SunVersion::init(const char *szVersion)
                 pCur + 1 != pEnd
                 || rtl::isAsciiDigit(static_cast<unsigned char>(*pCur))) )
         {
+            bool afterMaint = pCur == pEnd || *pCur == '_' || *pCur == '-';
+
             int len = pCur - pLast;
             if (len >= 127)
                 return false;
@@ -107,6 +109,9 @@ bool SunVersion::init(const char *szVersion)
             pLast = pCur;
 
             m_arVersionParts[nPart] = atoi(buf);
+
+            if (afterMaint)
+                nPart = 2;
             nPart ++;
             nPartPos = 0;
             if (nPart == 3)