Skip to content

Commit

Permalink
Fixed an exception when searching for unlinked files. (#11731)
Browse files Browse the repository at this point in the history
* Fixed an exception when searching for unlinked files.

Co-authored-by: Christoph <siedlerkiller@gmail.com>

* Update CHANGELOG.md

---------

Co-authored-by: Christoph <siedlerkiller@gmail.com>
  • Loading branch information
koppor and Siedlerchr committed Sep 8, 2024
1 parent 28164eb commit 3df3b4f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
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);
}
}

0 comments on commit 3df3b4f

Please sign in to comment.