This is an automated email from the ASF dual-hosted git repository.

elharo pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven-changes-plugin.git


The following commit(s) were added to refs/heads/master by this push:
     new e7948f3  [MCHANGES-420] no issues is not exceptional (#49)
e7948f3 is described below

commit e7948f3fee38d73cbbe8d602abeefd89ff36b2f6
Author: Elliotte Rusty Harold <elh...@users.noreply.github.com>
AuthorDate: Fri Nov 22 14:42:51 2024 +0000

    [MCHANGES-420] no issues is not exceptional (#49)
---
 .../apache/maven/plugins/issues/IssueUtils.java    | 22 ++++++----------------
 1 file changed, 6 insertions(+), 16 deletions(-)

diff --git a/src/main/java/org/apache/maven/plugins/issues/IssueUtils.java 
b/src/main/java/org/apache/maven/plugins/issues/IssueUtils.java
index 4c10366..f7396a5 100644
--- a/src/main/java/org/apache/maven/plugins/issues/IssueUtils.java
+++ b/src/main/java/org/apache/maven/plugins/issues/IssueUtils.java
@@ -69,19 +69,16 @@ public class IssueUtils {
     }
 
     /**
-     * Find the issues for only the supplied version, by matching the "Fix 
for" version in the supplied list of issues
+     * Find the issues for 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
+     * @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, 
possibly empty if there are no issues
      */
-    public static List<Issue> getIssuesForVersion(List<Issue> issues, String 
version) throws MojoExecutionException {
+    public static List<Issue> getIssuesForVersion(List<Issue> issues, String 
version) {
         List<Issue> issuesForVersion = new ArrayList<>();
-        boolean isFound = false;
-        Issue issue;
         String releaseVersion = version;
 
         // Remove "-SNAPSHOT" from the end of the version, if it's there
@@ -89,19 +86,12 @@ public class IssueUtils {
             releaseVersion = version.substring(0, version.length() - 
SNAPSHOT_SUFFIX.length());
         }
 
-        for (Issue issue1 : issues) {
-            issue = issue1;
-
+        for (Issue issue : issues) {
             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: " + toString(issues));
-        }
         return issuesForVersion;
     }
 

Reply via email to