mirror of https://github.com/apache/lucene.git
SOLR-9016: Fix SolrIdentifierValidator to not accept empty identifiers
This commit is contained in:
parent
6f6630b38e
commit
95322605b8
|
@ -116,6 +116,8 @@ Bug Fixes
|
|||
|
||||
* SOLR-9029: fix rare ZkStateReader visibility race during collection state format update (Scott Blum, hossman)
|
||||
|
||||
* SOLR-9016: Fix SolrIdentifierValidator to not allow empty identifiers. (Shai Erera)
|
||||
|
||||
Optimizations
|
||||
----------------------
|
||||
* SOLR-8722: Don't force a full ZkStateReader refresh on every Overseer operation.
|
||||
|
|
|
@ -28,7 +28,7 @@ import org.apache.solr.common.SolrException;
|
|||
* 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
|
||||
|
@ -64,11 +64,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";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue