Bug 121925 - Fix Java Jar dependency classpath to pass the ClassPathURLCheck
Summary: Fix Java Jar dependency classpath to pass the ClassPathURLCheck
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: sdk (show other bugs)
Version:
(earliest affected)
Inherited From OOo
Hardware: All All
: medium enhancement
Assignee: Not Assigned
URL:
Whiteboard: target:6.3.0 target:6.2.0.1
Keywords:
Depends on:
Blocks:
 
Reported: 2018-12-05 15:14 UTC by Jan-Marek Glogowski
Modified: 2019-06-12 13:08 UTC (History)
5 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jan-Marek Glogowski 2018-12-05 15:14:05 UTC
When OpenJDK tried to enforce stricter class path URL checks without previous announcement, things started to break left and right. This included failing LibreOffice JUnitTest checks, since the dependency classpath in our generated Jars doesn't pass the stricter URL checks and therefore is ignored.

The check was disabled later in http://hg.openjdk.java.net/jdk-updates/jdk11u/rev/8513ac27b651, but I still think it's worthwhile to fix our Jars and then disable jdk.net.URLClassPath.disableClassPathURLCheck when running the tests.

More info is also in https://gerrit.libreoffice.org/#/c/63118/2
Comment 1 Stephan Bergmann 2018-12-06 10:08:16 UTC
quoting my 2018-11-12 10:34 comment at <https://gerrit.libreoffice.org/#/c/63118> "Simplify and fix Java UNO API test makefiles":

"With Java moving away from supporting absolute file URLs in jar manifest Class-Paths, we need a new solution for what we currently do with gb_Jar_add_manifest_classpath/gb_Helper_make_url.  We use that in unotest/Jar_test.mk (which is the subject of this change), but also in gb_Jar_use_system_jar as used in various places in RepositoryExternal.mk.  (Note how we already have issues with file URLs in all of these places with recent Java on Windows, see <https://lists.freedesktop.org/archives/libreoffice/2018-September/080884.html> 'Re: make check fails in [build JCS]'.)

"However, from <https://docs.oracle.com/cd/E15289_01/JRRLN/newchanged.htm#GUID-CDE1F31D-EDEA-4FBF-B8CB-F555D09C084C> and the details of <http://hg.openjdk.java.net/jdk-updates/jdk11u/rev/1c1392d7c546> '8195874: Improve jar specification adherence', it looks like support for relative paths starting with '..' in jar manifest Class-Paths is also going away.  We currently use such at least in bridges/Jar_java_uno.mk, connectivity/Jar_sdbc_hsqldb.mk, and javaunohelper/Jar_juh.mk."
Comment 2 Jan-Marek Glogowski 2018-12-06 10:40:57 UTC
From reading the current URLClassPath.java code, it seem you can set "jdk.net.URLClassPath.disableClassPathURLCheck" to "debug", and the loader will print the ignored class path entries, which can help debugging.

But it doesn't look like there is a way to get the default value, which could be checked by configure or even our jars to want people of failures.
Comment 3 Commit Notification 2018-12-11 15:12:38 UTC
Jan-Marek Glogowski committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/+/905c107cde4a0a7059b1e11b5f23a0a59188cb0c%5E%21

tdf#121925 test for URLClassPath.ClassPathURLCheck

It will be available in 6.3.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 4 Commit Notification 2018-12-11 21:09:04 UTC
Jan-Marek Glogowski committed a patch related to this issue.
It has been pushed to "libreoffice-6-2":

https://git.libreoffice.org/core/+/c9de94c65b8ab8bf6073400eda5ba848ba22af47%5E%21

tdf#121925 test for URLClassPath.ClassPathURLCheck

It will be available in 6.2.0.1.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 5 Jan-Marek Glogowski 2018-12-11 21:12:37 UTC
These patches are no fixes, but will detect the failing JDK setup during configure as an early warning! They should be reverted after a real fix is merged.
Comment 6 Andreas Säger 2019-04-26 12:15:27 UTC
I don't understand the details of this issue. Is this the reason why https://adoptopenjdk.net is not recognized as a valid JDK?
Is it true that someone works on it?
No need to file another issue?
Comment 7 Stephan Bergmann 2019-04-26 12:22:05 UTC
(In reply to Andreas Säger from comment #6)
> Is this the reason why
> https://adoptopenjdk.net is not recognized as a valid JDK?

That should work with <https://gerrit.libreoffice.org/#/c/66634/> "Support AdoptOpenJDK" (and its backports to the various release branches, see there).  (And if you have further issues with that specific JDK, please file a new issue.  It is most likely completely unrelated to this issue.)
Comment 8 Alex Thurgood 2019-06-12 08:40:07 UTC
Would this bug also affect use of Oracle OpenJDK 12 when trying to call an external hsqldb.jar, e.g. when a user has what is known as a split database (no embedded hsqldb) ? If so, then it would be a regression for those users.
Comment 9 Stephan Bergmann 2019-06-12 08:48:08 UTC
(In reply to Alex Thurgood from comment #8)
> Would this bug also affect use of Oracle OpenJDK 12 when trying to call an
> external hsqldb.jar, e.g. when a user has what is known as a split database
> (no embedded hsqldb) ? If so, then it would be a regression for those users.

Hard to tell without further information about such failures.  If there is a bug about that, please give a link to it here, so we can discuss that issue there instead of speculating here.
Comment 10 Alex Thurgood 2019-06-12 13:08:29 UTC
(In reply to Stephan Bergmann from comment #9)

> Hard to tell without further information about such failures.  If there is a
> bug about that, please give a link to it here, so we can discuss that issue
> there instead of speculating here.

Opened bug 125882 with regard to embedded hsqldb ODB files.