Bug#1053198: libcommons-logging-java fails to build with OpenJDK 21 due to SecurtyManager exception

Vladimir Petko vladimir.petko at canonical.com
Fri Sep 29 08:29:42 BST 2023


Package: libcommons-logging-java
Version: 1.2-3
Severity: important
Tags: ftbfs
X-Debbugs-Cc: vladimir.petko at canonical.com

Dear Maintainer,

Java 21 requires java.security.manager property to be set in order to set
SecurityManager. Otherwise it throws UnsupportedOperationException.

This causes build to fail with the following error:
----
    [junit] java.lang.UnsupportedOperationException: The Security Manager is
deprecated and will be removed in a future release
    [junit]     at
java.base/java.lang.System.setSecurityManager(System.java:429)
    [junit]     at
org.apache.commons.logging.security.SecurityForbiddenTestCase.testContextClassLoader(SecurityForbiddenTestCase.java:153)
    [junit]     at
java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
    [junit]     at
org.apache.commons.logging.PathableTestSuite.runTest(PathableTestSuite.java:141)
----

The attached patch set the property and allows the build to succeed.


-- System Information:
Debian Release: bookworm/sid
  APT prefers lunar-updates
  APT policy: (500, 'lunar-updates'), (500, 'lunar-security'), (500, 'lunar'), (100, 'lunar-backports')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 6.2.0-33-generic (SMP w/32 CPU threads; PREEMPT)
Kernel taint flags: TAINT_PROPRIETARY_MODULE, TAINT_OOT_MODULE, TAINT_UNSIGNED_MODULE
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE=en
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages libcommons-logging-java depends on:
ii  libcommons-parent-java  56-1

libcommons-logging-java recommends no packages.

Versions of packages libcommons-logging-java suggests:
pn  libavalon-framework-java     <none>
pn  libcommons-logging-java-doc  <none>
pn  libexcalibur-logkit-java     <none>
ii  liblog4j1.2-java             1.2.17-11

-- no debconf information
-------------- next part --------------
Description: Allow security manager in unit tests
 Java 21 will print warning/unsupported operation exception if security manager
 is not explicitly allowed.
Forwarded: not-needed
Last-Update: 2023-09-29
---
--- a/build.xml
+++ b/build.xml
@@ -743,7 +743,7 @@
         -->
       <syspropertyset refid="test-lib-props"/>
       <classpath refid="test.classpath"/>
-
+      <jvmarg value="-Djava.security.manager=allow"/>
       <!--
         - Uncomment this to enable logging diagnostics for tests
         - <jvmarg value="-Dorg.apache.commons.logging.diagnostics.dest=STDERR"/>


More information about the pkg-java-maintainers mailing list