You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by de...@apache.org on 2007/07/08 18:36:30 UTC
svn commit: r554384 -
/maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/announcement/AnnouncementMojo.java
Author: dennisl
Date: Sun Jul 8 09:36:26 2007
New Revision: 554384
URL: http://svn.apache.org/viewvc?view=rev&rev=554384
Log:
o Improve debugging capabilities and error handling.
Modified:
maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/announcement/AnnouncementMojo.java
Modified: maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/announcement/AnnouncementMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/announcement/AnnouncementMojo.java?view=diff&rev=554384&r1=554383&r2=554384
==============================================================================
--- maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/announcement/AnnouncementMojo.java (original)
+++ maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/announcement/AnnouncementMojo.java Sun Jul 8 09:36:26 2007
@@ -22,10 +22,12 @@
import java.io.File;
import java.io.FileWriter;
import java.io.Writer;
+import java.util.Iterator;
import java.util.List;
import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.changes.Action;
import org.apache.maven.plugin.changes.ChangesXML;
import org.apache.maven.plugin.changes.Release;
import org.apache.maven.project.MavenProject;
@@ -349,7 +351,7 @@
/**
* Get the latest release by matching the supplied releases
- * with the version in the pom
+ * with the version from the pom.
*
* @param releases list of releases
* @throws MojoExecutionException
@@ -367,14 +369,25 @@
{
pomVersion = pomVersion.substring( 0, pomVersion.length() - SNAPSHOT_SUFFIX.length() );
}
+ getLog().debug( "Found " + releases.size() + " releases.");
for ( int i = 0; i < releases.size(); i++ )
{
release = (Release) releases.get( i );
+ if ( getLog().isDebugEnabled() )
+ {
+ getLog().debug( "The release: " + release.getVersion()
+ + " has " + release.getAction().size() + " actions.");
+ }
if ( release.getVersion() != null && release.getVersion().equals( pomVersion ) )
{
isFound = true;
+ if ( getLog().isDebugEnabled() )
+ {
+ getLog().debug( "Found the correct release: " + release.getVersion() );
+ logRelease( release );
+ }
return release;
}
}
@@ -387,6 +400,19 @@
return release;
}
+ private void logRelease( Release release )
+ {
+ Action action;
+ for ( Iterator iterator = release.getAction().iterator(); iterator.hasNext(); )
+ {
+ action = (Action) iterator.next();
+ getLog().debug( "o " + action.getType() );
+ getLog().debug( " - " + action.getIssue() );
+ getLog().debug( " - " + action.getAction() );
+ getLog().debug( " - " + action.getDueTo() );
+ }
+ }
+
/**
* Create the velocity template
*
@@ -431,6 +457,10 @@
catch ( Exception e )
{
+ if ( e.getCause() != null )
+ {
+ getLog().warn( e.getCause() );
+ }
throw new MojoExecutionException( e.toString(), e.getCause() );
}
}
@@ -473,7 +503,7 @@
}
catch ( Exception e )
{
- throw new MojoExecutionException( "Failed to download JIRA Announcement", e );
+ throw new MojoExecutionException( "Failed to extract JIRA issues from the downloaded file", e );
}
}