Skip to content

Use getResourceAsStream for JStyle reload #13080

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

Merged
merged 4 commits into from
May 9, 2025
Merged

Conversation

subhramit
Copy link
Member

@subhramit subhramit commented May 8, 2025

Follow-up to #13075
Addresses #13075 (comment)
Refs. JabRef#693, #13073

Mandatory checks

  • I own the copyright of the code submitted and I license it under the MIT license
  • [/] Change in CHANGELOG.md described in a way that is understandable for the average user (if change is visible to the user)
  • [/] Tests created for changes (if applicable)
  • Manually tested changed features in running JabRef (always required)
  • [/] Screenshots added in PR description (if change is visible to the user)
  • 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.

Signed-off-by: subhramit <subhramit.bb@live.in>
URL resUrl = JStyle.class.getResource(path);
if (resUrl != null) {
try (InputStream stream = resUrl.openStream()) {
try (InputStream stream = JStyle.class.getResourceAsStream(path)) {
Copy link

Choose a reason for hiding this comment

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

The try block covers multiple statements, which is against the guideline to cover as few statements as possible. This can make exception handling less precise.

Copy link
Member

Choose a reason for hiding this comment

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

Maybe a small comment, why styleFile is not used here, but path.

The two variables should be put togehter at the declaration above in this file maybe? Maybe, there could be comments added to each variable.

Copy link
Member

Choose a reason for hiding this comment

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

needs to support both internal and extenral style files

Copy link
Member Author

Choose a reason for hiding this comment

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

The two variables should be put togehter at the declaration above in this file maybe?

Class level variables, used at different places.

Maybe, there could be comments added to each variable.

Done. field-level javadoc should appear on hover.

Copy link

trag-bot bot commented May 9, 2025

@trag-bot didn't find any issues in the code! ✅✨

@koppor koppor enabled auto-merge May 9, 2025 08:04
@koppor koppor added this pull request to the merge queue May 9, 2025
Merged via the queue into JabRef:main with commit 02ec5b8 May 9, 2025
1 check passed
@koppor koppor deleted the jstyl-reload branch May 9, 2025 08:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants