-
Notifications
You must be signed in to change notification settings - Fork 25.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove some dead code #31993
Merged
Merged
Remove some dead code #31993
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,7 +18,6 @@ | |
*/ | ||
package org.elasticsearch.common.geo.parsers; | ||
|
||
import org.locationtech.jts.geom.Coordinate; | ||
import org.elasticsearch.ElasticsearchParseException; | ||
import org.elasticsearch.common.Explicit; | ||
import org.elasticsearch.common.geo.GeoPoint; | ||
|
@@ -29,6 +28,7 @@ | |
import org.elasticsearch.common.unit.DistanceUnit; | ||
import org.elasticsearch.common.xcontent.XContentParser; | ||
import org.elasticsearch.index.mapper.GeoShapeFieldMapper; | ||
import org.locationtech.jts.geom.Coordinate; | ||
|
||
import java.io.IOException; | ||
import java.util.ArrayList; | ||
|
@@ -130,10 +130,6 @@ protected static ShapeBuilder parse(XContentParser parser, GeoShapeFieldMapper s | |
CircleBuilder.TYPE); | ||
} | ||
|
||
if (shapeType == null) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. reason: shapeType is tested for null earlier, throws exception already there |
||
throw new ElasticsearchParseException("shape type [{}] not included", shapeType); | ||
} | ||
|
||
if (shapeType.equals(GeoShapeType.GEOMETRYCOLLECTION)) { | ||
return geometryCollections; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1554,11 +1554,8 @@ public void restore() throws IOException { | |
filesToRecover.add(fileInfo); | ||
recoveryState.getIndex().addFileDetail(fileInfo.name(), fileInfo.length(), false); | ||
if (logger.isTraceEnabled()) { | ||
if (md == null) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. reason: |
||
logger.trace("[{}] [{}] recovering [{}] from [{}], does not exists in local store", shardId, snapshotId, fileInfo.physicalName(), fileInfo.name()); | ||
} else { | ||
logger.trace("[{}] [{}] recovering [{}] from [{}], exists in local store but is different", shardId, snapshotId, fileInfo.physicalName(), fileInfo.name()); | ||
} | ||
logger.trace("[{}] [{}] recovering [{}] from [{}], exists in local store but is different", shardId, snapshotId, | ||
fileInfo.physicalName(), fileInfo.name()); | ||
} | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
reason:
node
is used before, cannot be null hereThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if that use is actually a bug....
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point. That use is
nodeId = node.getId()
in the line above. If this use shouldn't be there, how would we get the nodeId for the NoSuchNodeException that is thrown right in this block?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bleskes maybe you are familiar enough with this code to be able to judge whether node can be null here at all? From what I see so far, the nodes array is retrieved earlier in the method through
request.concreteNodes()
. Following the call hierarchy it is unlikely this can contain null references, but I don't think it is enforced anywhere. Then again, the reference in L179 hasn't led to NPEs since at least mid-2016 when it was added, so maybe its save to assumenode
cannot be null here.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 remove the
node == null
check. IMO if we pass a null in there it's bug higher up in the chain which we should learn about and fix where it came from.