maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From denn...@apache.org
Subject svn commit: r1060049 - in /maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin: issues/IssueUtils.java jira/JiraHelper.java jira/JiraMojo.java
Date Mon, 17 Jan 2011 19:20:41 GMT
Author: dennisl
Date: Mon Jan 17 19:20:41 2011
New Revision: 1060049

URL: http://svn.apache.org/viewvc?rev=1060049&view=rev
Log:
o Refactoring: Move method.

Modified:
    maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/issues/IssueUtils.java
    maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/jira/JiraHelper.java
    maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/jira/JiraMojo.java

Modified: maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/issues/IssueUtils.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/issues/IssueUtils.java?rev=1060049&r1=1060048&r2=1060049&view=diff
==============================================================================
--- maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/issues/IssueUtils.java
(original)
+++ maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/issues/IssueUtils.java
Mon Jan 17 19:20:41 2011
@@ -33,6 +33,8 @@ import java.util.List;
  */
 public class IssueUtils
 {
+    public static final String SNAPSHOT_SUFFIX = "-SNAPSHOT";
+
     /**
      * Find the issues that has a Fix Version that matches the supplied prefix.
      *
@@ -75,4 +77,49 @@ public class IssueUtils
         }
         return filteredIssues;
     }
+
+    /**
+     * Find the issues for only the supplied version, by matching the "Fix for"
+     * version in the supplied list of issues with the supplied version.
+     * If the supplied version is a SNAPSHOT, then that part of the version
+     * will be removed prior to the matching.
+     *
+     * @param issues A list of issues
+     * @param version The version that issues should be returned for
+     * @return A <code>List</code> of issues for the supplied version
+     * @throws org.apache.maven.plugin.MojoExecutionException
+     *          If no issues could be found for the supplied version
+     */
+    public static List getIssuesForVersion( List issues, String version )
+        throws MojoExecutionException
+    {
+        List issuesForVersion = new ArrayList();
+        boolean isFound = false;
+        Issue issue = null;
+        String releaseVersion = version;
+
+        // Remove "-SNAPSHOT" from the end of the version, if it's there
+        if ( version != null && version.endsWith( SNAPSHOT_SUFFIX ) )
+        {
+            releaseVersion = version.substring( 0, version.length() - SNAPSHOT_SUFFIX.length()
);
+        }
+
+        for ( int i = 0; i < issues.size(); i++ )
+        {
+            issue = (Issue) issues.get( i );
+
+            if ( issue.getFixVersions() != null && issue.getFixVersions().contains(
releaseVersion ) )
+            {
+                isFound = true;
+                issuesForVersion.add( issue );
+            }
+        }
+
+        if ( !isFound )
+        {
+            throw new MojoExecutionException(
+                "Couldn't find any issues for the version '" + releaseVersion + "' among
the supplied issues." );
+        }
+        return issuesForVersion;
+    }
 }

Modified: maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/jira/JiraHelper.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/jira/JiraHelper.java?rev=1060049&r1=1060048&r2=1060049&view=diff
==============================================================================
--- maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/jira/JiraHelper.java
(original)
+++ maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/jira/JiraHelper.java
Mon Jan 17 19:20:41 2011
@@ -44,53 +44,6 @@ public class JiraHelper
 {
     private static final String PID = "pid=";
 
-    private static final String SNAPSHOT_SUFFIX = "-SNAPSHOT";
-
-    /**
-     * Find the issues for only the supplied version, by matching the "Fix for"
-     * version in the supplied list of issues with the supplied version.
-     * If the supplied version is a SNAPSHOT, then that part of the version
-     * will be removed prior to the matching.
-     *
-     * @param issues A list of issues from JIRA
-     * @param version The version that issues should be returned for
-     * @return A <code>List</code> of issues for the supplied version
-     * @throws org.apache.maven.plugin.MojoExecutionException
-     *          If no issues could be found for the supplied version
-     */
-    public static List getIssuesForVersion( List issues, String version )
-        throws MojoExecutionException
-    {
-        List issuesForVersion = new ArrayList();
-        boolean isFound = false;
-        Issue issue = null;
-        String releaseVersion = version;
-
-        // Remove "-SNAPSHOT" from the end of the version, if it's there
-        if ( version != null && version.endsWith( SNAPSHOT_SUFFIX ) )
-        {
-            releaseVersion = version.substring( 0, version.length() - SNAPSHOT_SUFFIX.length()
);
-        }
-
-        for ( int i = 0; i < issues.size(); i++ )
-        {
-            issue = (Issue) issues.get( i );
-
-            if ( issue.getFixVersions() != null && issue.getFixVersions().contains(
releaseVersion ) )
-            {
-                isFound = true;
-                issuesForVersion.add( issue );
-            }
-        }
-
-        if ( !isFound )
-        {
-            throw new MojoExecutionException(
-                "Couldn't find any issues for the version '" + releaseVersion + "' among
the supplied issues." );
-        }
-        return issuesForVersion;
-    }
-
     /**
      * Parse out the base URL for JIRA and the JIRA project id from the issue
      * management URL.

Modified: maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/jira/JiraMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/jira/JiraMojo.java?rev=1060049&r1=1060048&r2=1060049&view=diff
==============================================================================
--- maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/jira/JiraMojo.java
(original)
+++ maven/plugins/trunk/maven-changes-plugin/src/main/java/org/apache/maven/plugin/jira/JiraMojo.java
Mon Jan 17 19:20:41 2011
@@ -326,7 +326,7 @@ public class JiraMojo
             if ( onlyCurrentVersion )
             {
                 String version = ( versionPrefix == null ? "" : versionPrefix ) + project.getVersion();
-                issueList = JiraHelper.getIssuesForVersion( issueList, version );
+                issueList = IssueUtils.getIssuesForVersion( issueList, version );
                 getLog().info( "The JIRA Report will contain issues only for the current
version." );
             }
 



Mime
View raw message