From 1cf318c15cda77f15a3f91fc89fb6da2d5111c57 Mon Sep 17 00:00:00 2001 From: Jason van Zyl Date: Wed, 18 Jul 2012 00:55:48 +0000 Subject: [PATCH] MNG-5314: DefaultModelValidator misuses String.matches git-svn-id: https://svn.apache.org/repos/asf/maven/maven-3/trunk@1362731 13f79535-47bb-0310-9956-ffa450edef68 --- .../apache/maven/model/validation/DefaultModelValidator.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/maven-model-builder/src/main/java/org/apache/maven/model/validation/DefaultModelValidator.java b/maven-model-builder/src/main/java/org/apache/maven/model/validation/DefaultModelValidator.java index 5ee424e27e..ff084f7201 100644 --- a/maven-model-builder/src/main/java/org/apache/maven/model/validation/DefaultModelValidator.java +++ b/maven-model-builder/src/main/java/org/apache/maven/model/validation/DefaultModelValidator.java @@ -26,6 +26,7 @@ import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; +import java.util.regex.Pattern; import org.apache.maven.model.Build; import org.apache.maven.model.BuildBase; @@ -61,7 +62,7 @@ public class DefaultModelValidator implements ModelValidator { - private static final String ID_REGEX = "[A-Za-z0-9_\\-.]+"; + private static final Pattern ID_REGEX = Pattern.compile("[A-Za-z0-9_\\-.]+"); private static final String ILLEGAL_FS_CHARS = "\\/:\"<>|?*"; @@ -625,7 +626,7 @@ public class DefaultModelValidator } else { - boolean match = id.matches( ID_REGEX ); + boolean match = ID_REGEX.matcher( id ).matches(); if ( !match ) { addViolation( problems, severity, version, fieldName, sourceHint, "with value '" + id