-
-
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
Implement journal abbreviation storage in separate directory (Closes #10557) #12036
Conversation
- Implement storage of journal abbreviation lists in a dedicated directory - Default directory: '%APPDATA%\..\local\org.jabref\jabref\journal-abbreviations' (Windows) - Add user preference to change the directory - Create 'custom.csv' if it doesn't exist in the specified directory - Update journal abbreviation management to use the new directory structure - Refactor related code for better maintainability and user experience - Update documentation to reflect new journal abbreviation storage method This change improves organization of journal abbreviation lists and provides a more intuitive way for users to manage custom abbreviations. It also ensures that JabRef always has a .csv file available for users to add new abbreviations.
…10557) - Add feature for changing abbreviation storage directory - Fix automatic creation and addition of custom.csv - Update description of abbreviation list management Reflects improvements in journal abbreviation handling, including new directory preferences and custom.csv file management.
- Replace Paths.get() with Path.of() for better Java 11+ compatibility - Reorganize import statements to follow project conventions - Remove unused imports - Update JournalAbbreviationPreferences to use Path.of() - Ensure consistent use of Path creation methods across the project This commit addresses issues raised by MainArchitectureTest and improves overall code quality and consistency. It also helps in maintaining a uniform coding standard throughout the project.
- Enhance null handling in constructor and setters - Implement Optional usage in getJournalAbbreviationDir method - Add null checks in updateCustomCsvFile method - Improve error logging in getDefaultAbbreviationDir - Ensure default directory is always used when input is null These changes address edge cases and potential null pointer issues, improving the overall stability of journal abbreviation handling. The modifications should resolve test failures related to NullPointerExceptions in JournalAbbreviationsViewModelTabTest.
…f#10557) Enhanced the robustness of the JournalAbbreviationPreferences class by ensuring that the getJournalAbbreviationDir method never returns null. Added null checks and improved the default directory resolution logic to handle cases where system environment variables might not be set. Also included logging to aid in debugging potential issues with directory paths. - Ensured getJournalAbbreviationDir always returns a non-null path. - Improved default path generation in getDefaultAbbreviationDir to create missing directories. - Added logs for better tracking and diagnosing issues related to path resolution.
- Add support for a single directory to store all journal abbreviation lists - Set default directory to %APPDATA%\..\local\org.jabref\jabref\journal-abbreviations - Implement user option to change directory via preferences dialog - Add automatic creation of custom.csv if it doesn't exist - Refactor JournalAbbreviationPreferences for improved robustness - Update JournalAbbreviationsTabViewModel to support new storage system - Enhance error handling and logging in journal abbreviation management - Remove unused import in JournalAbbreviationPreferences.java This commit addresses the need for a more organized and user-friendly approach to managing journal abbreviation lists. It simplifies the process for users and ensures that JabRef always has a .csv file available for adding new abbreviations. The changes improve code quality and error handling, while also fixing a Checkstyle issue related to an unused import. TODO: Implement automatic .csv to .mv file conversion and update UI to display detected lists in future enhancements.
…f#10557) - Refactor getJournalAbbreviationDir() to use Optional - Add fallback to system temp directory if default is unavailable - Enhance error logging for directory creation failures This commit improves the robustness of journal abbreviation directory handling by utilizing Optional to avoid null pointer exceptions and implementing a reliable fallback mechanism.
…f#10557) - Ensured getDefaultAbbreviationDir() never returns null by providing a robust default directory path. This fix prevents NullPointerException in unit tests where the method's output is directly converted to a string without null checks.
|
||
### Fixed | ||
|
||
- We fixed an issue where certain actions were not disabled when no libraries were open. [#11923](https://github.com/JabRef/jabref/issues/11923) | ||
|
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.
Please revert the changes with the spaces here
} | ||
|
||
public static Path getDefaultAbbreviationDir() { | ||
String appData = System.getenv("APPDATA"); |
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.
We have better methods for getting the AppDAta dir, see Directories class, please use that approach
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.
try to review
Who? The JabRef team already reviewed. After the fixes, we review again 😅 |
Closing this issue due to inactivity 💤 Please ping us if you intend to resume work on this one. |
"Closes #10557".
Description
This pull request addresses issue #10557 by implementing two features to store journal abbreviation lists in a separate directory. The main goal is to improve the organization and management of journal abbreviations in JabRef.
Changes made:
Implemented a new default directory for journal abbreviation lists:
%APPDATA%\..\local\org.jabref\jabref\journal-abbreviations
Added a preference option for users to change the journal abbreviation directory.
Implemented automatic creation of
custom.csv
in the journal abbreviation directory if it doesn't exist.Updated the relevant logic classes:
Updated related components:
Implemented automatic detection of journal lists in the specified directory:
TODO (Not implemented in this PR):
Implement automatic detection of journal lists in the specified directory:
Add logic to scan for .csv files in the directory
Prepare groundwork for future implementation of .csv to .mv store conversion
Implemented logic to ensure the directory always returns a valid path
UI Changes
We have attached three screenshots showing the updated UI for journal abbreviations in the preferences dialog:
[Attach your three screenshots here]
Testing
Request for Review Guidance
We would greatly appreciate any suggestions or guidance from the reviewers on how to effectively handle potential null values when retrieving the journal abbreviation directory path. Specifically:
Your insights on these matters would be invaluable in helping us refine our approach and ensure the reliability of this new feature.
Mandatory checks
CHANGELOG.md
described in a way that is understandable for the average user (if applicable)