You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by mp...@apache.org on 2006/06/23 01:25:14 UTC

svn commit: r416505 - /maven/plugins/trunk/maven-jar-plugin/src/main/java/org/apache/maven/plugin/jar/JarSignMojo.java

Author: mperham
Date: Thu Jun 22 16:25:13 2006
New Revision: 416505

URL: http://svn.apache.org/viewvc?rev=416505&view=rev
Log:
PR: MJAR-33
Hide password in JarSign debug output

Modified:
    maven/plugins/trunk/maven-jar-plugin/src/main/java/org/apache/maven/plugin/jar/JarSignMojo.java

Modified: maven/plugins/trunk/maven-jar-plugin/src/main/java/org/apache/maven/plugin/jar/JarSignMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-jar-plugin/src/main/java/org/apache/maven/plugin/jar/JarSignMojo.java?rev=416505&r1=416504&r2=416505&view=diff
==============================================================================
--- maven/plugins/trunk/maven-jar-plugin/src/main/java/org/apache/maven/plugin/jar/JarSignMojo.java (original)
+++ maven/plugins/trunk/maven-jar-plugin/src/main/java/org/apache/maven/plugin/jar/JarSignMojo.java Thu Jun 22 16:25:13 2006
@@ -278,7 +278,10 @@
             getLog().debug( "Signing JAR in-place (overwritting original JAR)." );
         }
 
-        getLog().debug( "Executing: " + commandLine );
+        if ( getLog().isDebugEnabled() )
+        {
+            getLog().debug( "Executing: " + purgePassword( commandLine ) );
+        }
 
         // jarsigner may ask for some input if the parameters are missing or incorrect.
         // This should take care of it and make it fail gracefully
@@ -312,7 +315,8 @@
 
             if ( result != 0 )
             {
-                throw new MojoExecutionException( "Result of " + commandLine + " execution is: \'" + result + "\'." );
+                throw new MojoExecutionException( "Result of " + purgePassword( commandLine ) +
+                    " execution is: \'" + result + "\'." );
             }
         }
         catch ( CommandLineException e )
@@ -334,6 +338,16 @@
         {
             project.getArtifact().setFile( signedjar );
         }
+    }
+
+    private String purgePassword( Commandline commandLine )
+    {
+        String out = commandLine.toString();
+        if ( keypass != null && out.indexOf( keypass ) != -1 )
+        {
+            out = StringUtils.replace( out, keypass, "******" );
+        }
+        return out;
     }
 
     private void createParentDirIfNecessary( File file )