You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by an...@apache.org on 2016/04/27 06:51:43 UTC
lucene-solr:branch_6_0: SOLR-9016: Fix SolrIdentifierValidator to not
accept empty identifiers
Repository: lucene-solr
Updated Branches:
refs/heads/branch_6_0 8e37c969e -> b3cd1ff61
SOLR-9016: Fix SolrIdentifierValidator to not accept empty identifiers
Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/b3cd1ff6
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/b3cd1ff6
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/b3cd1ff6
Branch: refs/heads/branch_6_0
Commit: b3cd1ff615ef0e2cf45bedbdf7d30362cc50dd1a
Parents: 8e37c96
Author: Shai Erera <sh...@apache.org>
Authored: Tue Apr 26 17:28:04 2016 +0300
Committer: anshum <an...@apache.org>
Committed: Tue Apr 26 21:28:29 2016 -0700
----------------------------------------------------------------------
solr/CHANGES.txt | 2 ++
.../solr/client/solrj/util/SolrIdentifierValidator.java | 12 +++++-------
2 files changed, 7 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/b3cd1ff6/solr/CHANGES.txt
----------------------------------------------------------------------
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index 605cf27..5281829 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -24,6 +24,8 @@ Bug Fixes
* SOLR-8914: ZkStateReader's refreshLiveNodes(Watcher) is not thread safe. (Scott Blum, hoss,
sarowe, Erick Erickson, Mark Miller, shalin)
+* SOLR-9016: Fix SolrIdentifierValidator to not allow empty identifiers. (Shai Erera)
+
================== 6.0.0 ==================
Consult the LUCENE_CHANGES.txt file for additional, low level, changes in this release
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/b3cd1ff6/solr/solrj/src/java/org/apache/solr/client/solrj/util/SolrIdentifierValidator.java
----------------------------------------------------------------------
diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/util/SolrIdentifierValidator.java b/solr/solrj/src/java/org/apache/solr/client/solrj/util/SolrIdentifierValidator.java
index 449c621..cb1c79b 100644
--- a/solr/solrj/src/java/org/apache/solr/client/solrj/util/SolrIdentifierValidator.java
+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/util/SolrIdentifierValidator.java
@@ -26,7 +26,7 @@ import java.util.regex.Pattern;
* Identifiers are allowed to contain underscores, periods, hyphens, and alphanumeric characters.
*/
public class SolrIdentifierValidator {
- final static Pattern identifierPattern = Pattern.compile("^(?!\\-)[\\._A-Za-z0-9\\-]*$");
+ final static Pattern identifierPattern = Pattern.compile("^(?!\\-)[\\._A-Za-z0-9\\-]+$");
public enum IdentifierType {
SHARD, COLLECTION, CORE, ALIAS
@@ -52,11 +52,9 @@ public class SolrIdentifierValidator {
}
public static String getIdentifierMessage(IdentifierType identifierType, String name) {
- return "Invalid " + identifierType.toString().toLowerCase(Locale.ROOT) + ": " + name + ". "
- + identifierType.toString().toLowerCase(Locale.ROOT)
- + " names must consist entirely of periods, underscores, hyphens, and alphanumerics";
-
+ String typeStr = identifierType.toString().toLowerCase(Locale.ROOT);
+ return "Invalid " + typeStr + ": [" + name + "]. " + typeStr + " names must consist entirely of periods, "
+ + "underscores, hyphens, and alphanumerics as well not start with a hyphen";
}
-}
-
+}