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

[WIP] Fix issue no warning message #11904

Closed

Conversation

juliusalberto
Copy link
Contributor

Ref: #10121

This is a draft PR for the issue 10121. I made these changes based on the previous PR that was not merged - see #11484

I just want to have a sanity check on my approach to the issue. From what I read in the issue, the challenges are:

  • org.jabref.gui.DialogService#notify should be called at the place
  • Logger.warn(...) should be issued
  • Challange: Pass DialogService down to the class where the issue is send...

I decided to tackle this issue by:

  1. MoveFilesCleanup:
  • Collects exceptions in a list during the cleanup process.
  • Provides a getFileSystemExceptions() method to retrieve these exceptions.
  1. CleanupWorker:
  • Maintains its own list of exceptions.
  • When running cleanup jobs, it checks if the job is a MoveFilesCleanup and if so, collects its exceptions.
  • Provides a getFileSystemExceptions() method to retrieve all collected exceptions.
  1. CleanupAction:
  • After running the cleanup, it retrieves exceptions from the CleanupWorker.
  • Displays these exceptions to the user using the DialogService.

Currently this is what is showing in my screen:
image

Question:

  1. Am I doing this right or is this a bad code?
  2. Do I have to throw JabrefExtension instead of FileSystemException?

Mandatory checks

  • Change in CHANGELOG.md described in a way that is understandable for the average user (if applicable)
  • Tests created for changes (if applicable)
  • Manually tested changed features in running JabRef (always required)
  • Screenshots added in PR description (for UI changes)
  • Checked developer's documentation: Is the information available and up to date? If not, I outlined it in this pull request.
  • Checked documentation: Is the information available and up to date? If not, I created an issue at https://github.com/JabRef/user-documentation/issues or, even better, I submitted a pull request to the documentation repository.

Copy link
Contributor

@github-actions github-actions bot left a 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".

@juliusalberto juliusalberto changed the title Fix issue no warning message [WIP} Fix issue no warning message Oct 10, 2024
@juliusalberto juliusalberto changed the title [WIP} Fix issue no warning message [WIP] Fix issue no warning message Oct 10, 2024
Copy link
Member

@koppor koppor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The solution can be made more simpler: Use org.jabref.logic.util.NotificationService. Pass it down to the CleanupWorker.

Comment on lines +47 to +48
} catch (FileSystemException exception) {
fileSystemExceptions.add(exception);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not adding all IOException? They are logged below.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I made this change based on the previous PR (#11484). I also think that it's better to add all of IOException.

Thanks for the input.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Think, we overlooked that thing in the PR (because of other comments 😅).

Side thing: Don't forget to run the OpenRewrite task and check checkstyle 😅

Copy link
Contributor

@github-actions github-actions bot left a 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".

@juliusalberto juliusalberto deleted the fix-issue-no-warning-message branch October 15, 2024 02:28
@koppor
Copy link
Member

koppor commented Oct 15, 2024

@juliusalberto Does the close mean that you also want to be assigned at #10121?

@juliusalberto
Copy link
Contributor Author

juliusalberto commented Oct 16, 2024

@koppor I think I'd create a new PR that is not a draft PR (I rewrote it from the main branch because reverting the commits is too much hassle). I will reference this PR in my new one

@koppor
Copy link
Member

koppor commented Oct 16, 2024

@koppor I think I'd create a new PR that is not a draft PR (I rewrote it from the main branch because reverting the commits is too much hassle). I will reference this PR in my new one

Without a new branch, you can do follow steps to start from scratch

  1. git fetch upstream
  2. git checkout fix-issue-no-warning-message to ensure you are on the branch
  3. git reset --hard upstream/main to throw away your work
  4. git push -f to remove all commits here on github
  5. (continue working)

But nevermind. Maybe next time.

@juliusalberto
Copy link
Contributor Author

Superseded by #11987

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants