From 50ea5f9cf83ab81d9f1e6d06cc12b08102c3e6cd Mon Sep 17 00:00:00 2001 From: David Kyle Date: Fri, 26 Jan 2018 16:03:31 +0000 Subject: [PATCH] [ML] Update Javadoc for expected behaviour in NameResolver (elastic/x-pack-elasticsearch#3733) Update Javadoc Original commit: elastic/x-pack-elasticsearch@e47f38b2cea64707a9d22dc0fb6bbd9618d569b6 --- .../org/elasticsearch/xpack/core/ml/utils/NameResolver.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/utils/NameResolver.java b/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/utils/NameResolver.java index 89d021a2e38..f737a3d9ad7 100644 --- a/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/utils/NameResolver.java +++ b/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/utils/NameResolver.java @@ -46,7 +46,9 @@ public abstract class NameResolver { * * * @param expression the expression to resolve - * @param allowNoMatch if {@code false}, an error is thrown when no name matches the {@code expression} + * @param allowNoMatch if {@code false}, an error is thrown when no name matches the {@code expression}. + * This only applies to wild card expressions, if {@code expression} is not a + * wildcard then setting this true will not suppress the exception * @return the sorted set of matching names */ public SortedSet expand(String expression, boolean allowNoMatch) { @@ -68,6 +70,8 @@ public abstract class NameResolver { result.addAll(expanded); } else { List matchingNames = lookup(token); + // allowNoMatch only applies to wildcard expressions, + // this isn't so don't check the allowNoMatch here if (matchingNames.isEmpty()) { throw notFoundExceptionSupplier.apply(token); }