You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@solr.apache.org by GitBox <gi...@apache.org> on 2022/10/27 18:47:30 UTC

[GitHub] [solr] risdenk commented on a diff in pull request #778: Forbid 'String.matches(String)' API.

risdenk commented on code in PR #778:
URL: https://github.com/apache/solr/pull/778#discussion_r1007244154


##########
solr/core/src/java/org/apache/solr/packagemanager/PackageUtils.java:
##########
@@ -255,15 +256,15 @@ public static void print(String color, Object message) {
   }
 
   public static String[] validateCollections(String collections[]) {
-    String collectionNameRegex = "^[a-zA-Z0-9_-]*$";
+    Pattern collectionNameRegexPattern = Pattern.compile("^[a-zA-Z0-9_-]*$");

Review Comment:
   probably can make this a static final field?



##########
solr/core/src/java/org/apache/solr/cloud/api/collections/RoutedAlias.java:
##########
@@ -185,8 +186,9 @@ private static void addRouterTypeOf(String type, List<RoutedAliasTypes> routerTy
   }
 
   private static Map<String, String> selectForIndex(int i, Map<String, String> original) {
+    final Pattern pattern = Pattern.compile("(((?!^router\\.).)*$|(^router\\." + i + ".*$))");

Review Comment:
   probably can make this a static final field?



##########
solr/test-framework/src/java/org/apache/solr/util/RestTestBase.java:
##########
@@ -114,7 +115,8 @@ public static void assertQ(String request, String... tests) {
         query = request.substring(queryStartPos + 1);
         path = request.substring(0, queryStartPos);
       }
-      if (!query.matches(".*wt=schema\\.xml.*")) { // don't overwrite wt=schema.xml
+      final Pattern WT_SCHEMA_XML_PATTERN = Pattern.compile(".*wt=schema\\.xml.*");

Review Comment:
   This can probably be a static final field.



-- 
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: issues-unsubscribe@solr.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org