[ML] Update Javadoc for expected behaviour in NameResolver (elastic/x-pack-elasticsearch#3733)

Update Javadoc

Original commit: elastic/x-pack-elasticsearch@e47f38b2ce
This commit is contained in:
David Kyle 2018-01-26 16:03:31 +00:00 committed by GitHub
parent 867b4fe9fc
commit 50ea5f9cf8
1 changed files with 5 additions and 1 deletions

View File

@ -46,7 +46,9 @@ public abstract class NameResolver {
* </ul> * </ul>
* *
* @param expression the expression to resolve * @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 * @return the sorted set of matching names
*/ */
public SortedSet<String> expand(String expression, boolean allowNoMatch) { public SortedSet<String> expand(String expression, boolean allowNoMatch) {
@ -68,6 +70,8 @@ public abstract class NameResolver {
result.addAll(expanded); result.addAll(expanded);
} else { } else {
List<String> matchingNames = lookup(token); List<String> matchingNames = lookup(token);
// allowNoMatch only applies to wildcard expressions,
// this isn't so don't check the allowNoMatch here
if (matchingNames.isEmpty()) { if (matchingNames.isEmpty()) {
throw notFoundExceptionSupplier.apply(token); throw notFoundExceptionSupplier.apply(token);
} }