Apache Lucene open-source search software
LUCENE-9878: enable redundantNullCheck in ecjLint (#44)
Robert Muir3596e05e5cb7
diff --git a/gradle/generation/javacc.gradle b/gradle/generation/javacc.gradleindex 4b1e781a29d..1294ef2e0ea 100644--- a/gradle/generation/javacc.gradle+++ b/gradle/generation/javacc.gradle@@ -131,7 +131,7 @@ configure(project(":lucene:queryparser")) {"static final private LookaheadSuccess jj_ls =")text = text.replace("public class QueryParser ",- '@SuppressWarnings("unused") public class QueryParser ')+ '@SuppressWarnings({"unused","null"}) public class QueryParser ')text = text.replace("final public Query TopLevelQuery(","@Override final public Query TopLevelQuery(")@@ -162,7 +162,7 @@ configure(project(":lucene:queryparser")) {"new java.util.ArrayList<>")text = text.replace("public class QueryParser ",- '@SuppressWarnings("unused") public class QueryParser ')+ '@SuppressWarnings({"unused","null"}) public class QueryParser ')return text})}@@ -241,7 +241,7 @@ configure(project(":lucene:queryparser")) {"Collections.singletonList")text = text.replace("public class StandardSyntaxParser ",- '@SuppressWarnings("unused") public class StandardSyntaxParser ')+ '@SuppressWarnings({"unused","null"}) public class StandardSyntaxParser ')return text})}diff --git a/gradle/validation/ecj-lint/ecj.javadocs.prefs b/gradle/validation/ecj-lint/ecj.javadocs.prefsindex 34fb98b5415..5bdfb3fd837 100644--- a/gradle/validation/ecj-lint/ecj.javadocs.prefs+++ b/gradle/validation/ecj-lint/ecj.javadocs.prefs@@ -89,7 +89,7 @@ org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=ignore# TODO: generics-related warning that is normally enabled by defaultorg.eclipse.jdt.core.compiler.problem.rawTypeReference=ignoreorg.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=error-org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore+org.eclipse.jdt.core.compiler.problem.redundantNullCheck=errororg.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=ignoreorg.eclipse.jdt.core.compiler.problem.redundantSuperinterface=errororg.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignorediff --git a/lucene/core/src/java/org/apache/lucene/codecs/lucene90/compressing/Lucene90CompressingStoredFieldsReader.java b/lucene/core/src/java/org/apache/lucene/codecs/lucene90/compressing/Lucene90CompressingStoredFieldsReader.javaindex fb71596086d..cdb7d8e08fe 100644--- a/lucene/core/src/java/org/apache/lucene/codecs/lucene90/compressing/Lucene90CompressingStoredFieldsReader.java+++ b/lucene/core/src/java/org/apache/lucene/codecs/lucene90/compressing/Lucene90CompressingStoredFieldsReader.java@@ -180,10 +180,8 @@ public final class Lucene90CompressingStoredFieldsReader extends StoredFieldsReanumDirtyChunks = metaIn.readVLong();numDirtyDocs = metaIn.readVLong();- if (metaIn != null) {- CodecUtil.checkFooter(metaIn, null);- metaIn.close();- }+ CodecUtil.checkFooter(metaIn, null);+ metaIn.close();success = true;} catch (Throwable t) {diff --git a/lucene/core/src/java/org/apache/lucene/codecs/lucene90/compressing/Lucene90CompressingTermVectorsReader.java b/lucene/core/src/java/org/apache/lucene/codecs/lucene90/compressing/Lucene90CompressingTermVectorsReader.javaindex 7aca22b0d54..308c4ebd815 100644--- a/lucene/core/src/java/org/apache/lucene/codecs/lucene90/compressing/Lucene90CompressingTermVectorsReader.java+++ b/lucene/core/src/java/org/apache/lucene/codecs/lucene90/compressing/Lucene90CompressingTermVectorsReader.java@@ -174,10 +174,8 @@ public final class Lucene90CompressingTermVectorsReader extends TermVectorsReadethis.reader =new BlockPackedReaderIterator(vectorsStream, packedIntsVersion, PACKED_BLOCK_SIZE, 0);- if (metaIn != null) {- CodecUtil.checkFooter(metaIn, null);- metaIn.close();- }+ CodecUtil.checkFooter(metaIn, null);+ metaIn.close();success = true;} catch (Throwable t) {diff --git a/lucene/core/src/java/org/apache/lucene/geo/Tessellator.java b/lucene/core/src/java/org/apache/lucene/geo/Tessellator.javaindex 52891692d95..da084672f4e 100644--- a/lucene/core/src/java/org/apache/lucene/geo/Tessellator.java+++ b/lucene/core/src/java/org/apache/lucene/geo/Tessellator.java@@ -265,13 +265,10 @@ public final class Tessellator {if (list == list.next) {throw new IllegalArgumentException("Points are all coplanar in hole: " + holes[i]);}- // Determine if the resulting hole polygon was successful.- if (list != null) {- // Add the leftmost vertex of the hole.- Node leftMost = fetchLeftmost(list);- holeList.add(leftMost);- holeListPolygons.put(leftMost, holes[i]);- }+ // Add the leftmost vertex of the hole.+ Node leftMost = fetchLeftmost(list);+ holeList.add(leftMost);+ holeListPolygons.put(leftMost, holes[i]);nodeIndex += holes[i].numPoints();}return eliminateHoles(holeList, holeListPolygons, outerNode);diff --git a/lucene/core/src/java/org/apache/lucene/index/CheckIndex.java b/lucene/core/src/java/org/apache/lucene/index/CheckIndex.javaindex 8ce1cfefcb1..e9c4514f864 100644--- a/lucene/core/src/java/org/apache/lucene/index/CheckIndex.java+++ b/lucene/core/src/java/org/apache/lucene/index/CheckIndex.java@@ -638,7 +638,6 @@ public final class CheckIndex implements Closeable {int toLoseDocCount = info.info.maxDoc();SegmentReader reader = null;- Sort previousIndexSort = null;try {msg(infoStream, " version=" + (version == null ? "3.0" : version));@@ -652,14 +651,6 @@ public final class CheckIndex implements Closeable {Sort indexSort = info.info.getIndexSort();if (indexSort != null) {msg(infoStream, " sort=" + indexSort);- if (previousIndexSort != null) {- if (previousIndexSort.equals(indexSort) == false) {- throw new RuntimeException(- "index sort changed from " + previousIndexSort + " to " + indexSort);- }- } else {- previousIndexSort = indexSort;- }}segInfoStat.numFiles = info.files().size();segInfoStat.sizeMB = info.sizeInBytes() / (1024. * 1024.);diff --git a/lucene/core/src/java/org/apache/lucene/index/IndexWriter.java b/lucene/core/src/java/org/apache/lucene/index/IndexWriter.javaindex 9c3351c8a53..fe40fbecaea 100644--- a/lucene/core/src/java/org/apache/lucene/index/IndexWriter.java+++ b/lucene/core/src/java/org/apache/lucene/index/IndexWriter.java@@ -4241,17 +4241,13 @@ public class IndexWriter}if (infoStream.isEnabled("IW")) {- if (mergedDeletesAndUpdates == null) {- infoStream.message("IW", "no new deletes or field updates since merge started");- } else {- String msg = mergedDeletesAndUpdates.getDelCount() - numDeletesBefore + " new deletes";- if (anyDVUpdates) {- msg += " and " + mergedDeletesAndUpdates.getNumDVUpdates() + " new field updates";- msg += " (" + mergedDeletesAndUpdates.ramBytesUsed.get() + ") bytes";- }- msg += " since merge started";- infoStream.message("IW", msg);+ String msg = mergedDeletesAndUpdates.getDelCount() - numDeletesBefore + " new deletes";+ if (anyDVUpdates) {+ msg += " and " + mergedDeletesAndUpdates.getNumDVUpdates() + " new field updates";+ msg += " (" + mergedDeletesAndUpdates.ramBytesUsed.get() + ") bytes";}+ msg += " since merge started";+ infoStream.message("IW", msg);}merge.info.setBufferedDeletesGen(minGen);diff --git a/lucene/core/src/java/org/apache/lucene/index/MultiFields.java b/lucene/core/src/java/org/apache/lucene/index/MultiFields.javaindex 898cbd2081c..46de8ad8d27 100644--- a/lucene/core/src/java/org/apache/lucene/index/MultiFields.java+++ b/lucene/core/src/java/org/apache/lucene/index/MultiFields.java@@ -75,11 +75,7 @@ public final class MultiFields extends Fields {slices2.add(subSlices[i]);}}- if (subs2.size() == 0) {- result = null;- // don't cache this case with an unbounded cache, since the number of fields that don't exist- // is unbounded.- } else {+ if (subs2.size() != 0) {result =new MultiTerms(subs2.toArray(Terms.EMPTY_ARRAY), slices2.toArray(ReaderSlice.EMPTY_ARRAY));diff --git a/lucene/core/src/java/org/apache/lucene/search/PrefixQuery.java b/lucene/core/src/java/org/apache/lucene/search/PrefixQuery.javaindex c4092ee8703..4cd60235d4d 100644--- a/lucene/core/src/java/org/apache/lucene/search/PrefixQuery.java+++ b/lucene/core/src/java/org/apache/lucene/search/PrefixQuery.java@@ -33,9 +33,6 @@ public class PrefixQuery extends AutomatonQuery {// It's OK to pass unlimited maxDeterminizedStates: the automaton is born small and// determinized:super(prefix, toAutomaton(prefix.bytes()), Integer.MAX_VALUE, true);- if (prefix == null) {- throw new NullPointerException("prefix must not be null");- }}/** Build an automaton accepting all terms with the specified prefix. */diff --git a/lucene/core/src/java/org/apache/lucene/store/SleepingLockWrapper.java b/lucene/core/src/java/org/apache/lucene/store/SleepingLockWrapper.javaindex 786b4523c13..7bb7ee3756a 100644--- a/lucene/core/src/java/org/apache/lucene/store/SleepingLockWrapper.java+++ b/lucene/core/src/java/org/apache/lucene/store/SleepingLockWrapper.java@@ -95,10 +95,7 @@ public final class SleepingLockWrapper extends FilterDirectory {} while (sleepCount++ < maxSleepCount || lockWaitTimeout == LOCK_OBTAIN_WAIT_FOREVER);// we failed to obtain the lock in the required time- String reason = "Lock obtain timed out: " + this.toString();- if (failureReason != null) {- reason += ": " + failureReason;- }+ String reason = "Lock obtain timed out: " + this.toString() + ": " + failureReason;throw new LockObtainFailedException(reason, failureReason);}diff --git a/lucene/core/src/test/org/apache/lucene/index/TestDemoParallelLeafReader.java b/lucene/core/src/test/org/apache/lucene/index/TestDemoParallelLeafReader.javaindex 37b5388760a..1ff5a847471 100644--- a/lucene/core/src/test/org/apache/lucene/index/TestDemoParallelLeafReader.java+++ b/lucene/core/src/test/org/apache/lucene/index/TestDemoParallelLeafReader.java@@ -529,7 +529,6 @@ public class TestDemoParallelLeafReader extends LuceneTestCase {// closing (which makes MDW.close's// checkIndex angry):closedSegments.add(segIDGen);- parReader = null;}parReader = parLeafReader;diff --git a/lucene/core/src/test/org/apache/lucene/index/TestIndexSorting.java b/lucene/core/src/test/org/apache/lucene/index/TestIndexSorting.javaindex 4bce7cef7c6..0aba6917001 100644--- a/lucene/core/src/test/org/apache/lucene/index/TestIndexSorting.java+++ b/lucene/core/src/test/org/apache/lucene/index/TestIndexSorting.java@@ -2142,7 +2142,7 @@ public class TestIndexSorting extends LuceneTestCase {Directory dir2 = newDirectory();IndexWriterConfig iwc = new IndexWriterConfig(new MockAnalyzer(random()));- if (indexSort != null && random().nextBoolean()) {+ if (random().nextBoolean()) {// test congruent index sortiwc.setIndexSort(new Sort(new SortField("foo", SortField.Type.LONG)));} else {diff --git a/lucene/core/src/test/org/apache/lucene/search/TestPointQueries.java b/lucene/core/src/test/org/apache/lucene/search/TestPointQueries.javaindex efe218ae6b4..894635c7485 100644--- a/lucene/core/src/test/org/apache/lucene/search/TestPointQueries.java+++ b/lucene/core/src/test/org/apache/lucene/search/TestPointQueries.java@@ -552,14 +552,10 @@ public class TestPointQueries extends LuceneTestCase {+ " TO "+ upper);byte[] tmp = new byte[8];- if (lower != null) {- NumericUtils.longToSortableBytes(lower, tmp, 0);- System.out.println(" lower bytes=" + Arrays.toString(tmp));- }- if (upper != null) {- NumericUtils.longToSortableBytes(upper, tmp, 0);- System.out.println(" upper bytes=" + Arrays.toString(tmp));- }+ NumericUtils.longToSortableBytes(lower, tmp, 0);+ System.out.println(" lower bytes=" + Arrays.toString(tmp));+ NumericUtils.longToSortableBytes(upper, tmp, 0);+ System.out.println(" upper bytes=" + Arrays.toString(tmp));}if (random().nextBoolean()) {diff --git a/lucene/core/src/test/org/apache/lucene/search/TestShardSearching.java b/lucene/core/src/test/org/apache/lucene/search/TestShardSearching.javaindex 8f990e278d0..825ba829598 100644--- a/lucene/core/src/test/org/apache/lucene/search/TestShardSearching.java+++ b/lucene/core/src/test/org/apache/lucene/search/TestShardSearching.java@@ -378,14 +378,9 @@ public class TestShardSearching extends ShardSearchingTestBase {}}- int numHitsPaged;+ int numHitsPaged = hits.scoreDocs.length;if (state != null && state.searchAfterLocal != null) {- numHitsPaged = hits.scoreDocs.length;- if (state != null) {- numHitsPaged += state.numHitsPaged;- }- } else {- numHitsPaged = hits.scoreDocs.length;+ numHitsPaged += state.numHitsPaged;}final boolean moreHits;diff --git a/lucene/grouping/src/java/org/apache/lucene/search/grouping/SearchGroup.java b/lucene/grouping/src/java/org/apache/lucene/search/grouping/SearchGroup.javaindex f859e47a2f9..d3221358e17 100644--- a/lucene/grouping/src/java/org/apache/lucene/search/grouping/SearchGroup.java+++ b/lucene/grouping/src/java/org/apache/lucene/search/grouping/SearchGroup.java@@ -143,9 +143,9 @@ public class SearchGroup<T> {if (_other instanceof MergedGroup) {MergedGroup<?> other = (MergedGroup<?>) _other;if (groupValue == null) {- return other == null;+ return other.groupValue == null;} else {- return groupValue.equals(other);+ return groupValue.equals(other.groupValue);}} else {return false;diff --git a/lucene/join/src/test/org/apache/lucene/search/join/TestBlockJoin.java b/lucene/join/src/test/org/apache/lucene/search/join/TestBlockJoin.javaindex 31702d759c2..82886d35869 100644--- a/lucene/join/src/test/org/apache/lucene/search/join/TestBlockJoin.java+++ b/lucene/join/src/test/org/apache/lucene/search/join/TestBlockJoin.java@@ -855,26 +855,24 @@ public class TestBlockJoin extends LuceneTestCase {if (VERBOSE) {System.out.println("\nTEST: block join index gets "- + (joinResults == null ? 0 : joinResults.size())+ + joinResults.size()+ " groups; hitsPerGroup="+ hitsPerGroup);- if (joinResults != null) {- for (Map.Entry<Integer, TopDocs> entry : joinResults.entrySet()) {+ for (Map.Entry<Integer, TopDocs> entry : joinResults.entrySet()) {+ System.out.println(+ " group parentID=" + entry.getKey() + " (docID=" + entry.getKey() + ")");+ for (ScoreDoc childHit : entry.getValue().scoreDocs) {+ final Document doc = joinS.doc(childHit.doc);+ // System.out.println(" score=" + childHit.score + " childID=" ++ // doc.get("childID") + " (docID=" + childHit.doc + ")");System.out.println(- " group parentID=" + entry.getKey() + " (docID=" + entry.getKey() + ")");- for (ScoreDoc childHit : entry.getValue().scoreDocs) {- final Document doc = joinS.doc(childHit.doc);- // System.out.println(" score=" + childHit.score + " childID=" +- // doc.get("childID") + " (docID=" + childHit.doc + ")");- System.out.println(- " childID="- + doc.get("childID")- + " child0="- + doc.get("child0")- + " (docID="- + childHit.doc- + ")");- }+ " childID="+ + doc.get("childID")+ + " child0="+ + doc.get("child0")+ + " (docID="+ + childHit.doc+ + ")");}}}diff --git a/lucene/queryparser/src/java/org/apache/lucene/queryparser/classic/QueryParser.java b/lucene/queryparser/src/java/org/apache/lucene/queryparser/classic/QueryParser.javaindex 010f424ffda..e268add3d6e 100644--- a/lucene/queryparser/src/java/org/apache/lucene/queryparser/classic/QueryParser.java+++ b/lucene/queryparser/src/java/org/apache/lucene/queryparser/classic/QueryParser.java@@ -81,7 +81,7 @@ import org.apache.lucene.queryparser.charstream.FastCharStream;* the same syntax as this class, but is more modular,* enabling substantial customization to how a query is created.*/-@SuppressWarnings("unused") public class QueryParser extends QueryParserBase implements QueryParserConstants {+@SuppressWarnings({"unused","null"}) public class QueryParser extends QueryParserBase implements QueryParserConstants {/** The default operator for parsing queries.* Use {@link QueryParserBase#setDefaultOperator} to change it.*/diff --git a/lucene/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/parser/StandardSyntaxParser.java b/lucene/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/parser/StandardSyntaxParser.javaindex 8c4011f3e9b..8824040a8e2 100644--- a/lucene/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/parser/StandardSyntaxParser.java+++ b/lucene/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/parser/StandardSyntaxParser.java@@ -50,7 +50,7 @@ import static org.apache.lucene.queryparser.flexible.standard.parser.EscapeQuery/*** Parser for the standard Lucene syntax*/-@SuppressWarnings("unused") public class StandardSyntaxParser implements SyntaxParser, StandardSyntaxParserConstants {+@SuppressWarnings({"unused","null"}) public class StandardSyntaxParser implements SyntaxParser, StandardSyntaxParserConstants {public StandardSyntaxParser() {this(new FastCharStream(Reader.nullReader()));}diff --git a/lucene/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/processors/MultiFieldQueryNodeProcessor.java b/lucene/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/processors/MultiFieldQueryNodeProcessor.javaindex 8cd3fade139..d7a68889b6c 100644--- a/lucene/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/processors/MultiFieldQueryNodeProcessor.java+++ b/lucene/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/processors/MultiFieldQueryNodeProcessor.java@@ -81,7 +81,7 @@ public class MultiFieldQueryNodeProcessor extends QueryNodeProcessorImpl {"StandardQueryConfigHandler.ConfigurationKeys.MULTI_FIELDS should be set on the QueryConfigHandler");}- if (fields != null && fields.length > 0) {+ if (fields.length > 0) {fieldNode.setField(fields[0]);if (fields.length == 1) {diff --git a/lucene/queryparser/src/java/org/apache/lucene/queryparser/surround/parser/QueryParser.java b/lucene/queryparser/src/java/org/apache/lucene/queryparser/surround/parser/QueryParser.javaindex c90c362e7f2..9b5bddb6740 100644--- a/lucene/queryparser/src/java/org/apache/lucene/queryparser/surround/parser/QueryParser.java+++ b/lucene/queryparser/src/java/org/apache/lucene/queryparser/surround/parser/QueryParser.java@@ -46,7 +46,7 @@ import org.apache.lucene.queryparser.charstream.FastCharStream;* to two terms may appear between a and b. </p>*/-@SuppressWarnings("unused") public class QueryParser implements QueryParserConstants {+@SuppressWarnings({"unused","null"}) public class QueryParser implements QueryParserConstants {static final int MINIMUM_PREFIX_LENGTH = 3;static final int MINIMUM_CHARS_IN_TRUNC = 3;static final String TRUNCATION_ERROR_MESSAGE = "Too unrestrictive truncation: ";diff --git a/lucene/queryparser/src/java/org/apache/lucene/queryparser/surround/query/SrndTruncQuery.java b/lucene/queryparser/src/java/org/apache/lucene/queryparser/surround/query/SrndTruncQuery.javaindex ce7f19c4ce4..1422d91f251 100644--- a/lucene/queryparser/src/java/org/apache/lucene/queryparser/surround/query/SrndTruncQuery.java+++ b/lucene/queryparser/src/java/org/apache/lucene/queryparser/surround/query/SrndTruncQuery.java@@ -101,7 +101,7 @@ public class SrndTruncQuery extends SimpleTerm {}while (text != null) {- if (text != null && StringHelper.startsWith(text, prefixRef)) {+ if (StringHelper.startsWith(text, prefixRef)) {String textString = text.utf8ToString();matcher.reset(textString.substring(prefixLength));if (matcher.matches()) {diff --git a/lucene/replicator/src/test/org/apache/lucene/replicator/nrt/TestStressNRTReplication.java b/lucene/replicator/src/test/org/apache/lucene/replicator/nrt/TestStressNRTReplication.javaindex 09aaf8f3ad6..9ef0ca8fd54 100644--- a/lucene/replicator/src/test/org/apache/lucene/replicator/nrt/TestStressNRTReplication.java+++ b/lucene/replicator/src/test/org/apache/lucene/replicator/nrt/TestStressNRTReplication.java@@ -550,6 +550,7 @@ public class TestStressNRTReplication extends LuceneTestCase {/** Launches a child "server" (separate JVM), which is either primary or replica node */@SuppressForbidden(reason = "ProcessBuilder requires java.io.File for CWD")+ @SuppressWarnings("null")NodeProcess startNode(final int id, Path indexPath, boolean isPrimary, long forcePrimaryVersion)throws IOException {nodeTimeStamps[id] = System.nanoTime();diff --git a/lucene/sandbox/src/java/org/apache/lucene/sandbox/search/LatLonPointPrototypeQueries.java b/lucene/sandbox/src/java/org/apache/lucene/sandbox/search/LatLonPointPrototypeQueries.javaindex ee98488249b..1a28d47dbec 100644--- a/lucene/sandbox/src/java/org/apache/lucene/sandbox/search/LatLonPointPrototypeQueries.java+++ b/lucene/sandbox/src/java/org/apache/lucene/sandbox/search/LatLonPointPrototypeQueries.java@@ -102,11 +102,9 @@ public class LatLonPointPrototypeQueries {}totalHits += points.getDocCount();BKDReader reader = (BKDReader) points;- if (reader != null) {- readers.add(reader);- docBases.add(leaf.docBase);- liveDocs.add(leaf.reader().getLiveDocs());- }+ readers.add(reader);+ docBases.add(leaf.docBase);+ liveDocs.add(leaf.reader().getLiveDocs());}}diff --git a/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/GeoDegeneratePath.java b/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/GeoDegeneratePath.javaindex 51d81520bf6..b13bbfe50ff 100644--- a/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/GeoDegeneratePath.java+++ b/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/GeoDegeneratePath.java@@ -100,9 +100,6 @@ class GeoDegeneratePath extends GeoBasePath {for (final GeoPoint end : points) {if (lastPoint != null) {final Plane normalizedConnectingPlane = new Plane(lastPoint, end);- if (normalizedConnectingPlane == null) {- continue;- }segments.add(new PathSegment(planetModel, lastPoint, end, normalizedConnectingPlane));}lastPoint = end;diff --git a/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/GeoStandardPath.java b/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/GeoStandardPath.javaindex 227f2e73aa5..4e8521a400b 100755--- a/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/GeoStandardPath.java+++ b/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/GeoStandardPath.java@@ -119,9 +119,6 @@ class GeoStandardPath extends GeoBasePath {for (final GeoPoint end : points) {if (lastPoint != null) {final Plane normalizedConnectingPlane = new Plane(lastPoint, end);- if (normalizedConnectingPlane == null) {- continue;- }segments.add(new PathSegment(planetModel, lastPoint, end, normalizedConnectingPlane, cutoffOffset));}diff --git a/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/SidedPlane.java b/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/SidedPlane.javaindex e7fc7f01f3c..9b914b42181 100755--- a/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/SidedPlane.java+++ b/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/SidedPlane.java@@ -230,19 +230,17 @@ public class SidedPlane extends Plane implements Membership {final Vector insidePoint, final Vector point1, final Vector point2, final Vector point3) {SidedPlane rval = null;- if (rval == null) {- try {- final Vector planeNormal =- new Vector(- point1.x - point2.x,- point1.y - point2.y,- point1.z - point2.z,- point2.x - point3.x,- point2.y - point3.y,- point2.z - point3.z);- rval = new SidedPlane(insidePoint, planeNormal, -planeNormal.dotProduct(point2));- } catch (IllegalArgumentException e) {- }+ try {+ final Vector planeNormal =+ new Vector(+ point1.x - point2.x,+ point1.y - point2.y,+ point1.z - point2.z,+ point2.x - point3.x,+ point2.y - point3.y,+ point2.z - point3.z);+ rval = new SidedPlane(insidePoint, planeNormal, -planeNormal.dotProduct(point2));+ } catch (IllegalArgumentException e) {}if (rval == null) {diff --git a/lucene/test-framework/src/java/org/apache/lucene/index/BaseDocValuesFormatTestCase.java b/lucene/test-framework/src/java/org/apache/lucene/index/BaseDocValuesFormatTestCase.javaindex 860de668dcf..9bd4d323138 100644--- a/lucene/test-framework/src/java/org/apache/lucene/index/BaseDocValuesFormatTestCase.java+++ b/lucene/test-framework/src/java/org/apache/lucene/index/BaseDocValuesFormatTestCase.java@@ -2287,7 +2287,7 @@ public abstract class BaseDocValuesFormatTestCase extends BaseIndexFileFormatTesif (docValues.docID() < i) {docValues.nextDoc();}- if (docValues != null && stringValues.length > 0) {+ if (stringValues.length > 0) {assertEquals(i, docValues.docID());for (int j = 0; j < stringValues.length; j++) {assert docValues != null;diff --git a/lucene/test-framework/src/java/org/apache/lucene/store/BaseLockFactoryTestCase.java b/lucene/test-framework/src/java/org/apache/lucene/store/BaseLockFactoryTestCase.javaindex 8e482696133..993ed28bad7 100644--- a/lucene/test-framework/src/java/org/apache/lucene/store/BaseLockFactoryTestCase.java+++ b/lucene/test-framework/src/java/org/apache/lucene/store/BaseLockFactoryTestCase.java@@ -260,27 +260,25 @@ public abstract class BaseLockFactoryTestCase extends LuceneTestCase {}break;}- if (writer != null) {- try {- addDoc(writer);- } catch (Throwable t) {- hitException = true;- System.out.println(- "Stress Test Index Writer: addDoc hit unexpected exception: " + t.toString());- t.printStackTrace(System.out);- System.out.println(toString(baos));- break;- }- try {- writer.close();- } catch (Throwable t) {- hitException = true;- System.out.println(- "Stress Test Index Writer: close hit unexpected exception: " + t.toString());- t.printStackTrace(System.out);- System.out.println(toString(baos));- break;- }+ try {+ addDoc(writer);+ } catch (Throwable t) {+ hitException = true;+ System.out.println(+ "Stress Test Index Writer: addDoc hit unexpected exception: " + t.toString());+ t.printStackTrace(System.out);+ System.out.println(toString(baos));+ break;+ }+ try {+ writer.close();+ } catch (Throwable t) {+ hitException = true;+ System.out.println(+ "Stress Test Index Writer: close hit unexpected exception: " + t.toString());+ t.printStackTrace(System.out);+ System.out.println(toString(baos));+ break;}}}