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>
This commit is contained in:
committed by
Stephan Bergmann
parent
b143717032
commit
905c107cde
52
configure.ac
52
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)
|
||||
|
Reference in New Issue
Block a user