gnodet-bot commented on code in PR #13269:
URL: https://github.com/apache/maven/pull/13269#discussion_r4267831735


##########
impl/maven-core/src/main/java/org/apache/maven/project/ProjectModelResolver.java:
##########
@@ -263,6 +266,9 @@ public ModelSource resolveModel(final Dependency 
dependency) throws Unresolvable
         } catch (VersionRangeResolutionException e) {
             throw new UnresolvableModelException(
                     e.getMessage(), dependency.getGroupId(), 
dependency.getArtifactId(), dependency.getVersion(), e);
+        } catch (IllegalArgumentException e) {
+            throw new UnresolvableModelException(
+                    e.getMessage(), dependency.getGroupId(), 
dependency.getArtifactId(), dependency.getVersion(), e);
         }

Review Comment:
   💡 **Style:** Same multi-catch opportunity in the `Dependency` overload.
   
   ```suggestion
           } catch (VersionRangeResolutionException | IllegalArgumentException 
e) {
               throw new UnresolvableModelException(
                       e.getMessage(), dependency.getGroupId(), 
dependency.getArtifactId(), dependency.getVersion(), e);
           }
   ```



##########
impl/maven-core/src/main/java/org/apache/maven/project/ProjectModelResolver.java:
##########
@@ -220,6 +220,9 @@ public ModelSource resolveModel(final Parent parent) throws 
UnresolvableModelExc
         } catch (final VersionRangeResolutionException e) {
             throw new UnresolvableModelException(
                     e.getMessage(), parent.getGroupId(), 
parent.getArtifactId(), parent.getVersion(), e);
+        } catch (final IllegalArgumentException e) {
+            throw new UnresolvableModelException(
+                    e.getMessage(), parent.getGroupId(), 
parent.getArtifactId(), parent.getVersion(), e);
         }

Review Comment:
   💡 **Style:** Both catch blocks have identical bodies — collapse into a 
multi-catch to avoid duplication (this pattern is used extensively in the 
codebase, e.g. `DefaultMavenPluginManager`, `DefaultGraphBuilder`).
   
   ```suggestion
           } catch (final VersionRangeResolutionException | 
IllegalArgumentException e) {
               throw new UnresolvableModelException(
                       e.getMessage(), parent.getGroupId(), 
parent.getArtifactId(), parent.getVersion(), e);
           }
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to