You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by ti...@apache.org on 2022/02/07 11:19:07 UTC

[maven-surefire] 01/01: [SUREFIRE-2005] Improved dump message "Boot Manifest-JAR contains absolute paths in classpath" with exception message

This is an automated email from the ASF dual-hosted git repository.

tibordigana pushed a commit to branch SUREFIRE-2005
in repository https://gitbox.apache.org/repos/asf/maven-surefire.git

commit 550f98a6a9dbd3df29b66525642696f290831ffd
Author: tibor.digana <ti...@apache.org>
AuthorDate: Mon Feb 7 12:18:52 2022 +0100

    [SUREFIRE-2005] Improved dump message "Boot Manifest-JAR contains absolute paths in classpath" with exception message
---
 .../surefire/booterclient/JarManifestForkConfiguration.java       | 8 ++++++++
 .../surefire/booterclient/JarManifestForkConfigurationTest.java   | 2 +-
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/JarManifestForkConfiguration.java b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/JarManifestForkConfiguration.java
index f0c4011..697b206 100644
--- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/JarManifestForkConfiguration.java
+++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/JarManifestForkConfiguration.java
@@ -54,6 +54,7 @@ import static java.nio.file.Files.isDirectory;
 import static org.apache.maven.plugin.surefire.SurefireHelper.escapeToPlatformPath;
 import static org.apache.maven.plugin.surefire.booterclient.JarManifestForkConfiguration.ClasspathElementUri.absolute;
 import static org.apache.maven.plugin.surefire.booterclient.JarManifestForkConfiguration.ClasspathElementUri.relative;
+import static org.apache.maven.surefire.shared.utils.StringUtils.isNotBlank;
 import static org.apache.maven.surefire.api.util.internal.StringUtils.NL;
 
 /**
@@ -198,6 +199,13 @@ public final class JarManifestForkConfiguration
                         + "'"
                         + NL
                         + "Hint: <argLine>-Djdk.net.URLClassPath.disableClassPathURLCheck=true</argLine>";
+
+                if ( isNotBlank( e.getLocalizedMessage() ) )
+                {
+                    error += NL;
+                    error += e.getLocalizedMessage();
+                }
+
                 InPluginProcessDumpSingleton.getSingleton()
                         .dumpStreamText( error, dumpLogDirectory );
             }
diff --git a/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/booterclient/JarManifestForkConfigurationTest.java b/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/booterclient/JarManifestForkConfigurationTest.java
index 3a1c98b..3564e11 100644
--- a/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/booterclient/JarManifestForkConfigurationTest.java
+++ b/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/booterclient/JarManifestForkConfigurationTest.java
@@ -182,7 +182,7 @@ public class JarManifestForkConfigurationTest
                     }
                 } );
         when( relativize( same( parent ), same( classPathElement ) ) )
-                .thenThrow( new IllegalArgumentException() );
+                .thenThrow( new IllegalArgumentException( "'other' has different root" ) );
         when( toClasspathElementUri( same( parent ), same( classPathElement ), same( dumpDirectory ), anyBoolean() ) )
                 .thenCallRealMethod();
         when( escapeUri( anyString(), any( Charset.class ) ) )