The attached patch starts to get it working. It should detect Java >= 8u222
but will wrongly label it "Oracle Corporation", as I haven't dug into the
main/jvmfwk/plugins/sunmajor/pluginlib/vendorbase.cxx file yet, which does
another vendor search.

Please test it on Java 11 if you can, as the java.vendor property change
may be the problem there as well. After all, the patch to 8u222 was just a
backport from some future Java version, so it definitely isn't the only
version this patch fixes.

I also wonder if the entire framework for detecting Java needs to be
rethought, given how much the Java ecosystem has changed since the Kaffe /
GCJ / GNU Classpath days.

Regards
Damjan



On Sun, Aug 18, 2019 at 11:29 AM Mechtilde <o...@mechtilde.de> wrote:

> Hello Damjan,
>
> I figured it out under Debian >= 9 with Java 8u222.
>
> We need also a solution to detect java 11 which is used in Debian 10
> (buster, stable)
>
> Am 18.08.19 um 10:45 schrieb Matthias Seidel:
> > Hi Damjan,
> >
> > Thank you for looking into it!
> >
> > Indeed it was Ubuntu 16.04 where I could replicate the problem with
> > OpenJDK8u222.
> >
> > Am 18.08.19 um 03:06 schrieb Damjan Jovanovic:
> >> Before:
> >> java.vendor=Oracle Corporation
> >>
> >> After:
> >> java.vendor=Private Build
> >>
> >> This is apparently something Java now allows configuring when it's
> built:
> >> https://bugs.openjdk.java.net/browse/JDK-8221171
> >> http://hg.openjdk.java.net/jdk8u/jdk8u/rev/e0b7721459ee
> >>
> >> We probably need to relax the vendor checks, as we'll soon be flooded by
> >> different java.vendor properties on different platforms, as different
> >> package repositories begin setting their own...
> >
> > Definitely!
> >
> > I have this changelog for Ubuntu:
> >
> >
> https://launchpadlibrarian.net/435284148/openjdk-8_8u212-b03-0ubuntu1.19.04.2_8u222-b10-1ubuntu1~19.04.1.diff.gz
> >
> > Searching for --with-vendor-name gives several results.
> >
> > Regards,
> >
> >    Matthias
> >
> >>
> >> On Sun, Aug 18, 2019 at 2:39 AM Damjan Jovanovic <dam...@apache.org>
> wrote:
> >>
> >>> Found 8u222 on Ubuntu 16.04, testing...
> >>>
> >>> On Sun, Aug 18, 2019 at 2:32 AM Damjan Jovanovic <dam...@apache.org>
> >>> wrote:
> >>>
> >>>> 8.202.8 and 8.212.4.1 work for me on FreeBSD.
> >>>>
> >>>> Let me see if I can find 8u222 somewhere.
> >>>>
> >>>> On Sat, Aug 17, 2019 at 6:23 PM Matthias Seidel <
> >>>> matthias.sei...@hamburg.de> wrote:
> >>>>
> >>>>> Hi all,
> >>>>>
> >>>>> If nobody can confirm this it must be an error on every installation
> >>>>> that I run...
> >>>>>
> >>>>> Otherwise it would be a release blocker for 4.1.7!
> >>>>>
> >>>>> Regards,
> >>>>>
> >>>>>    Matthias
> >>>>>
> >>>>>
> >>>>> Am 14.08.19 um 16:37 schrieb Matthias Seidel:
> >>>>>> Hi Damjan,
> >>>>>>
> >>>>>> Am 14.08.19 um 07:02 schrieb Damjan Jovanovic:
> >>>>>>> Hi
> >>>>>>>
> >>>>>>> What does "java --version" give?
> >>>>>> openjdk version "1.8.0_222"
> >>>>>> OpenJDK Runtime Environment (build
> >>>>> 1.8.0_222-8u222-b10-1ubuntu1~16.04.1-b10)
> >>>>>> OpenJDK 64-Bit Server VM (build 25.222-b10, mixed mode)
> >>>>>>
> >>>>>>> You might need to backport the following commit to 4.1.x:
> >>>>>>>
> >>>>>>> commit 3bd2d6aed629c4323ea9e8426acfb793eb9046fd
> >>>>>>> Author: Damjan Jovanovic <dam...@apache.org>
> >>>>>>> Date:   Sun Apr 15 15:00:46 2018 +0000
> >>>>>>>
> >>>>>>>     Allow the Java version suffix (eg. the 162 in 1.8.0_162) to be
> >>>>>>>     3 digits long.
> >>>>>>>
> >>>>>>>     Patch by: me
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>     git-svn-id:
> >>>>> https://svn.apache.org/repos/asf/openoffice/trunk@1829211
> >>>>>>> 13f79535-47bb-0310-9956-ffa450edef68
> >>>>>> Just to clarify:
> >>>>>>
> >>>>>> This also happens with AOO 4.2.0 (I installed Jims last build from
> July
> >>>>>> on Xubuntu).
> >>>>>> I really think that there was a change in the Java update 8u222.
> >>>>>>
> >>>>>> Regards,
> >>>>>>
> >>>>>>    Matthias
> >>>>>>
> >>>>>>> On Tue, Aug 13, 2019 at 11:19 PM Matthias Seidel <
> >>>>> matthias.sei...@hamburg.de>
> >>>>>>> wrote:
> >>>>>>>
> >>>>>>>> Hi all,
> >>>>>>>>
> >>>>>>>> Today I noticed that on my Ubuntu machine OpenJDK 8u222 isn't
> listed
> >>>>> in
> >>>>>>>> AOO (4.1.6) anymore.
> >>>>>>>> But everything works, it seems to be detected and to be used,
> that is
> >>>>>>>> why I didn't notice it earlier.
> >>>>>>>>
> >>>>>>>> I do remember that I got the update from Java 8u212 to Java 8u222
> >>>>> some
> >>>>>>>> time ago.
> >>>>>>>>
> >>>>>>>> In my test VM with Ubuntu (32-bit) which has still Java 8u212
> >>>>> installed
> >>>>>>>> it is visible in AOO.
> >>>>>>>>
> >>>>>>>> Can anyone confirm this?
> >>>>>>>>
> >>>>>>>> Regards,
> >>>>>>>>
> >>>>>>>>    Matthias
> >>>>>>>>
> >>>>>>>>
> >>>>>>>>
> >>>>>
> >
>
> --
> Mechtilde Stehmann
> ## Apache OpenOffice
> ## Freie Office Suite für Linux, MacOSX, Windows
> ## Debian Developer
> ## PGP encryption welcome
> ## F0E3 7F3D C87A 4998 2899  39E7 F287 7BBA 141A AD7F
>
>
diff --git a/main/jvmfwk/plugins/sunmajor/pluginlib/util.cxx b/main/jvmfwk/plugins/sunmajor/pluginlib/util.cxx
index ad28ae0fa9..0a82aa3289 100644
--- a/main/jvmfwk/plugins/sunmajor/pluginlib/util.cxx
+++ b/main/jvmfwk/plugins/sunmajor/pluginlib/util.cxx
@@ -1000,6 +1000,7 @@ rtl::Reference<VendorBase> getJREInfoByPath(
         if (sVendor.equals(i->first))
         {
             sVendorName = i->second;
+printf("%d with vendorname %s\n", __LINE__, ::rtl::OUStringToOString (sVendorName, RTL_TEXTENCODING_UTF8).pData->buffer);
             break;
         }
     }
@@ -1014,10 +1015,34 @@ rtl::Reference<VendorBase> getJREInfoByPath(
                               RTL_TEXTENCODING_ASCII_US);
             if (sNameMap.equals(sVendorName))
             {
+printf("creating line %d vendor %s\n", __LINE__, ::rtl::OUStringToOString (sVendorName, RTL_TEXTENCODING_UTF8).pData->buffer);
                 ret = createInstance(gVendorMap[c].createFunc, props);
+printf("ret.is() = %d\n", ret.is());
                 break;
             }
         }
+        if ( !ret.is() )
+        {
+            // As of Java 8u222 the vendor name can be anything, so try the most probable one
+            OUString genericVendorName(RTL_CONSTASCII_USTRINGPARAM("Oracle Corporation"));
+            for ( sal_Int32 c = 0;
+                  gVendorMap[c].sVendorName != NULL; ++c )
+            {
+                OUString sNameMap(gVendorMap[c].sVendorName, strlen(gVendorMap[c].sVendorName),
+                                  RTL_TEXTENCODING_ASCII_US);
+                if (sNameMap.equals(genericVendorName))
+                {
+printf("creating generic vendor instead of %s\n", ::rtl::OUStringToOString (sVendorName, RTL_TEXTENCODING_UTF8).pData->buffer);
+for (vector<pair<OUString, OUString> >::iterator i = props.begin(); i != props.end(); i++)
+{
+  if (sVendor.equals(i->first))
+    i->second = genericVendorName;
+}
+                    ret = createInstance(gVendorMap[c].createFunc, props);
+                    break;
+                }
+            }
+        }
     }    
     if (ret.is() == false)
         vecBadPaths.push_back(sFilePath);
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@openoffice.apache.org
For additional commands, e-mail: dev-h...@openoffice.apache.org

Reply via email to