You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by br...@apache.org on 2009/03/11 12:42:56 UTC

svn commit: r752428 - /maven/components/branches/maven-2.1.0-RC/maven-core/src/main/java/org/apache/maven/DefaultMaven.java

Author: brett
Date: Wed Mar 11 11:42:55 2009
New Revision: 752428

URL: http://svn.apache.org/viewvc?rev=752428&view=rev
Log:
[MNG-553] add some very specific instructions should decryption fail, and continue using the password as is

Modified:
    maven/components/branches/maven-2.1.0-RC/maven-core/src/main/java/org/apache/maven/DefaultMaven.java

Modified: maven/components/branches/maven-2.1.0-RC/maven-core/src/main/java/org/apache/maven/DefaultMaven.java
URL: http://svn.apache.org/viewvc/maven/components/branches/maven-2.1.0-RC/maven-core/src/main/java/org/apache/maven/DefaultMaven.java?rev=752428&r1=752427&r2=752428&view=diff
==============================================================================
--- maven/components/branches/maven-2.1.0-RC/maven-core/src/main/java/org/apache/maven/DefaultMaven.java (original)
+++ maven/components/branches/maven-2.1.0-RC/maven-core/src/main/java/org/apache/maven/DefaultMaven.java Wed Mar 11 11:42:55 2009
@@ -21,6 +21,7 @@
 
 
 import java.io.File;
+import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.text.DateFormat;
 import java.text.SimpleDateFormat;
@@ -731,7 +732,7 @@
                     }
                     catch ( SecDispatcherException e )
                     {
-                        throw new SettingsConfigurationException( e.getMessage() );
+                        reportSecurityConfigurationError( "password for proxy '" + proxy.getId() + "'", e );
                     }
                 }
 
@@ -753,7 +754,7 @@
                     }
                     catch ( SecDispatcherException e )
                     {
-                        throw new SettingsConfigurationException( e.getMessage() );
+                        reportSecurityConfigurationError( "password for server '" + server.getId() + "'", e );
                     }
                 }
                 
@@ -767,7 +768,7 @@
                     }
                     catch ( SecDispatcherException e )
                     {
-                        throw new SettingsConfigurationException( e.getMessage() );
+                        reportSecurityConfigurationError( "passphrase for server '" + server.getId() + "'", e );
                     }
                 }
 
@@ -830,6 +831,28 @@
         }
     }
 
+    private void reportSecurityConfigurationError( String affectedConfiguration, SecDispatcherException e )
+    {
+        Throwable cause = e;
+
+        String msg = "Not decrypting " + affectedConfiguration + " due to exception in security handler.";
+
+        // Drop to the actual cause, it wraps multiple times
+        while ( cause.getCause() != null )
+        {
+            cause = cause.getCause();
+        }
+
+        // common cause is missing settings-security.xml
+        if ( cause instanceof FileNotFoundException )
+        {
+            msg += "\nEnsure that you have configured your master password file (and relocation if appropriate)\nSee the installation instructions for details.";
+        }
+
+        getLogger().warn( msg + "\nCause: " + cause.getMessage() );
+        getLogger().debug( "Full trace follows", e );
+    }
+
     // ----------------------------------------------------------------------
     // Lifecylce Management
     // ----------------------------------------------------------------------