Skip to content

Commit 0ee6ab6

Browse files
ebuildyjbaiera
authored andcommitted
Throw clean exception if query is not well formed (elastic#866)
1 parent 3676ce0 commit 0ee6ab6

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

mr/src/main/java/org/elasticsearch/hadoop/rest/query/QueryUtils.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@ public static QueryBuilder parseQuery(Settings settings) {
4242
try {
4343
// must be a resource
4444
InputStream in = settings.loadResource(query);
45+
if (in == null) {
46+
throw new IOException();
47+
}
4548
query = IOUtils.asString(in);
4649
} catch (IOException ex) {
4750
throw new EsHadoopIllegalArgumentException(
@@ -117,4 +120,4 @@ public static boolean isExplicitlyRequested(String candidate, String... indices)
117120
}
118121
return result;
119122
}
120-
}
123+
}

0 commit comments

Comments
 (0)