Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,8 @@ public Optional<BibEntry> performSearchById(String identifier) throws FetcherExc
bibtexString = URLDownload.asString(openConnection).trim();

// BibTeX entry
fetchedEntry = BibtexParser.singleFromString(bibtexString, preferences);
List<BibEntry> entries = new BibtexParser(preferences).parseEntries(bibtexString);
fetchedEntry = entries.isEmpty() ? Optional.empty() : Optional.of(entries.getFirst());
Comment on lines +152 to +153
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.

fetchedEntry.ifPresent(this::doPostCleanup);

// Crossref has a dynamic API rate limit
Expand Down
2 changes: 1 addition & 1 deletion jablib/src/main/java/org/jabref/logic/net/URLDownload.java
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ public static String asString(URLConnection existingConnection) throws FetcherEx
* @param connection an existing connection
* @return the downloaded string
*/
public static String asString(Charset encoding, URLConnection connection) throws FetcherException {
private static String asString(Charset encoding, URLConnection connection) throws FetcherException {
try (InputStream input = new BufferedInputStream(connection.getInputStream());
Writer output = new StringWriter()) {
copy(input, output, encoding);
Expand Down
Loading