-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Fix some spotbugs issues #3060
Fix some spotbugs issues #3060
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -150,8 +150,8 @@ public void openFiles(List<Path> filesToOpen, boolean raisePanel) { | |
Path file = iterator.next(); | ||
for (int i = 0; i < frame.getTabbedPane().getTabCount(); i++) { | ||
BasePanel basePanel = frame.getBasePanelAt(i); | ||
if ((basePanel.getBibDatabaseContext().getDatabaseFile().isPresent()) | ||
&& basePanel.getBibDatabaseContext().getDatabaseFile().get().equals(file)) { | ||
if ((basePanel.getBibDatabaseContext().getDatabasePath().isPresent()) | ||
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. Path equals file? 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. This was the bug I fixed |
||
&& basePanel.getBibDatabaseContext().getDatabasePath().get().equals(file)) { | ||
iterator.remove(); | ||
removed++; | ||
// See if we removed the final one. If so, we must perhaps | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -163,16 +163,22 @@ public String toString() { | |
} | ||
|
||
@Override | ||
public boolean equals(Object other) { | ||
if (this == other) { | ||
public boolean equals(Object o) { | ||
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. other is a pretty good name for the parameter imho 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. I renamed it to be consistent with the other implementations we have. |
||
if (this == o) { | ||
return true; | ||
} | ||
if (other == null || getClass() != other.getClass()) { | ||
if ((o == null) || (getClass() != o.getClass())) { | ||
return false; | ||
} | ||
|
||
CitationStyle that = (CitationStyle) other; | ||
return source != null ? source.equals(that.source) : that.source == null; | ||
CitationStyle other = (CitationStyle) o; | ||
return Objects.equals(source, other.source); | ||
} | ||
|
||
@Override | ||
public int hashCode() | ||
{ | ||
return Objects.hash(source); | ||
} | ||
|
||
} |
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.
Why synchronized 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.
Incorrect lazy initialization
https://stackoverflow.com/a/6782690/3450689
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.
Refs item 3 of effective java, doesn't it?