You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@continuum.apache.org by ev...@apache.org on 2006/03/09 14:25:03 UTC

svn commit: r384505 - /maven/continuum/branches/continuum-1.0.x/continuum-core/src/main/java/org/apache/maven/continuum/scm/DefaultContinuumScm.java

Author: evenisse
Date: Thu Mar  9 05:25:02 2006
New Revision: 384505

URL: http://svn.apache.org/viewcvs?rev=384505&view=rev
Log:
Add scm url validation messages to exception message

Modified:
    maven/continuum/branches/continuum-1.0.x/continuum-core/src/main/java/org/apache/maven/continuum/scm/DefaultContinuumScm.java

Modified: maven/continuum/branches/continuum-1.0.x/continuum-core/src/main/java/org/apache/maven/continuum/scm/DefaultContinuumScm.java
URL: http://svn.apache.org/viewcvs/maven/continuum/branches/continuum-1.0.x/continuum-core/src/main/java/org/apache/maven/continuum/scm/DefaultContinuumScm.java?rev=384505&r1=384504&r2=384505&view=diff
==============================================================================
--- maven/continuum/branches/continuum-1.0.x/continuum-core/src/main/java/org/apache/maven/continuum/scm/DefaultContinuumScm.java (original)
+++ maven/continuum/branches/continuum-1.0.x/continuum-core/src/main/java/org/apache/maven/continuum/scm/DefaultContinuumScm.java Thu Mar  9 05:25:02 2006
@@ -72,7 +72,6 @@
      */
     private Properties updateProperties;
 
-    
     // ----------------------------------------------------------------------
     // ContinuumScm implementation
     // ----------------------------------------------------------------------
@@ -152,7 +151,9 @@
         }
         catch ( ScmRepositoryException e )
         {
-            throw new ContinuumScmException( "Cannot checkout sources.", e );
+            String message = getValidationMessages( e );
+
+            throw new ContinuumScmException( "Cannot checkout sources." + message, e );
         }
         catch ( ScmException e )
         {
@@ -227,7 +228,7 @@
                     System.setProperty( key, updateProperties.getProperty( key ) );
                 }
             }
-            
+
             ScmRepository repository = getScmRepositorty( project );
 
             ScmResult result;
@@ -236,8 +237,8 @@
 
             synchronized ( this )
             {
-                result = convertScmResult(
-                    scmManager.getProviderByRepository( repository ).update( repository, fileSet, tag, getLatestUpdateDate( project ) ) );
+                result = convertScmResult( scmManager.getProviderByRepository( repository )
+                    .update( repository, fileSet, tag, getLatestUpdateDate( project ) ) );
             }
 
             if ( !result.isSuccess() )
@@ -255,13 +256,15 @@
 
             return result;
         }
-        catch ( ScmRepositoryException ex )
+        catch ( ScmRepositoryException e )
         {
-            throw new ContinuumScmException( "Error while update sources.", ex );
+            String message = getValidationMessages( e );
+
+            throw new ContinuumScmException( "Error while update sources." + message, e );
         }
-        catch ( ScmException ex )
+        catch ( ScmException e )
         {
-            throw new ContinuumScmException( "Error while update sources.", ex );
+            throw new ContinuumScmException( "Error while update sources.", e );
         }
         catch ( Exception e )
         {
@@ -269,6 +272,27 @@
         }
     }
 
+    private String getValidationMessages( ScmRepositoryException ex )
+    {
+        List messages = ex.getValidationMessages();
+
+        StringBuffer message = new StringBuffer();
+
+        if ( !messages.isEmpty() )
+        {
+            for ( Iterator i = messages.iterator(); i.hasNext(); )
+            {
+                message.append( (String) i.next() );
+
+                if ( i.hasNext() )
+                {
+                    message.append( System.getProperty( "line.separator" ) );
+                }
+            }
+        }
+        return message.toString();
+    }
+
     // ----------------------------------------------------------------------
     //
     // ----------------------------------------------------------------------
@@ -350,7 +374,7 @@
 
                 // TODO: revision?
 
-                file.setStatus(scmFile.getStatus().toString());
+                file.setStatus( scmFile.getStatus().toString() );
 
                 changeSet.addFile( file );
             }
@@ -420,7 +444,7 @@
     private String writeCommandLine( String commandLine )
     {
         String cmd = commandLine;
-        
+
         if ( cmd != null && cmd.startsWith( "svn" ) )
         {
             String pwdString = "--password";