michael-o commented on a change in pull request #451:
URL: https://github.com/apache/maven/pull/451#discussion_r583942707



##########
File path: 
maven-model-builder/src/main/java/org/apache/maven/model/validation/DefaultModelValidator.java
##########
@@ -850,36 +853,75 @@ private boolean validateId( String prefix, String 
fieldName, ModelProblemCollect
         }
         else
         {
-            if ( !isValidId( id ) )
+            if ( !isValidCoordinateId( id ) )
             {
                 addViolation( problems, severity, version, prefix + fieldName, 
sourceHint,
-                              "with value '" + id + "' does not match a valid 
id pattern.", tracker );
+                              "with value '" + id + "' does not match a valid 
coordinate id pattern.", tracker );
                 return false;
             }
-            validIds.add( id );
+            validCoordinateIds.add( id );
             return true;
         }
     }
 
-    private boolean isValidId( String id )
+    private boolean isValidCoordinateId( String id )
     {
         for ( int i = 0; i < id.length(); i++ )
         {
             char c = id.charAt( i );
-            if ( !isValidIdCharacter( c ) )
+            if ( !isValidCoordinateIdCharacter( c ) )
             {
                 return false;
             }
         }
         return true;
     }
 
-
-    private boolean isValidIdCharacter( char c )
+    private boolean isValidCoordinateIdCharacter( char c )
     {
         return c >= 'a' && c <= 'z' || c >= 'A' && c <= 'Z' || c >= '0' && c 
<= '9' || c == '-' || c == '_' || c == '.';
     }
 
+    @SuppressWarnings( "checkstyle:parameternumber" )
+    private boolean validateProfileId( String prefix, String fieldName, 
ModelProblemCollector problems,
+                                       Severity severity, Version version, 
String id, String sourceHint,
+                                       InputLocationTracker tracker )
+    {
+        if ( validProfileIds.contains( id ) )
+        {
+            return true;
+        }
+        if ( !validateStringNotEmpty( prefix, fieldName, problems, severity, 
version, id, sourceHint, tracker ) )
+        {
+            return false;
+        }
+        else
+        {
+            if ( !isValidProfileId( id ) )
+            {
+                addViolation( problems, severity, version, prefix + fieldName, 
sourceHint,
+                              "with value '" + id + "' does not match a valid 
profile id pattern.", tracker );
+                return false;
+            }
+            validProfileIds.add( id );
+            return true;
+        }
+    }
+
+    private boolean isValidProfileId( String id )
+    {
+        switch ( id.charAt( 0 ) )
+        { // avoid first character that has special CLI meaning in "mvn -P xxx"

Review comment:
       I don't understand the urgent need for the `jdk9+`. This is alpha code, 
why did you put this into production?




----------------------------------------------------------------
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:
us...@infra.apache.org


Reply via email to