Skip to content

Commit

Permalink
Use Objects.equals() instead of == to compare strings (#77840) (#77867)
Browse files Browse the repository at this point in the history
Co-authored-by: skyguard1 <qhdxssm@qq.com>
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
  • Loading branch information
3 people authored Sep 16, 2021
1 parent 43cbbc8 commit 8f6e263
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 8f6e263

Please sign in to comment.