Skip to content

Use getResourceAsStream for JStyle reload#13080

Merged
koppor merged 4 commits into
JabRef:mainfrom
subhramit:jstyl-reload
May 9, 2025
Merged

Use getResourceAsStream for JStyle reload#13080
koppor merged 4 commits into
JabRef:mainfrom
subhramit:jstyl-reload

Conversation

@subhramit

@subhramit subhramit commented May 8, 2025

Copy link
Copy Markdown
Member

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
Copy Markdown

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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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.

@trag-bot

trag-bot Bot commented May 9, 2025

Copy link
Copy Markdown

@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