Skip to content

Conversation

@vivek1833
Copy link

Issue

Fixes #14089

Changes

This PR refactors DoiFetcher.performSearchById to use BibtexParser.parseEntries() instead of BibtexParser.singleFromString() and makes the asString(Charset, URLConnection) method private in URLDownload.

Changes Made:

  1. DoiFetcher.java:

    • Updated performSearchById() to use BibtexParser.parseEntries() instead of singleFromString()
  2. URLDownload.java:

    • Made asString(Charset encoding, URLConnection connection) method private

Testing:

  • Code compiles successfully
  • Existing functionality preserved

Mandatory checks

Comment on lines +152 to +153
List<BibEntry> entries = new BibtexParser(preferences).parseEntries(bibtexString);
fetchedEntry = entries.isEmpty() ? Optional.empty() : Optional.of(entries.getFirst());
Copy link
Member

Choose a reason for hiding this comment

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

There is no URLconnection passed - please use org.jabref.logic.importer.fileformat.BibtexParser#parseEntries

Copy link
Author

Choose a reason for hiding this comment

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

Thanks for the review. The BibtexParser class implements the Parser interface, which provides parseEntries(String) as a default method that internally converts the String to an InputStream and calls the parseEntries(InputStream) method that BibtexParser implements. There is no parseEntries(URLConnection) method available in our API. This change replaces the static singleFromString call with the BibtexParser#parseEntries.

Copy link
Member

Choose a reason for hiding this comment

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

I made a typo and meant "stream". Could be seen at the issue description, but maybe for a newcomer, this is too hard to understand.

@github-actions github-actions bot added the status: changes-required Pull requests that are not yet complete label Nov 19, 2025
@koppor
Copy link
Member

koppor commented Nov 21, 2025

To be able to properly guide, I started to work on the issue for myself. The issue was a bit larger than I thought. And finally, I solved it for myself at #14384.

Please search for another issue.

@koppor koppor closed this Nov 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status: changes-required Pull requests that are not yet complete

Projects

None yet

Development

Successfully merging this pull request may close these issues.

URLDownload should include httpResponse in exception

2 participants