Use short-circuit boolean expressions (#13042)

This commit is contained in:
sabi0 2024-01-29 09:16:40 +01:00 committed by GitHub
parent 7832d3c9fe
commit fe4631c8d2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 3 additions and 3 deletions

View File

@ -69,7 +69,7 @@ public class TestSearchWithThreads extends LuceneTestCase {
try {
long totHits = 0;
long totSearch = 0;
for (; totSearch < numSearches & !failed.get(); totSearch++) {
for (; totSearch < numSearches && !failed.get(); totSearch++) {
totHits += s.search(new TermQuery(new Term("body", "aaa")), collectorManager);
totHits += s.search(new TermQuery(new Term("body", "bbb")), collectorManager);
}

View File

@ -97,7 +97,7 @@ public class TestWeakIdentityMap extends LuceneTestCase {
for (Iterator<String> it = map.keyIterator(); it.hasNext(); ) {
assertTrue(it.hasNext()); // try again, should return same result!
final String k = it.next();
assertTrue(k == key1 || k == key2 | k == key3);
assertTrue(k == key1 || k == key2 || k == key3);
keysAssigned += (k == key1) ? 1 : ((k == key2) ? 2 : 4);
c++;
}

View File

@ -107,7 +107,7 @@ public class TestUTF32ToUTF8 extends LuceneTestCase {
code = x;
}
if ((code >= UnicodeUtil.UNI_SUR_HIGH_START && code <= UnicodeUtil.UNI_SUR_HIGH_END)
| (code >= UnicodeUtil.UNI_SUR_LOW_START && code <= UnicodeUtil.UNI_SUR_LOW_END)) {
|| (code >= UnicodeUtil.UNI_SUR_LOW_START && code <= UnicodeUtil.UNI_SUR_LOW_END)) {
iter--;
continue;
}