Skip to content
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

Removed a potential NPE in hashCode method to CrawlURI which was fata… #488

Merged
merged 1 commit into from
Jun 8, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions modules/src/main/java/org/archive/modules/CrawlURI.java
Original file line number Diff line number Diff line change
Expand Up @@ -1835,8 +1835,11 @@ public int compareTo(CrawlURI o) {
@Override
public int hashCode() {
int r = 37;
return r ^ hash(via.toString()) ^ hash(uuri.toString())
^ hash(viaContext.toString()) ^ hash(pathFromSeed.toString());
String viaString = (via == null) ? "" : via.toString();
String viaContextString = (viaContext == null) ? "" : viaContext.toString();
String pathFromSeedString = (pathFromSeed == null) ? "" : pathFromSeed.toString();
return r ^ hash(viaString) ^ hash(uuri.toString())
^ hash(viaContextString) ^ hash(pathFromSeedString);
}

// handles nulls
Expand Down