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

Fixed an exception when searching for unlinked files. #11731

Merged
merged 3 commits into from
Sep 8, 2024
Merged
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ Note that this project **does not** adhere to [Semantic Versioning](https://semv
- We fixed an issue where the full-text search results were incomplete. [#8626](https://github.com/JabRef/jabref/issues/8626)
- We fixed an issue where search result highlighting was incorrectly highlighting the boolean operators. [#11595](https://github.com/JabRef/jabref/issues/11595)
- We fixed an issue where search result highlighting was broken at complex searches. [#8067](https://github.com/JabRef/jabref/issues/8067)
- We fixed an exception when searching for unlinked files. [#11731](https://github.com/JabRef/jabref/issues/11731)
- We fixed an issue where two contradicting notifications were shown when cutting an entry in the main table. [#11724](https://github.com/JabRef/jabref/pull/11724)
- We fixed an issue where unescaped braces in the arXiv fetcher were not treated. [#11704](https://github.com/JabRef/jabref/issues/11704)

Expand Down
9 changes: 4 additions & 5 deletions src/main/java/org/jabref/gui/util/FileNodeViewModel.java
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public static String formatDateTime(FileTime fileTime) {
*/
public String getDisplayText() {
if (path.toFile().isDirectory()) {
return "%s (%s %s)".formatted(path.getFileName(), Localization.lang("%0 file(s)", fileCount));
return "%s (%s)".formatted(path.getFileName(), Localization.lang("%0 file(s)", fileCount));
}
return path.getFileName().toString();
}
Expand All @@ -75,15 +75,15 @@ public String getDisplayText() {
*/
public String getDisplayTextWithEditDate() {
if (path.toFile().isDirectory()) {
return "%s (%s %s)".formatted(path.getFileName(), Localization.lang("%0 file(s)", fileCount));
return "%s (%s)".formatted(path.getFileName(), Localization.lang("%0 file(s)", fileCount));
}
FileTime lastEditedTime = null;
try {
lastEditedTime = Files.getLastModifiedTime(path);
} catch (IOException e) {
LOGGER.error("Could not get last modified time", e);
}
return "%s (%s: %s)".formatted(path.getFileName().toString(), Localization.lang("last edited"), formatDateTime(lastEditedTime));
return "%s (%s: %s)".formatted(path.getFileName(), Localization.lang("last edited"), formatDateTime(lastEditedTime));
}

@Override
Expand All @@ -104,10 +104,9 @@ public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (!(obj instanceof FileNodeViewModel)) {
if (!(obj instanceof FileNodeViewModel other)) {
return false;
}
FileNodeViewModel other = (FileNodeViewModel) obj;
return Objects.equals(children, other.children) && (fileCount == other.fileCount) && Objects.equals(path, other.path);
}
}
Loading