maven-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [maven] vlsi commented on a change in pull request #242: Speed up project discovery
Date Wed, 24 Apr 2019 19:38:45 GMT
vlsi commented on a change in pull request #242: Speed up project discovery
URL: https://github.com/apache/maven/pull/242#discussion_r278286015
 
 

 ##########
 File path: maven-artifact/src/main/java/org/apache/maven/artifact/versioning/DefaultArtifactVersion.java
 ##########
 @@ -204,19 +211,33 @@ public final void parseVersion( String version )
     }
 
     private static Integer getNextIntegerToken( StringTokenizer tok )
+    {
+        String s = tok.nextToken();
+        if ( ( s.length() > 1 ) && s.startsWith( "0" ) )
+        {
+            return null;
+        }
+        return tryParseInt( s );
+    }
+
+    private static Integer tryParseInt( String s )
     {
         try
         {
-            String s = tok.nextToken();
-            if ( ( s.length() > 1 ) && s.startsWith( "0" ) )
+            if ( !isParsable( s ) )
+            {
+                return null;
+            }
+            long longValue = Long.parseLong( s );
+            if ( longValue > Integer.MAX_VALUE )
 
 Review comment:
   +1 to @oehme, however it is probably worth adding a comment that explains this (the reason
behind `tryParseInt` method and the reason behind `parseLong`).

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

Mime
View raw message