Package: libreoffice / 1:6.1.5-3

disableClassPathURLCheck.diff Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
--- a/configure.ac-old	2018-11-12 06:51:15.504128408 +0100
+++ b/configure.ac	2018-11-12 06:52:32.427358015 +0100
@@ -6898,6 +6898,7 @@
 
             # set to limit VM usage for JunitTests
             JAVAIFLAGS=-Xmx64M
+            JAVAIFLAGS="$JAVAIFLAGS -Djdk.net.URLClassPath.disableClassPathURLCheck=true"
             # set to limit VM usage for javac
             JAVAFLAGS=-J-Xmx128M
 
From 905c107cde4a0a7059b1e11b5f23a0a59188cb0c Mon Sep 17 00:00:00 2001
From: Jan-Marek Glogowski <glogow@fbihome.de>
Date: Thu, 6 Dec 2018 13:26:48 +0000
Subject: tdf#121925 test for URLClassPath.ClassPathURLCheck

Adds a configure test to check for the enabled ClassPathURLCheck.
Should be reverted, if our jars pass it.

Change-Id: I040b41f329ccae21b92118fd58270682e50e95c1
Reviewed-on: https://gerrit.libreoffice.org/64709
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
---
 configure.ac | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 52 insertions(+)

diff --git a/configure.ac b/configure.ac
index 4dc6274..97836e1 100644
--- a/configure.ac
+++ b/configure.ac
@@ -7308,6 +7308,58 @@ if test -n "$ENABLE_JAVA" -a -z "$JAVAINC"; then
 fi
 SOLARINC="$SOLARINC $JAVAINC"
 
+if test "$ENABLE_JAVA" != "" -a "x" != "x$JAVACOMPILER"; then
+    url_check_unknown=0
+    java_base="testurlcheck"
+    java_src="${java_base}.java"
+    java_cls="${java_base}.class"
+    cat > "${java_src}" <<_ACEOF
+[import jdk.internal.loader.URLClassPath;
+import java.lang.reflect.Field;
+import java.net.URL;
+
+class ${java_base}
+{
+    public static void main(String args[])
+    {
+        try {
+            URLClassPath cp = new URLClassPath(new URL[0], null);
+            Field field = cp.getClass().getDeclaredField("DISABLE_CP_URL_CHECK");
+            field.setAccessible(true);
+            System.out.println(field.get(cp).toString());
+        } catch(Exception e) {
+            System.out.println("unknown");
+        }
+    }
+}]
+_ACEOF
+    AC_MSG_CHECKING([if jdk.net.URLClassPath.ClassPathURLCheck is disabled])
+    java_cmd="$JAVACOMPILER --add-exports java.base/jdk.internal.loader=ALL-UNNAMED ${java_src} 1>&2"
+    AC_TRY_EVAL(java_cmd)
+    if test $? = 0 -a -f "./${java_cls}"; then
+        java_res=`$JAVAINTERPRETER --add-opens java.base/jdk.internal.loader=ALL-UNNAMED ${java_base} 2>/dev/null`
+        if test $? = 0; then
+            case "${java_res}" in
+            true) AC_MSG_RESULT([yes]) ;;
+            false)
+                rm -f "./${java_src}" "./${java_cls}"
+                AC_MSG_ERROR([no - Java unit tests will break!])
+                ;;
+            *) url_check_unknown=1 ;;
+            esac
+        else
+            url_check_unknown=1
+        fi
+    else
+        url_check_unknown=1
+    fi
+    if test $url_check_unknown -eq 1; then
+        AC_MSG_RESULT([unknown - assuming yes])
+        add_warning "Unable to find the default value for jdk.net.URLClassPath.ClassPathURLCheck - java tests might fail!"
+    fi
+    rm -f "./${java_src}" "./${java_cls}"
+fi
+
 AC_SUBST(JAVACOMPILER)
 AC_SUBST(JAVADOC)
 AC_SUBST(JAVAINTERPRETER)
-- 
cgit v1.1