-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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 issue no warning message for moving attached files #11987
Conversation
# Conflicts: # src/main/resources/l10n/JabRef_en.properties
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.
Your code currently does not meet JabRef's code guidelines.
We use OpenRewrite to ensure "modern" Java coding practices.
The issues found can be automatically fixed.
Please execute the gradle task rewriteRun
, check the results, commit, and push.
You can check the detailed error output by navigating to your pull request, selecting the tab "Checks", section "Tests" (on the left), subsection "OpenRewrite".
Hi @koppor (sorry if I mentioned you in the wrong place) - do you think this is already in line with the suggestion you wrote here: #11904 (review) ? |
|
||
private void showFileMoveExceptions(BibEntry entry) { | ||
StringBuilder sb = new StringBuilder(); | ||
String title = entry.getTitle().orElse(Localization.lang("Unknown Title")); |
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.
Normally we use the citaton key. You can use org.jabref.model.entry.BibEntry#getAuthorTitleYear(int)
with 40
as maxCharacters
as fallbeack.
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.
I deleted the citation key part as I think it'd be difficult passing both the entry and the exceptions from org.jabref.logic.cleanup.CleanupWorker
to org.jabref.gui.cleanup.CleanupAction
(I will have to create a wrapper to put the entry and its corresponding exceptions)
@@ -86,4 +103,17 @@ private CleanupJob toJob(CleanupPreferences.CleanupStep action) { | |||
throw new UnsupportedOperationException(action.name()); | |||
}; | |||
} | |||
|
|||
private void showFileMoveExceptions(BibEntry entry) { |
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.
This is too early.
Do following:
- Add method
resetCleanUpFailures()
toCleanupWorker
- Add field `List failures to CleanupWorker
- Add method
getFailures()
to CleanupWorker - Modify
org.jabref.gui.cleanup.CleanupAction#cleanup
to firstresetCleanUpFailures
, then iterate through the entries and then show the errors
While you are in resetCleanUpFailures
, move the NamedCompund
generation and ending outside of the loop - the cleanup of entries is a batch and should not be split.
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.
I am not sure why the resetCleanUpFailures()
should be added to CleanupWorker
when every time org.jabref.gui.cleanup.CleanupAction#doCleanup
is called, the program will create a new CleanupWorker
(and thus a new empty list of exceptions).
I assume that you meant to put the resetCleanupFailures
in the org.jabref.gui.cleanup.CleanupAction
, so the cleanupAction
will store a list of exceptions.
Thank you for asking! We usually look into WIP PRs only if we are asked for. If you want to have reviews, ping us (as you did), change the PR state to "ready for review", or request review from someone using GitHubs functionality on the top right. |
Supersedes PR #11904
Closes #10121
Based on the feedback given on the above PR, I have introduced these changes:
org.jabref.logic.cleanup.MoveFilesCleanup
, I collected a list of exceptions for each entry. These list of exceptions will then be stored byCleanupWorker
. The CleanupAction will store every exceptions caused by IO errors, and will show it usingorg.jabref.gui.DialogService#showErrorDialogAndWait
Additional question: Should I create the tests as well?
Mandatory checks
CHANGELOG.md
described in a way that is understandable for the average user (if applicable)