[Git][java-team/exec-maven-plugin][master] 3 commits: debian/patches/cope_with_thread_stop_being_unavailable_in_jdk20.patch:...
Tony Mancill (@tmancill)
gitlab at salsa.debian.org
Wed Jan 17 17:21:54 GMT 2024
Tony Mancill pushed to branch master at Debian Java Maintainers / exec-maven-plugin
Commits:
84174c26 by Vladimir Petko at 2024-01-17T17:18:44+13:00
debian/patches/cope_with_thread_stop_being_unavailable_in_jdk20.patch: cherry-pick upstream patch to resolve the test failure (Closes: #1057499).
- - - - -
d38dbb05 by Vladimir Petko at 2024-01-17T17:19:37+13:00
changelog
- - - - -
ff8f745b by Tony Mancill at 2024-01-17T17:21:49+00:00
Merge branch 'master' into 'master'
Resolve Java 21 FTBFS
See merge request java-team/exec-maven-plugin!2
- - - - -
3 changed files:
- debian/changelog
- + debian/patches/cope_with_thread_stop_being_unavailable_in_jdk20.patch
- debian/patches/series
Changes:
=====================================
debian/changelog
=====================================
@@ -1,3 +1,10 @@
+exec-maven-plugin (3.1.0-2) UNRELEASED; urgency=medium
+
+ * d/p/cope_with_thread_stop_being_unavailable_in_jdk20.patch: cherry-
+ pick upstream patch to resolve the test failure (Closes: #1057499).
+
+ -- Vladimir Petko <vladimir.petko at canonical.com> Wed, 17 Jan 2024 17:18:59 +1300
+
exec-maven-plugin (3.1.0-1) unstable; urgency=medium
* Team upload.
=====================================
debian/patches/cope_with_thread_stop_being_unavailable_in_jdk20.patch
=====================================
@@ -0,0 +1,135 @@
+Description: Cope with Thread::stop being unavailable in JDK 20+
+
+ In JDK 20+, the long deprecated Thread.stop() (since JDK 1.2) has been
+ removed and will throw an UnsupportedOperationException. This will be
+ handled gracefully when using option 'stopUnresponsiveDaemonThreads',
+ yielding a log warning "Thread.stop() is unavailable in this JRE
+ version, cannot force-stop any threads" once and not trying to stop any
+ further threads during the same execution.
+
+Author: Alexander Kriegisch <Alexander at Kriegisch.name>
+Origin: upstream, https://github.com/mojohaus/exec-maven-plugin/commit/6fae009079da7825154ce0e1a51c10a9abf16e90
+Bug: https://github.com/mojohaus/exec-maven-plugin/issues/391
+Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1057499
+Forwarded: not-needed
+Applied-Upstream: 6fae009079da7825154ce0e1a51c10a9abf16e90
+commit 6fae009079da7825154ce0e1a51c10a9abf16e90
+Author: Alexander Kriegisch <Alexander at Kriegisch.name>
+Date: Sat Nov 11 10:19:59 2023 +0100
+--- a/src/main/java/org/codehaus/mojo/exec/ExecJavaMojo.java
++++ b/src/main/java/org/codehaus/mojo/exec/ExecJavaMojo.java
+@@ -43,6 +43,10 @@
+ public class ExecJavaMojo
+ extends AbstractExecMojo
+ {
++ // Implementation note: Constants can be included in javadocs by {@value #MY_CONST}
++ private static final String THREAD_STOP_UNAVAILABLE =
++ "Thread.stop() is unavailable in this JRE version, cannot force-stop any threads";
++
+ @Component
+ private RepositorySystem repositorySystem;
+
+@@ -168,6 +172,10 @@
+ * this to <code>true</code> if you are invoking problematic code that you can't fix. An example is
+ * {@link java.util.Timer} which doesn't respond to interruption. To have <code>Timer</code> fixed, vote for
+ * <a href="http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6336543">this bug</a>.
++ * <p>
++ * <b>Note:</b> In JDK 20+, the long deprecated {@link Thread#stop()} (since JDK 1.2) has been removed and will
++ * throw an {@link UnsupportedOperationException}. This will be handled gracefully, yielding a log warning
++ * {@value #THREAD_STOP_UNAVAILABLE} once and not trying to stop any further threads during the same execution.
+ *
+ * @since 1.1-beta-1
+ */
+@@ -473,6 +481,7 @@
+ thread.interrupt();
+ }
+ // Now join with a timeout and call stop() (assuming flags are set right)
++ boolean threadStopIsAvailable = true;
+ for ( Thread thread : threads )
+ {
+ if ( !thread.isAlive() )
+@@ -494,10 +503,18 @@
+ continue;
+ }
+ uncooperativeThreads.add( thread ); // ensure we don't process again
+- if ( stopUnresponsiveDaemonThreads )
++ if ( stopUnresponsiveDaemonThreads && threadStopIsAvailable )
+ {
+ getLog().warn( "thread " + thread + " will be Thread.stop()'ed" );
+- thread.stop();
++ try
++ {
++ thread.stop();
++ }
++ catch ( UnsupportedOperationException unsupportedOperationException )
++ {
++ threadStopIsAvailable = false;
++ getLog().warn( THREAD_STOP_UNAVAILABLE );
++ }
+ }
+ else
+ {
+--- a/src/test/java/org/codehaus/mojo/exec/ExecJavaMojoTest.java
++++ b/src/test/java/org/codehaus/mojo/exec/ExecJavaMojoTest.java
+@@ -51,6 +51,9 @@
+
+ private static final File LOCAL_REPO = new File( "debian/maven-repo" );
+
++ private static final int JAVA_VERSION_MAJOR =
++ Integer.parseInt( System.getProperty( "java.version" ).replaceFirst( "[.].*", "" ) );
++
+ /*
+ * This one won't work yet public void xxtestSimpleRunPropertiesAndArguments() throws MojoExecutionException,
+ * Exception { File pom = new File( getBasedir(), "src/test/projects/project2/pom.xml" ); String output = execute(
+@@ -197,19 +200,36 @@
+ }
+
+ /**
+- * See <a href="http://jira.codehaus.org/browse/MEXEC-15">MEXEC-15</a>. FIXME: this sometimes fail with
+- * unit.framework.ComparisonFailure: expected:<...> but was:<...3(f)>
++ * See <a href="http://jira.codehaus.org/browse/MEXEC-15">MEXEC-15</a>,
++ * <a href="https://github.com/mojohaus/exec-maven-plugin/issues/391">GitHub-391</a>.
++ * <p>
++ * FIXME: This sometimes fails with {@code unit.framework.ComparisonFailure: expected:<...>; but was:<...3(f)>}.
+ *
+ * @throws Exception if any exception occurs
+ */
+ public void testUncooperativeThread()
+ throws Exception
+ {
++ // FIXME:
++ // This will fail the test, because Assume is a JUnit 4 thing, but we are running in JUnit 3 mode, because
++ // AbstractMojoTestCase extends PlexusTestCase extends TestCase. The latter is a JUnit 3 compatibility class.
++ // If we would simply use JUnit 4 annotations, conditional ignores via Assume would just work correctly in
++ // Surefire and IDEs. We could than have two dedicated test cases, one for each JDK 20+ and one for older
++ // versions. In JUnit 5, we could even conveniently use @EnabledOnJre.
++ // Assume.assumeTrue( JAVA_VERSION_MAJOR < 20 );
++
+ File pom = new File( getBasedir(), "src/test/projects/project10/pom.xml" );
+ String output = execute( pom, "java" );
+ // note: execute() will wait a little bit before returning the output,
+ // thereby allowing the stop()'ed thread to output the final "(f)".
+- assertEquals( MainUncooperative.SUCCESS, output.trim() );
++ if ( JAVA_VERSION_MAJOR < 20 )
++ {
++ assertEquals( MainUncooperative.SUCCESS, output.trim() );
++ }
++ else
++ {
++ assertEquals( MainUncooperative.INTERRUPTED_BUT_NOT_STOPPED, output.trim() );
++ }
+ }
+
+ /**
+--- a/src/test/java/org/codehaus/mojo/exec/MainUncooperative.java
++++ b/src/test/java/org/codehaus/mojo/exec/MainUncooperative.java
+@@ -9,6 +9,9 @@
+ {
+ public static final String SUCCESS = "1(interrupted)(f)2(f)";
+
++ // In JDK 20+, Thread::stop has been removed and just throws an UnsupportedOperationException
++ public static final String INTERRUPTED_BUT_NOT_STOPPED = "1(interrupted)(f)2";
++
+ public static void main( String... args )
+ throws InterruptedException
+ {
=====================================
debian/patches/series
=====================================
@@ -1,2 +1,3 @@
tests-local-repository.patch
junit-dependency.patch
+cope_with_thread_stop_being_unavailable_in_jdk20.patch
View it on GitLab: https://salsa.debian.org/java-team/exec-maven-plugin/-/compare/a02c460c958cd569e7c1727f2d039faa35f16f35...ff8f745b34efc5c33a0af0eba28839a7bcac0bb6
--
View it on GitLab: https://salsa.debian.org/java-team/exec-maven-plugin/-/compare/a02c460c958cd569e7c1727f2d039faa35f16f35...ff8f745b34efc5c33a0af0eba28839a7bcac0bb6
You're receiving this email because of your account on salsa.debian.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-java-commits/attachments/20240117/0b484d16/attachment.htm>
More information about the pkg-java-commits
mailing list