Skip to content

Commit

Permalink
Use Objects.equals() instead of == to compare strings (elastic#77840)
Browse files Browse the repository at this point in the history
  • Loading branch information
skyguard1 authored and Christoph Buescher committed Sep 16, 2021
1 parent fe5da7e commit 78fc7fe
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public void add(Term[] terms) {
*/
public void add(Term[] terms, int position) {
for (int i = 0; i < terms.length; i++) {
if (terms[i].field() != field) {
if (Objects.equals(terms[i].field(), field) == false) {
throw new IllegalArgumentException(
"All phrase terms must be in the same field (" + field + "): "
+ terms[i]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -710,7 +710,7 @@ private static Map<String, InvalidMappedField> getInvalidFieldsForAliases(String
// iterate over each type
for (Entry<String, FieldCapabilities> type : types.entrySet()) {
String esFieldType = type.getKey();
if (esFieldType == UNMAPPED) {
if (Objects.equals(esFieldType, UNMAPPED)) {
continue;
}
String[] indices = type.getValue().indices();
Expand Down Expand Up @@ -749,7 +749,7 @@ private static Map<String, InvalidMappedField> getInvalidFieldsForAliases(String
} else {
// if the field type is the same across all this alias' indices, check the field's capabilities (searchable/aggregatable)
for (Entry<String, FieldCapabilities> type : types.entrySet()) {
if (type.getKey() == UNMAPPED) {
if (Objects.equals(type.getKey(), UNMAPPED)) {
continue;
}
FieldCapabilities f = type.getValue();
Expand Down

0 comments on commit 78fc7fe

Please sign in to comment.