Skip to content

Commit 8d18c4f

Browse files
author
Christoph Büscher
committed
Merged two validation clauses
1 parent 3184eea commit 8d18c4f

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

src/main/java/org/elasticsearch/index/query/TermQueryBuilder.java

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -216,11 +216,8 @@ public Query toQuery(QueryParseContext parseContext) {
216216
@Override
217217
public ActionRequestValidationException validate() {
218218
ActionRequestValidationException validationException = null;
219-
if (this.fieldName == null) {
220-
validationException = ValidateActions.addValidationError("field name cannot be null.", validationException);
221-
}
222-
if (this.fieldName != null && this.fieldName.isEmpty()) {
223-
validationException = ValidateActions.addValidationError("field name cannot be empty.", validationException);
219+
if (this.fieldName == null || this.fieldName.isEmpty()) {
220+
validationException = ValidateActions.addValidationError("field name cannot be null or empty.", validationException);
224221
}
225222
if (this.value == null) {
226223
validationException = ValidateActions.addValidationError("value cannot be null.", validationException);

0 commit comments

Comments
 (0)