Skip to content

Feature/url based fetcher#15458

Closed
Sudeep-A-Kulkarni wants to merge 75 commits intoJabRef:mainfrom
Sudeep-A-Kulkarni:feature/url-based-fetcher
Closed

Feature/url based fetcher#15458
Sudeep-A-Kulkarni wants to merge 75 commits intoJabRef:mainfrom
Sudeep-A-Kulkarni:feature/url-based-fetcher

Conversation

@Sudeep-A-Kulkarni
Copy link
Copy Markdown

Related issues and pull requests

Closes #15411

PR Description

  1. I have added support for adding new entries using URL in the "Add Entry Section". It allows user to add a @misc BibTeX entry with the URL populated field.
  2. Using this Users can create Bibliographical entries using URL which improves the workflow for citing web resources.

Steps to test

  1. Open JabRef
  2. Go to Library → New Entry
  3. Click "Enter URL" tab
  4. Enter: https://www.semanticscholar.org/paper/Logic-LangChain%3A-Translating-Natural-Language-to-Lalwani-Lunawat/2ad8dbc163ce289e23e9c02b324c82d9c2fe8190
  5. Click Search
  6. Verify a @misc entry is created with the URL field set

Checklist

  • I own the copyright of the code submitted and I license it under the MIT license
  • I manually tested my changes in running JabRef (always required)
  • I added JUnit tests for changes (if applicable)
  • I added screenshots in the PR description (if change is visible to the user)
  • I added a screenshot in the PR description showing a library with a single entry with me as author and as title the issue number
  • I described the change in CHANGELOG.md in a way that can be understood by the average user (if change is visible to the user)
  • I checked the user documentation for up to dateness and submitted a pull request to our user documentation repository

Screenshot - Enter URL Tab

image image

@github-actions github-actions bot added status: changes-required Pull requests that are not yet complete good first issue An issue intended for project-newcomers. Varies in difficulty. component: fetcher labels Mar 30, 2026
@Sudeep-A-Kulkarni Sudeep-A-Kulkarni changed the title Feature/url based fetcher Feature/url based fetcher#15411 Mar 30, 2026
@testlens-app

This comment has been minimized.

@Siedlerchr
Copy link
Copy Markdown
Member

please avoid closing and reopening prs or creating different ones for the same ones as this creates noise

@testlens-app

This comment has been minimized.

@Sudeep-A-Kulkarni Sudeep-A-Kulkarni marked this pull request as ready for review March 30, 2026 20:03
@qodo-free-for-open-source-projects

This comment was marked as resolved.

@qodo-free-for-open-source-projects
Copy link
Copy Markdown
Contributor

qodo-free-for-open-source-projects bot commented Mar 30, 2026

Code Review by Qodo

🐞 Bugs (0)   📘 Rule violations (18)   📎 Requirement gaps (0)   🎨 UX Issues (0)
📘\ ≡ Correctness (2) ⚙ Maintainability (16)

Grey Divider


Action required

1. Collections.emptyList() used in fetcher📘
Description
The new GenericUrlBasedFetcher returns empty/singleton lists using legacy Collections.*
factories instead of modern immutable collection factories. This violates the project preference for
List.of(...) for small immutable results.
Code

jablib/src/main/java/org/jabref/logic/importer/fetcher/GenericUrlBasedFetcher.java[R18-35]

+        if (StringUtil.isBlank(url)) {
+            return Collections.emptyList();
+        }
+
+        String normalizedUrl = url.trim();
+        if (!normalizedUrl.toLowerCase().startsWith("http://") && !normalizedUrl.toLowerCase().startsWith("https://")) {
+            normalizedUrl = "https://" + normalizedUrl;
+        }
+
+        if (!URLUtil.isValidHttpUrl(normalizedUrl)) {
+            throw new FetcherException("Invalid URL: " + normalizedUrl);
+        }
+
+        // Create a new @Misc entry and set the URL field
+        BibEntry entry = new BibEntry(StandardEntryType.Misc);
+        entry.setField(StandardField.URL, normalizedUrl);
+
+        return Collections.singletonList(entry);
Evidence
PR Compliance ID 2 forbids introducing legacy collection construction patterns such as
Collections.emptyList(...). The new code returns Collections.emptyList() and
Collections.singletonList(entry) in fetchEntryFromUrl.

AGENTS.md
jablib/src/main/java/org/jabref/logic/importer/fetcher/GenericUrlBasedFetcher.java[18-20]
jablib/src/main/java/org/jabref/logic/importer/fetcher/GenericUrlBasedFetcher.java[35-35]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`GenericUrlBasedFetcher` uses `Collections.emptyList()` / `Collections.singletonList(...)` instead of modern immutable factories.
## Issue Context
The project prefers modern Java collection factories for small immutable collections.
## Fix Focus Areas
- jablib/src/main/java/org/jabref/logic/importer/fetcher/GenericUrlBasedFetcher.java[18-20]
- jablib/src/main/java/org/jabref/logic/importer/fetcher/GenericUrlBasedFetcher.java[35-35]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


2. Uses setField on BibEntry 📘
Description
The new URL-based fetcher mutates a BibEntry via setField instead of using JabRef’s fluent
withField style. This reduces consistency with the preferred immutable-ish conventions.
Code

jablib/src/main/java/org/jabref/logic/importer/fetcher/GenericUrlBasedFetcher.java[R32-34]

+        BibEntry entry = new BibEntry(StandardEntryType.Misc);
+        entry.setField(StandardField.URL, normalizedUrl);
+
Evidence
PR Compliance ID 29 requires using withField instead of setField when creating/configuring
BibEntry instances. The new code calls entry.setField(StandardField.URL, normalizedUrl).

AGENTS.md
jablib/src/main/java/org/jabref/logic/importer/fetcher/GenericUrlBasedFetcher.java[32-34]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`GenericUrlBasedFetcher` uses `BibEntry#setField` for field assignment.
## Issue Context
JabRef prefers the `withField(...)` wither style for `BibEntry` creation/modification.
## Fix Focus Areas
- jablib/src/main/java/org/jabref/logic/importer/fetcher/GenericUrlBasedFetcher.java[32-34]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


3. Collections.emptyList() used in fetcher📘
Description
The new GenericUrlBasedFetcher returns empty/singleton lists using legacy Collections.*
factories instead of modern immutable collection factories. This violates the project preference for
List.of(...) for small immutable results.
Code

jablib/src/main/java/org/jabref/logic/importer/fetcher/GenericUrlBasedFetcher.java[R18-35]

+        if (StringUtil.isBlank(url)) {
+            return Collections.emptyList();
+        }
+
+        String normalizedUrl = url.trim();
+        if (!normalizedUrl.toLowerCase().startsWith("http://") && !normalizedUrl.toLowerCase().startsWith("https://")) {
+            normalizedUrl = "https://" + normalizedUrl;
+        }
+
+        if (!URLUtil.isValidHttpUrl(normalizedUrl)) {
+            throw new FetcherException("Invalid URL: " + normalizedUrl);
+        }
+
+        // Create a new @Misc entry and set the URL field
+        BibEntry entry = new BibEntry(StandardEntryType.Misc);
+        entry.setField(StandardField.URL, normalizedUrl);
+
+        return Collections.singletonList(entry);
Evidence
PR Compliance ID 2 forbids introducing legacy collection construction patterns such as
Collections.emptyList(...). The new code returns Collections.emptyList() and
Collections.singletonList(entry) in fetchEntryFromUrl.

AGENTS.md
jablib/src/main/java/org/jabref/logic/importer/fetcher/GenericUrlBasedFetcher.java[18-20]
jablib/src/main/java/org/jabref/logic/importer/fetcher/GenericUrlBasedFetcher.java[35-35]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`GenericUrlBasedFetcher` uses `Collections.emptyList()` / `Collections.singletonList(...)` instead of modern immutable factories.
## Issue Context
The project prefers modern Java collection factories for small immutable collections.
## Fix Focus Areas
- jablib/src/main/java/org/jabref/logic/importer/fetcher/GenericUrlBasedFetcher.java[18-20]
- jablib/src/main/java/org/jabref/logic/importer/fetcher/GenericUrlBasedFetcher.java[35-35]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


View more (26)
4. Uses setField on BibEntry 📘
Description
The new URL-based fetcher mutates a BibEntry via setField instead of using JabRef’s fluent
withField style. This reduces consistency with the preferred immutable-ish conventions.
Code

jablib/src/main/java/org/jabref/logic/importer/fetcher/GenericUrlBasedFetcher.java[R32-34]

+        BibEntry entry = new BibEntry(StandardEntryType.Misc);
+        entry.setField(StandardField.URL, normalizedUrl);
+
Evidence
PR Compliance ID 29 requires using withField instead of setField when creating/configuring
BibEntry instances. The new code calls entry.setField(StandardField.URL, normalizedUrl).

AGENTS.md
jablib/src/main/java/org/jabref/logic/importer/fetcher/GenericUrlBasedFetcher.java[32-34]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`GenericUrlBasedFetcher` uses `BibEntry#setField` for field assignment.
## Issue Context
JabRef prefers the `withField(...)` wither style for `BibEntry` creation/modification.
## Fix Focus Areas
- jablib/src/main/java/org/jabref/logic/importer/fetcher/GenericUrlBasedFetcher.java[32-34]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


5. Collections.emptyList() used in fetcher📘
Description
The new GenericUrlBasedFetcher returns empty/singleton lists using legacy Collections.*
factories instead of modern immutable collection factories. This violates the project preference for
List.of(...) for small immutable results.
Code

jablib/src/main/java/org/jabref/logic/importer/fetcher/GenericUrlBasedFetcher.java[R18-35]

+        if (StringUtil.isBlank(url)) {
+            return Collections.emptyList();
+        }
+
+        String normalizedUrl = url.trim();
+        if (!normalizedUrl.toLowerCase().startsWith("http://") && !normalizedUrl.toLowerCase().startsWith("https://")) {
+            normalizedUrl = "https://" + normalizedUrl;
+        }
+
+        if (!URLUtil.isValidHttpUrl(normalizedUrl)) {
+            throw new FetcherException("Invalid URL: " + normalizedUrl);
+        }
+
+        // Create a new @Misc entry and set the URL field
+        BibEntry entry = new BibEntry(StandardEntryType.Misc);
+        entry.setField(StandardField.URL, normalizedUrl);
+
+        return Collections.singletonList(entry);
Evidence
PR Compliance ID 2 forbids introducing legacy collection construction patterns such as
Collections.emptyList(...). The new code returns Collections.emptyList() and
Collections.singletonList(entry) in fetchEntryFromUrl.

AGENTS.md
jablib/src/main/java/org/jabref/logic/importer/fetcher/GenericUrlBasedFetcher.java[18-20]
jablib/src/main/java/org/jabref/logic/importer/fetcher/GenericUrlBasedFetcher.java[35-35]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`GenericUrlBasedFetcher` uses `Collections.emptyList()` / `Collections.singletonList(...)` instead of modern immutable factories.
## Issue Context
The project prefers modern Java collection factories for small immutable collections.
## Fix Focus Areas
- jablib/src/main/java/org/jabref/logic/importer/fetcher/GenericUrlBasedFetcher.java[18-20]
- jablib/src/main/java/org/jabref/logic/importer/fetcher/GenericUrlBasedFetcher.java[35-35]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


6. Uses setField on BibEntry 📘
Description
The new URL-based fetcher mutates a BibEntry via setField instead of using JabRef’s fluent
withField style. This reduces consistency with the preferred immutable-ish conventions.
Code

jablib/src/main/java/org/jabref/logic/importer/fetcher/GenericUrlBasedFetcher.java[R32-34]

+        BibEntry entry = new BibEntry(StandardEntryType.Misc);
+        entry.setField(StandardField.URL, normalizedUrl);
+
Evidence
PR Compliance ID 29 requires using withField instead of setField when creating/configuring
BibEntry instances. The new code calls entry.setField(StandardField.URL, normalizedUrl).

AGENTS.md
jablib/src/main/java/org/jabref/logic/importer/fetcher/GenericUrlBasedFetcher.java[32-34]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`GenericUrlBasedFetcher` uses `BibEntry#setField` for field assignment.
## Issue Context
JabRef prefers the `withField(...)` wither style for `BibEntry` creation/modification.
## Fix Focus Areas
- jablib/src/main/java/org/jabref/logic/importer/fetcher/GenericUrlBasedFetcher.java[32-34]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


7. Collections.emptyList() used in fetcher📘
Description
The new GenericUrlBasedFetcher returns empty/singleton lists using legacy Collections.*
factories instead of modern immutable collection factories. This violates the project preference for
List.of(...) for small immutable results.
Code

jablib/src/main/java/org/jabref/logic/importer/fetcher/GenericUrlBasedFetcher.java[R18-35]

+        if (StringUtil.isBlank(url)) {
+            return Collections.emptyList();
+        }
+
+        String normalizedUrl = url.trim();
+        if (!normalizedUrl.toLowerCase().startsWith("http://") && !normalizedUrl.toLowerCase().startsWith("https://")) {
+            normalizedUrl = "https://" + normalizedUrl;
+        }
+
+        if (!URLUtil.isValidHttpUrl(normalizedUrl)) {
+            throw new FetcherException("Invalid URL: " + normalizedUrl);
+        }
+
+        // Create a new @Misc entry and set the URL field
+        BibEntry entry = new BibEntry(StandardEntryType.Misc);
+        entry.setField(StandardField.URL, normalizedUrl);
+
+        return Collections.singletonList(entry);
Evidence
PR Compliance ID 2 forbids introducing legacy collection construction patterns such as
Collections.emptyList(...). The new code returns Collections.emptyList() and
Collections.singletonList(entry) in fetchEntryFromUrl.

AGENTS.md
jablib/src/main/java/org/jabref/logic/importer/fetcher/GenericUrlBasedFetcher.java[18-20]
jablib/src/main/java/org/jabref/logic/importer/fetcher/GenericUrlBasedFetcher.java[35-35]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`GenericUrlBasedFetcher` uses `Collections.emptyList()` / `Collections.singletonList(...)` instead of modern immutable factories.
## Issue Context
The project prefers modern Java collection factories for small immutable collections.
## Fix Focus Areas
- jablib/src/main/java/org/jabref/logic/importer/fetcher/GenericUrlBasedFetcher.java[18-20]
- jablib/src/main/java/org/jabref/logic/importer/fetcher/GenericUrlBasedFetcher.java[35-35]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


8. Uses setField on BibEntry 📘
Description
The new URL-based fetcher mutates a BibEntry via setField instead of using JabRef’s fluent
withField style. This reduces consistency with the preferred immutable-ish conventions.
Code

jablib/src/main/java/org/jabref/logic/importer/fetcher/GenericUrlBasedFetcher.java[R32-34]

+        BibEntry entry = new BibEntry(StandardEntryType.Misc);
+        entry.setField(StandardField.URL, normalizedUrl);
+
Evidence
PR Compliance ID 29 requires using withField instead of setField when creating/configuring
BibEntry instances. The new code calls entry.setField(StandardField.URL, normalizedUrl).

AGENTS.md
jablib/src/main/java/org/jabref/logic/importer/fetcher/GenericUrlBasedFetcher.java[32-34]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`GenericUrlBasedFetcher` uses `BibEntry#setField` for field assignment.
## Issue Context
JabRef prefers the `withField(...)` wither style for `BibEntry` creation/modification.
## Fix Focus Areas
- jablib/src/main/java/org/jabref/logic/importer/fetcher/GenericUrlBasedFetcher.java[32-34]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


9. Collections.emptyList() used in fetcher📘
Description
The new GenericUrlBasedFetcher returns empty/singleton lists using legacy Collections.*
factories instead of modern immutable collection factories. This violates the project preference for
List.of(...) for small immutable results.
Code

jablib/src/main/java/org/jabref/logic/importer/fetcher/GenericUrlBasedFetcher.java[R18-35]

+        if (StringUtil.isBlank(url)) {
+            return Collections.emptyList();
+        }
+
+        String normalizedUrl = url.trim();
+        if (!normalizedUrl.toLowerCase().startsWith("http://") && !normalizedUrl.toLowerCase().startsWith("https://")) {
+            normalizedUrl = "https://" + normalizedUrl;
+        }
+
+        if (!URLUtil.isValidHttpUrl(normalizedUrl)) {
+            throw new FetcherException("Invalid URL: " + normalizedUrl);
+        }
+
+        // Create a new @Misc entry and set the URL field
+        BibEntry entry = new BibEntry(StandardEntryType.Misc);
+        entry.setField(StandardField.URL, normalizedUrl);
+
+        return Collections.singletonList(entry);
Evidence
PR Compliance ID 2 forbids introducing legacy collection construction patterns such as
Collections.emptyList(...). The new code returns Collections.emptyList() and
Collections.singletonList(entry) in fetchEntryFromUrl.

AGENTS.md
jablib/src/main/java/org/jabref/logic/importer/fetcher/GenericUrlBasedFetcher.java[18-20]
jablib/src/main/java/org/jabref/logic/importer/fetcher/GenericUrlBasedFetcher.java[35-35]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`GenericUrlBasedFetcher` uses `Collections.emptyList()` / `Collections.singletonList(...)` instead of modern immutable factories.
## Issue Context
The project prefers modern Java collection factories for small immutable collections.
## Fix Focus Areas
- jablib/src/main/java/org/jabref/logic/importer/fetcher/GenericUrlBasedFetcher.java[18-20]
- jablib/src/main/java/org/jabref/logic/importer/fetcher/GenericUrlBasedFetcher.java[35-35]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


10. Uses setField on BibEntry 📘
Description
The new URL-based fetcher mutates a BibEntry via setField instead of using JabRef’s fluent
withField style. This reduces consistency with the preferred immutable-ish conventions.
Code

jablib/src/main/java/org/jabref/logic/importer/fetcher/GenericUrlBasedFetcher.java[R32-34]

+        BibEntry entry = new BibEntry(StandardEntryType.Misc);
+        entry.setField(StandardField.URL, normalizedUrl);
+
Evidence
PR Compliance ID 29 requires using withField instead of setField when creating/configuring
BibEntry instances. The new code calls entry.setField(StandardField.URL, normalizedUrl).

AGENTS.md
jablib/src/main/java/org/jabref/logic/importer/fetcher/GenericUrlBasedFetcher.java[32-34]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`GenericUrlBasedFetcher` uses `BibEntry#setField` for field assignment.
## Issue Context
JabRef prefers the `withField(...)` wither style for `BibEntry` creation/modification.
## Fix Focus Areas
- jablib/src/main/java/org/jabref/logic/importer/fetcher/GenericUrlBasedFetcher.java[32-34]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


11. Collections.emptyList() used in fetcher📘
Description
The new GenericUrlBasedFetcher returns empty/singleton lists using legacy Collections.*
factories instead of modern immutable collection factories. This violates the project preference for
List.of(...) for small immutable results.
Code

jablib/src/main/java/org/jabref/logic/importer/fetcher/GenericUrlBasedFetcher.java[R18-35]

+        if (StringUtil.isBlank(url)) {
+            return Collections.emptyList();
+        }
+
+        String normalizedUrl = url.trim();
+        if (!normalizedUrl.toLowerCase().startsWith("http://") && !normalizedUrl.toLowerCase().startsWith("https://")) {
+            normalizedUrl = "https://" + normalizedUrl;
+        }
+
+        if (!URLUtil.isValidHttpUrl(normalizedUrl)) {
+            throw new FetcherException("Invalid URL: " + normalizedUrl);
+        }
+
+        // Create a new @Misc entry and set the URL field
+        BibEntry entry = new BibEntry(StandardEntryType.Misc);
+        entry.setField(StandardField.URL, normalizedUrl);
+
+        return Collections.singletonList(entry);
Evidence
PR Compliance ID 2 forbids introducing legacy collection construction patterns such as
Collections.emptyList(...). The new code returns Collections.emptyList() and
Collections.singletonList(entry) in fetchEntryFromUrl.

AGENTS.md
jablib/src/main/java/org/jabref/logic/importer/fetcher/GenericUrlBasedFetcher.java[18-20]
jablib/src/main/java/org/jabref/logic/importer/fetcher/GenericUrlBasedFetcher.java[35-35]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`GenericUrlBasedFetcher` uses `Collections.emptyList()` / `Collections.singletonList(...)` instead of modern immutable factories.
## Issue Context
The project prefers modern Java collection factories for small immutable collections.
## Fix Focus Areas
- jablib/src/main/java/org/jabref/logic/importer/fetcher/GenericUrlBasedFetcher.java[18-20]
- jablib/src/main/java/org/jabref/logic/importer/fetcher/GenericUrlBasedFetcher.java[35-35]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


12. Uses setField on BibEntry 📘
Description
The new URL-based fetcher mutates a BibEntry via setField instead of using JabRef’s fluent
withField style. This reduces consistency with the preferred immutable-ish conventions.
Code

jablib/src/main/java/org/jabref/logic/importer/fetcher/GenericUrlBasedFetcher.java[R32-34]

+        BibEntry entry = new BibEntry(StandardEntryType.Misc);
+        entry.setField(StandardField.URL, normalizedUrl);
+
Evidence
PR Compliance ID 29 requires using withField instead of setField when creating/configuring
BibEntry instances. The new code calls entry.setField(StandardField.URL, normalizedUrl).

AGENTS.md
jablib/src/main/java/org/jabref/logic/importer/fetcher/GenericUrlBasedFetcher.java[32-34]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`GenericUrlBasedFetcher` uses `BibEntry#setField` for field assignment.
## Issue Context
JabRef prefers the `withField(...)` wither style for `BibEntry` creation/modification.
## Fix Focus Areas
- jablib/src/main/java/org/jabref/logic/importer/fetcher/GenericUrlBasedFetcher.java[32-34]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


13. Collections.emptyList() used in fetcher📘
Description
The new GenericUrlBasedFetcher returns empty/singleton lists using legacy Collections.*
factories instead of modern immutable collection factories. This violates the project preference for
List.of(...) for small immutable results.
Code

jablib/src/main/java/org/jabref/logic/importer/fetcher/GenericUrlBasedFetcher.java[R18-35]

+        if (StringUtil.isBlank(url)) {
+            return Collections.emptyList();
+        }
+
+        String normalizedUrl = url.trim();
+        if (!normalizedUrl.toLowerCase().startsWith("http://") && !normalizedUrl.toLowerCase().startsWith("https://")) {
+            normalizedUrl = "https://" + normalizedUrl;
+        }
+
+        if (!URLUtil.isValidHttpUrl(normalizedUrl)) {
+            throw new FetcherException("Invalid URL: " + normalizedUrl);
+        }
+
+        // Create a new @Misc entry and set the URL field
+        BibEntry entry = new BibEntry(StandardEntryType.Misc);
+        entry.setField(StandardField.URL, normalizedUrl);
+
+        return Collections.singletonList(entry);
Evidence
PR Compliance ID 2 forbids introducing legacy collection construction patterns such as
Collections.emptyList(...). The new code returns Collections.emptyList() and
Collections.singletonList(entry) in fetchEntryFromUrl.

AGENTS.md
jablib/src/main/java/org/jabref/logic/importer/fetcher/GenericUrlBasedFetcher.java[18-20]
jablib/src/main/java/org/jabref/logic/importer/fetcher/GenericUrlBasedFetcher.java[35-35]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`GenericUrlBasedFetcher` uses `Collections.emptyList()` / `Collections.singletonList(...)` instead of modern immutable factories.
## Issue Context
The project prefers modern Java collection factories for small immutable collections.
## Fix Focus Areas
- jablib/src/main/java/org/jabref/logic/importer/fetcher/GenericUrlBasedFetcher.java[18-20]
- jablib/src/main/java/org/jabref/logic/importer/fetcher/GenericUrlBasedFetcher.java[35-35]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


14. Uses setField on BibEntry 📘
Description
The new URL-based fetcher mutates a BibEntry via setField instead of using JabRef’s fluent
withField style. This reduces consistency with the preferred immutable-ish conventions.
Code

jablib/src/main/java/org/jabref/logic/importer/fetcher/GenericUrlBasedFetcher.java[R32-34]

+        BibEntry entry = new BibEntry(StandardEntryType.Misc);
+        entry.setField(StandardField.URL, normalizedUrl);
+
Evidence
PR Compliance ID 29 requires using withField instead of setField when creating/configuring
BibEntry instances. The new code calls entry.setField(StandardField.URL, normalizedUrl).

AGENTS.md
jablib/src/main/java/org/jabref/logic/importer/fetcher/GenericUrlBasedFetcher.java[32-34]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`GenericUrlBasedFetcher` uses `BibEntry#setField` for field assignment.
## Issue Context
JabRef prefers the `withField(...)` wither style for `BibEntry` creation/modification.
## Fix Focus Areas
- jablib/src/main/java/org/jabref/logic/importer/fetcher/GenericUrlBasedFetcher.java[32-34]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


15. Collections.emptyList() used in fetcher📘
Description
The new GenericUrlBasedFetcher returns empty/singleton lists using legacy Collections.*
factories instead of modern immutable collection factories. This violates the project preference for
List.of(...) for small immutable results.
Code

jablib/src/main/java/org/jabref/logic/importer/fetcher/GenericUrlBasedFetcher.java[R18-35]

+        if (StringUtil.isBlank(url)) {
+            return Collections.emptyList();
+        }
+
+        String normalizedUrl = url.trim();
+        if (!normalizedUrl.toLowerCase().startsWith("http://") && !normalizedUrl.toLowerCase().startsWith("https://")) {
+            normalizedUrl = "https://" + normalizedUrl;
+        }
+
+        if (!URLUtil.isValidHttpUrl(normalizedUrl)) {
+            throw new FetcherException("Invalid URL: " + normalizedUrl);
+        }
+
+        // Create a new @Misc entry and set the URL field
+        BibEntry entry = new BibEntry(StandardEntryType.Misc);
+        entry.setField(StandardField.URL, normalizedUrl);
+
+        return Collections.singletonList(entry);
Evidence
PR Compliance ID 2 forbids introducing legacy collection construction patterns such as
Collections.emptyList(...). The new code returns Collections.emptyList() and
Collections.singletonList(entry) in fetchEntryFromUrl.

AGENTS.md
jablib/src/main/java/org/jabref/logic/importer/fetcher/GenericUrlBasedFetcher.java[18-20]
jablib/src/main/java/org/jabref/logic/importer/fetcher/GenericUrlBasedFetcher.java[35-35]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`GenericUrlBasedFetcher` uses `Collections.emptyList()` / `Collections.singletonList(...)` instead of modern immutable factories.
## Issue Context
The project prefers modern Java collection factories for small immutable collections.
## Fix Focus Areas
- jablib/src/main/java/org/jabref/logic/importer/fetcher/GenericUrlBasedFetcher.java[18-20]
- jablib/src/main/java/org/jabref/logic/importer/fetcher/GenericUrlBasedFetcher.java[35-35]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


16. Uses setField on BibEntry 📘
Description
The new URL-based fetcher mutates a BibEntry via setField instead of using JabRef’s fluent
withField style. This reduces consistency with the preferred immutable-ish conventions.
Code

jablib/src/main/java/org/jabref/logic/importer/fetcher/GenericUrlBasedFetcher.java[R32-34]

+        BibEntry entry = new BibEntry(StandardEntryType.Misc);
+        entry.setField(StandardField.URL, normalizedUrl);
+
Evidence
PR Compliance ID 29 requires using withField instead of setField when creating/configuring
BibEntry instances. The new code calls entry.setField(StandardField.URL, normalizedUrl).

AGENTS.md
jablib/src/main/java/org/jabref/logic/importer/fetcher/GenericUrlBasedFetcher.java[32-34]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`GenericUrlBasedFetcher` uses `BibEntry#setField` for field assignment.
## Issue Context
JabRef prefers the `withField(...)` wither style for `BibEntry` creation/modification.
## Fix Focus Areas
- jablib/src/main/java/org/jabref/logic/importer/fetcher/GenericUrlBasedFetcher.java[32-34]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


17. Collections.emptyList() used in fetcher📘
Description
The new GenericUrlBasedFetcher returns empty/singleton lists using legacy Collections.*
factories instead of modern immutable collection factories. This violates the project preference for
List.of(...) for small immutable results.
Code

jablib/src/main/java/org/jabref/logic/importer/fetcher/GenericUrlBasedFetcher.java[R18-35]

+        if (StringUtil.isBlank(url)) {
+            return Collections.emptyList();
+        }
+
+        String normalizedUrl = url.trim();
+        if (!normalizedUrl.toLowerCase().startsWith("http://") && !normalizedUrl.toLowerCase().startsWith("https://")) {
+            normalizedUrl = "https://" + normalizedUrl;
+        }
+
+        if (!URLUtil.isValidHttpUrl(normalizedUrl)) {
+            throw new FetcherException("Invalid URL: " + normalizedUrl);
+        }
+
+        // Create a new @Misc entry and set the URL field
+        BibEntry entry = new BibEntry(StandardEntryType.Misc);
+        entry.setField(StandardField.URL, normalizedUrl);
+
+        return Collections.singletonList(entry);
Evidence
PR Compliance ID 2 forbids introducing legacy collection construction patterns such as
Collections.emptyList(...). The new code returns Collections.emptyList() and
Collections.singletonList(entry) in fetchEntryFromUrl.

AGENTS.md
jablib/src/main/java/org/jabref/logic/importer/fetcher/GenericUrlBasedFetcher.java[18-20]
jablib/src/main/java/org/jabref/logic/importer/fetcher/GenericUrlBasedFetcher.java[35-35]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`GenericUrlBasedFetcher` uses `Collections.emptyList()` / `Collections.singletonList(...)` instead of modern immutable factories.
## Issue Context
The project prefers modern Java collection factories for small immutable collections.
## Fix Focus Areas
- jablib/src/main/java/org/jabref/logic/importer/fetcher/GenericUrlBasedFetcher.java[18-20]
- jablib/src/main/java/org/jabref/logic/importer/fetcher/GenericUrlBasedFetcher.java[35-35]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


18. Uses setField on BibEntry 📘
Description
The new URL-based fetcher mutates a BibEntry via setField instead of using JabRef’s fluent
withField style. This reduces consistency with the preferred immutable-ish conventions.
Code

jablib/src/main/java/org/jabref/logic/importer/fetcher/GenericUrlBasedFetcher.java[R32-34]

+        BibEntry entry = new BibEntry(StandardEntryType.Misc);
+        entry.setField(StandardField.URL, normalizedUrl);
+
Evidence
PR Compliance ID 29 requires using withField instead of setField when creating/configuring
BibEntry instances. The new code calls entry.setField(StandardField.URL, normalizedUrl).

AGENTS.md
jablib/src/main/java/org/jabref/logic/importer/fetcher/GenericUrlBasedFetcher.java[32-34]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`GenericUrlBasedFetcher` uses `BibEntry#setField` for field assignment.
## Issue Context
JabRef prefers the `withField(...)` wither style for `BibEntry` creation/modification.
## Fix Focus Areas
- jablib/src/main/java/org/jabref/logic/importer/fetcher/GenericUrlBasedFetcher.java[32-34]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


19. Collections.emptyList() used in fetcher📘
Description
The new GenericUrlBasedFetcher returns empty/singleton lists using legacy Collections.*
factories instead of modern immutable collection factories. This violates the project preference for
List.of(...) for small immutable results.
Code

jablib/src/main/java/org/jabref/logic/importer/fetcher/GenericUrlBasedFetcher.java[R18-35]

+        if (StringUtil.isBlank(url)) {
+            return Collections.emptyList();
+        }
+
+        String normalizedUrl = url.trim();
+        if (!normalizedUrl.toLowerCase().startsWith("http://") && !normalizedUrl.toLowerCase().startsWith("https://")) {
+            normalizedUrl = "https://" + normalizedUrl;
+        }
+
+        if (!URLUtil.isValidHttpUrl(normalizedUrl)) {
+            throw new FetcherException("Invalid URL: " + normalizedUrl);
+        }
+
+        // Create a new @Misc entry and set the URL field
+        BibEntry entry = new BibEntry(StandardEntryType.Misc);
+        entry.setField(StandardField.URL, normalizedUrl);
+
+        return Collections.singletonList(entry);
Evidence
PR Compliance ID 2 forbids introducing legacy collection construction patterns such as
Collections.emptyList(...). The new code returns Collections.emptyList() and
Collections.singletonList(entry) in fetchEntryFromUrl.

AGENTS.md
jablib/src/main/java/org/jabref/logic/importer/fetcher/GenericUrlBasedFetcher.java[18-20]
jablib/src/main/java/org/jabref/logic/importer/fetcher/GenericUrlBasedFetcher.java[35-35]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`GenericUrlBasedFetcher` uses `Collections.emptyList()` / `Collections.singletonList(...)` instead of modern immutable factories.
## Issue Context
The project prefers modern Java collection factories for small immutable collections.
## Fix Focus Areas
- jablib/src/main/java/org/jabref/logic/importer/fetcher/GenericUrlBasedFetcher.java[18-20]
- jablib/src/main/java/org/jabref/logic/importer/fetcher/GenericUrlBasedFetcher.java[35-35]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


20. Uses setField on BibEntry 📘
Description
The new URL-based fetcher mutates a BibEntry via setField instead of using JabRef’s fluent
withField style. This reduces consistency with the preferred immutable-ish conventions.
Code

jablib/src/main/java/org/jabref/logic/importer/fetcher/GenericUrlBasedFetcher.java[R32-34]

+        BibEntry entry = new BibEntry(StandardEntryType.Misc);
+        entry.setField(StandardField.URL, normalizedUrl);
+
Evidence
PR Compliance ID 29 requires using withField instead of setField when creating/configuring
BibEntry instances. The new code calls entry.setField(StandardField.URL, normalizedUrl).

AGENTS.md
jablib/src/main/java/org/jabref/logic/importer/fetcher/GenericUrlBasedFetcher.java[32-34]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`GenericUrlBasedFetcher` uses `BibEntry#setField` for field assignment.
## Issue Context
JabRef prefers the `withField(...)` wither style for `BibEntry` creation/modification.
## Fix Focus Areas
- jablib/src/main/java/org/jabref/logic/importer/fetcher/GenericUrlBasedFetcher.java[32-34]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


21. Collections.emptyList() used in fetcher📘
Description
The new GenericUrlBasedFetcher returns empty/singleton lists using legacy Collections.*
factories instead of modern immutable collection factories. This violates the project preference for
List.of(...) for small immutable results.
Code

jablib/src/main/java/org/jabref/logic/importer/fetcher/GenericUrlBasedFetcher.java[R18-35]

+        if (StringUtil.isBlank(url)) {
+            return Collections.emptyList();
+        }
+
+        String normalizedUrl = url.trim();
+        if (!normalizedUrl.toLowerCase().startsWith("http://") && !normalizedUrl.toLowerCase().startsWith("https://")) {
+            normalizedUrl = "https://" + normalizedUrl;
+        }
+
+        if (!URLUtil.isValidHttpUrl(normalizedUrl)) {
+            throw new FetcherException("Invalid URL: " + normalizedUrl);
+        }
+
+        // Create a new @Misc entry and set the URL field
+        BibEntry entry = new BibEntry(StandardEntryType.Misc);
+        entry.setField(StandardField.URL, normalizedUrl);
+
+        return Collections.singletonList(entry);
Evidence
PR Compliance ID 2 forbids introducing legacy collection construction patterns such as
Collections.emptyList(...). The new code returns Collections.emptyList() and
Collections.singletonList(entry) in fetchEntryFromUrl.

AGENTS.md
jablib/src/main/java/org/jabref/logic/importer/fetcher/GenericUrlBasedFetcher.java[18-20]
jablib/src/main/java/org/jabref/logic/importer/fetcher/GenericUrlBasedFetcher.java[35-35]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`GenericUrlBasedFetcher` uses `Collections.emptyList()` / `Collections.singletonList(...)` instead of modern immutable factories.
## Issue Context
The project prefers modern Java collection factories for small immutable collections.
## Fix Focus Areas
- jablib/src/main/java/org/jabref/logic/importer/fetcher/GenericUrlBasedFetcher.java[18-20]
- jablib/src/main/java/org/jabref/logic/importer/fetcher/GenericUrlBasedFetcher.java[35-35]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


22. Uses setField on BibEntry 📘
Description
The new URL-based fetcher mutates a BibEntry via setField instead of using JabRef’s fluent
withField style. This reduces consistency with the preferred immutable-ish conventions.
Code

jablib/src/main/java/org/jabref/logic/importer/fetcher/GenericUrlBasedFetcher.java[R32-34]

+        BibEntry entry = new BibEntry(StandardEntryType.Misc);
+        entry.setField(StandardField.URL, normalizedUrl);
+
Evidence
PR Compliance ID 29 requires using withField instead of setField when creating/configuring
BibEntry instances. The new code calls entry.setField(StandardField.URL, normalizedUrl).

AGENTS.md
jablib/src/main/java/org/jabref/logic/importer/fetcher/GenericUrlBasedFetcher.java[32-34]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`GenericUrlBasedFetcher` uses `BibEntry#setField` for field assignment.
## Issue Context
JabRef prefers the `withField(...)` wither style for `BibEntry` creation/modification.
## Fix Focus Areas
- jablib/src/main/java/org/jabref/logic/importer/fetcher/GenericUrlBasedFetcher.java[32-34]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


23. Collections.emptyList() used in fetcher📘
Description
The new GenericUrlBasedFetcher returns empty/singleton lists using legacy Collections.*
factories instead of modern immutable collection factories. This violates the project preference for
List.of(...) for small immutable results.
Code

jablib/src/main/java/org/jabref/logic/importer/fetcher/GenericUrlBasedFetcher.java[R18-35]

+        if (StringUtil.isBlank(url)) {
+            return Collections.emptyList();
+        }
+
+        String normalizedUrl = url.trim();
+        if (!normalizedUrl.toLowerCase().startsWith("http://") && !normalizedUrl.toLowerCase().startsWith("https://")) {
+            normalizedUrl = "https://" + normalizedUrl;
+        }
+
+        if (!URLUtil.isValidHttpUrl(normalizedUrl)) {
+            throw new FetcherException("Invalid URL: " + normalizedUrl);
+        }
+
+        // Create a new @Misc entry and set the URL field
+        BibEntry entry = new BibEntry(StandardEntryType.Misc);
+        entry.setField(StandardField.URL, normalizedUrl);
+
+        return Collections.singletonList(entry);
Evidence
PR Compliance ID 2 forbids introducing legacy collection construction patterns such as
Collections.emptyList(...). The new code returns Collections.emptyList() and
Collections.singletonList(entry) in fetchEntryFromUrl.

AGENTS.md
jablib/src/main/java/org/jabref/logic/importer/fetcher/GenericUrlBasedFetcher.java[18-20]
jablib/src/main/java/org/jabref/logic/importer/fetcher/GenericUrlBasedFetcher.java[35-35]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`GenericUrlBasedFetcher` uses `Collections.emptyList()` / `Collections.singletonList(...)` instead of modern immutable factories.
## Issue Context
The project prefers modern Java collection factories for small immutable collections.
## Fix Focus Areas
- jablib/src/main/java/org/jabref/logic/importer/fetcher/GenericUrlBasedFetcher.java[18-20]
- jablib/src/main/java/org/jabref/logic/importer/fetcher/GenericUrlBasedFetcher.java[35-35]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


24. Collections.emptyList() used in fetcher📘
Description
The new GenericUrlBasedFetcher returns empty/singleton lists using legacy Collections.*
factories instead of modern immutable collection factories. This violates the project preference for
List.of(...) for small immutable results.
Code

jablib/src/main/java/org/jabref/logic/importer/fetcher/GenericUrlBasedFetcher.java[R18-35]

+        if (StringUtil.isBlank(url)) {
+            return Collections.emptyList();
+        }
+
+        String normalizedUrl = url.trim();
+        if (!normalizedUrl.toLowerCase().startsWith("http://") && !normalizedUrl.toLowerCase().startsWith("https://")) {
+            normalizedUrl = "https://" + normalizedUrl;
+        }
+
+        if (!URLUtil.isValidHttpUrl(normalizedUrl)) {
+            throw new FetcherException("Invalid URL: " + normalizedUrl);
+        }
+
+        // Create a new @Misc entry and set the URL field
+        BibEntry entry = new BibEntry(StandardEntryType.Misc);
+        entry.setField(S...

@Sudeep-A-Kulkarni Sudeep-A-Kulkarni marked this pull request as draft March 30, 2026 20:06
@Sudeep-A-Kulkarni
Copy link
Copy Markdown
Author

please avoid closing and reopening prs or creating different ones for the same ones as this creates noise

Sorry! I will keep that in mind.

@testlens-app

This comment has been minimized.

@testlens-app

This comment has been minimized.

@testlens-app

This comment has been minimized.

@testlens-app

This comment has been minimized.

@testlens-app

This comment has been minimized.

@testlens-app

This comment has been minimized.

@Sudeep-A-Kulkarni
Copy link
Copy Markdown
Author

Hi, I'm facing issues with submodule modifications being detected
in my PR despite not intentionally modifying them. I've tried the
FAQ fix but the issue persists. Could you please advise on how to
resolve this?

@Sudeep-A-Kulkarni Sudeep-A-Kulkarni marked this pull request as ready for review April 7, 2026 05:53
@qodo-free-for-open-source-projects
Copy link
Copy Markdown
Contributor

Review Summary by Qodo

Add URL-based entry creation to New Entry dialog

✨ Enhancement

Grey Divider

Walkthroughs

Description
• Add "Enter URL" tab to New Entry dialog for creating @Misc entries
• Implement GenericUrlBasedFetcher to fetch entries from URLs
• Add URL validation with HTTP/HTTPS protocol support
• Include comprehensive localization strings and unit tests
Diagram
flowchart LR
  User["User enters URL"] -->|Input validation| Validator["URL Validator<br/>HTTP/HTTPS check"]
  Validator -->|Valid URL| Fetcher["GenericUrlBasedFetcher"]
  Fetcher -->|Create entry| Entry["@Misc BibEntry<br/>with URL field"]
  Entry -->|Import| Library["Add to Library"]
Loading

Grey Divider

File Changes

1. jabgui/src/main/java/org/jabref/gui/newentry/NewEntryDialogTab.java ✨ Enhancement +1/-0

Add ENTER_URL tab enum constant

• Added ENTER_URL enum constant to support new tab in dialog

jabgui/src/main/java/org/jabref/gui/newentry/NewEntryDialogTab.java


2. jabgui/src/main/java/org/jabref/gui/newentry/NewEntryView.java ✨ Enhancement +39/-0

Implement URL tab UI and event handling

• Added tabEnterUrl and urlText FXML fields for URL input UI
• Implemented switchEnterUrl() method to handle tab selection and focus management
• Added initializeEnterUrl() to bind URL text property to view model
• Integrated URL tab into finalizeTabs() and execute() methods
• Added tab selection listener for URL tab

jabgui/src/main/java/org/jabref/gui/newentry/NewEntryView.java


3. jabgui/src/main/java/org/jabref/gui/newentry/NewEntryViewModel.java ✨ Enhancement +91/-0

Add URL fetching logic and validation

• Added urlText StringProperty and urlTextValidator for URL validation
• Implemented URL validation logic checking HTTP/HTTPS protocol and URL validity
• Created WorkerLookupUrl inner class to fetch entries asynchronously
• Added executeEnterUrl() method with error handling and import workflow
• Updated cancel() method to cancel URL worker task
• Added imports for GenericUrlBasedFetcher, URLUtil, and Locale

jabgui/src/main/java/org/jabref/gui/newentry/NewEntryViewModel.java


View more (5)
4. jablib/src/main/java/org/jabref/logic/importer/fetcher/GenericUrlBasedFetcher.java ✨ Enhancement +29/-0

Create GenericUrlBasedFetcher for URL-based entries

• Created new fetcher class to generate @Misc BibTeX entries from URLs
• Implemented fetchEntryFromUrl() method that creates entry with URL field
• Added null/blank URL handling and URL trimming
• Provided getName() method returning "Generic URL Fetcher"

jablib/src/main/java/org/jabref/logic/importer/fetcher/GenericUrlBasedFetcher.java


5. jablib/src/test/java/org/jabref/logic/importer/fetcher/GenericUrlBasedFetcherTest.java 🧪 Tests +58/-0

Add GenericUrlBasedFetcher unit tests

• Added unit tests for GenericUrlBasedFetcher functionality
• Test cases cover valid URL entry creation, blank URL handling, and URL trimming
• Validates correct entry type (@Misc) and URL field population

jablib/src/test/java/org/jabref/logic/importer/fetcher/GenericUrlBasedFetcherTest.java


6. CHANGELOG.md 📝 Documentation +1/-0

Document Enter URL feature in changelog

• Added entry documenting new "Enter URL" tab feature for creating @Misc entries
• References issue #15411

CHANGELOG.md


7. jabgui/src/main/resources/org/jabref/gui/newentry/NewEntry.fxml ✨ Enhancement +28/-0

Add Enter URL tab to FXML layout

• Added new Tab element with tabEnterUrl ID for URL input interface
• Included Label with instruction text and HBox with URL label and TextField
• TextField urlText configured with proper layout and sizing

jabgui/src/main/resources/org/jabref/gui/newentry/NewEntry.fxml


8. jablib/src/main/resources/l10n/JabRef_en.properties Localization +6/-0

Add localization strings for URL feature

• Added localization keys for "Enter URL" tab label and description
• Added error messages for URL lookup failures and invalid URLs
• Added URL field label and validation error message

jablib/src/main/resources/l10n/JabRef_en.properties


Grey Divider

Qodo Logo

@qodo-free-for-open-source-projects
Copy link
Copy Markdown
Contributor

qodo-free-for-open-source-projects bot commented Apr 7, 2026

Code Review by Qodo

🐞 Bugs (3) 📘 Rule violations (9) 📎 Requirement gaps (0) 🎨 UX Issues (0)

Grey Divider


Action required

1. orElse("") in fetcher tests 📘 Rule violation ⚙ Maintainability ⭐ New
Description
The new tests extract Optional values using orElse("") instead of asserting the Optional content
directly, which weakens test signal and can mask incorrect empty values. This violates the project’s
Optional and test-assertion compliance requirements.
Code

jablib/src/test/java/org/jabref/logic/importer/fetcher/GenericUrlBasedFetcherTest.java[R40-41]

+        assertEquals(TEST_URL, entry.getField(StandardField.URL).orElse(""));
+        assertEquals(StandardEntryType.Misc, entry.getType());
Evidence
PR Compliance ID 9 and 32 require idiomatic Optional handling and exact expected-value assertions in
unit tests. The new tests use entry.getField(...).orElse("") rather than asserting the returned
Optional equals Optional.of(TEST_URL) (and repeat the same pattern later), reducing determinism
and precision of assertions.

AGENTS.md
jablib/src/test/java/org/jabref/logic/importer/fetcher/GenericUrlBasedFetcherTest.java[40-41]
jablib/src/test/java/org/jabref/logic/importer/fetcher/GenericUrlBasedFetcherTest.java[56-56]
Best Practice: Learned patterns

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The tests use `Optional.orElse("")` when asserting the URL field, which weakens assertions and violates the Optional/test assertion rules.

## Issue Context
`BibEntry#getField(...)` returns an `Optional<String>`. The test should assert the Optional’s content (e.g., equality to `Optional.of(TEST_URL)`) instead of forcing an empty-string default.

## Fix Focus Areas
- jablib/src/test/java/org/jabref/logic/importer/fetcher/GenericUrlBasedFetcherTest.java[40-41]
- jablib/src/test/java/org/jabref/logic/importer/fetcher/GenericUrlBasedFetcherTest.java[56-56]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


2. URL scheme not stored 🐞 Bug ≡ Correctness ⭐ New
Description
The URL validator accepts schemeless inputs by prepending "https://" only for validation, but the
worker/fetcher persists the original text, so entries can be created with invalid URL values (e.g.,
"example.com"). This breaks the promise of “valid URL” and can lead to non-clickable/unusable URL
fields downstream.
Code

jabgui/src/main/java/org/jabref/gui/newentry/NewEntryViewModel.java[R160-174]

+        urlText = new SimpleStringProperty("");
+        urlTextValidator = new FunctionBasedValidator<>(urlText, input -> {
+            if (StringUtil.isBlank(input)) {
+                return false;
+            }
+
+            String normalized = input.trim();
+            String lower = normalized.toLowerCase(Locale.ROOT);
+
+            if (!lower.startsWith("http://") && !lower.startsWith("https://")) {
+                normalized = "https://" + normalized;
+            }
+
+            return URLUtil.isValidHttpUrl(normalized);
+        }, ValidationMessage.error(Localization.lang("Please enter a valid HTTP or HTTPS URL.")));
Evidence
NewEntryViewModel.urlTextValidator normalizes the user input (adds https://) only in a local
variable and validates that, but WorkerLookupUrl uses the unnormalized urlText value when calling
GenericUrlBasedFetcher, which only trims and stores it. URLUtil.isValidHttpUrl checks validity
including that the string starts with http/https, which is satisfied during validation but not
necessarily in the stored value.

jabgui/src/main/java/org/jabref/gui/newentry/NewEntryViewModel.java[160-174]
jabgui/src/main/java/org/jabref/gui/newentry/NewEntryViewModel.java[502-520]
jablib/src/main/java/org/jabref/logic/importer/fetcher/GenericUrlBasedFetcher.java[16-27]
jablib/src/main/java/org/jabref/logic/util/URLUtil.java[145-160]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

### Issue description
The URL validator prepends `https://` for validation, but the actual stored URL comes from the original `urlText` value, which may be schemeless. This allows a value to be considered “valid” in the UI while persisting an invalid URL into the created `@Misc` entry.

### Issue Context
- Validation currently normalizes into a local variable only.
- `WorkerLookupUrl` passes the original `urlText` to `GenericUrlBasedFetcher`.
- `GenericUrlBasedFetcher` trims and stores the URL as-is.

### Fix Focus Areas
- jabgui/src/main/java/org/jabref/gui/newentry/NewEntryViewModel.java[160-174]
- jabgui/src/main/java/org/jabref/gui/newentry/NewEntryViewModel.java[502-520]
- jablib/src/main/java/org/jabref/logic/importer/fetcher/GenericUrlBasedFetcher.java[16-27]

### Suggested fix
Apply the same normalization used during validation to the value that is persisted, e.g.:
- Normalize in `WorkerLookupUrl.call()` (preferred: single point before fetch/import), and pass `normalized` to the fetcher.
 - `normalized = text.trim();`
 - If missing scheme, prefix `https://`.
- Or move normalization into `GenericUrlBasedFetcher.fetchEntryFromUrl` so all callers get consistent behavior.
- Optionally update `urlText` with the normalized value so the UI and stored data match exactly.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


3. Collections.emptyList() used in fetcher📘 Rule violation ⚙ Maintainability
Description
The new GenericUrlBasedFetcher returns empty/singleton lists using legacy Collections.*
factories instead of modern immutable collection factories. This violates the project preference for
List.of(...) for small immutable results.
Code

jablib/src/main/java/org/jabref/logic/importer/fetcher/GenericUrlBasedFetcher.java[R18-35]

+        if (StringUtil.isBlank(url)) {
+            return Collections.emptyList();
+        }
+
+        String normalizedUrl = url.trim();
+        if (!normalizedUrl.toLowerCase().startsWith("http://") && !normalizedUrl.toLowerCase().startsWith("https://")) {
+            normalizedUrl = "https://" + normalizedUrl;
+        }
+
+        if (!URLUtil.isValidHttpUrl(normalizedUrl)) {
+            throw new FetcherException("Invalid URL: " + normalizedUrl);
+        }
+
+        // Create a new @Misc entry and set the URL field
+        BibEntry entry = new BibEntry(StandardEntryType.Misc);
+        entry.setField(StandardField.URL, normalizedUrl);
+
+        return Collections.singletonList(entry);
Evidence
PR Compliance ID 2 forbids introducing legacy collection construction patterns such as
Collections.emptyList(...). The new code returns Collections.emptyList() and
Collections.singletonList(entry) in fetchEntryFromUrl.

AGENTS.md
jablib/src/main/java/org/jabref/logic/importer/fetcher/GenericUrlBasedFetcher.java[18-20]
jablib/src/main/java/org/jabref/logic/importer/fetcher/GenericUrlBasedFetcher.java[35-35]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`GenericUrlBasedFetcher` uses `Collections.emptyList()` / `Collections.singletonList(...)` instead of modern immutable factories.
## Issue Context
The project prefers modern Java collection factories for small immutable collections.
## Fix Focus Areas
- jablib/src/main/java/org/jabref/logic/importer/fetcher/GenericUrlBasedFetcher.java[18-20]
- jablib/src/main/java/org/jabref/logic/importer/fetcher/GenericUrlBasedFetcher.java[35-35]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


View more (1)
4. Uses setField on BibEntry 📘 Rule violation ⚙ Maintainability
Description
The new URL-based fetcher mutates a BibEntry via setField instead of using JabRef’s fluent
withField style. This reduces consistency with the preferred immutable-ish conventions.
Code

jablib/src/main/java/org/jabref/logic/importer/fetcher/GenericUrlBasedFetcher.java[R32-34]

+        BibEntry entry = new BibEntry(StandardEntryType.Misc);
+        entry.setField(StandardField.URL, normalizedUrl);
+
Evidence
PR Compliance ID 29 requires using withField instead of setField when creating/configuring
BibEntry instances. The new code calls entry.setField(StandardField.URL, normalizedUrl).

AGENTS.md
jablib/src/main/java/org/jabref/logic/importer/fetcher/GenericUrlBasedFetcher.java[32-34]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`GenericUrlBasedFetcher` uses `BibEntry#setField` for field assignment.
## Issue Context
JabRef prefers the `withField(...)` wither style for `BibEntry` creation/modification.
## Fix Focus Areas
- jablib/src/main/java/org/jabref/logic/importer/fetcher/GenericUrlBasedFetcher.java[32-34]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools



Remediation recommended

5. Concatenated Localization.lang key 📘 Rule violation ⚙ Maintainability ⭐ New
Description
A localized UI message key is built using string concatenation, which increases the risk of
mismatched translation keys and makes localization harder to maintain. This violates the
localization text conventions requiring non-concatenated localized strings.
Code

jabgui/src/main/java/org/jabref/gui/newentry/NewEntryViewModel.java[608]

+                dialogService.showWarningDialogAndWait(Localization.lang("Invalid result"), Localization.lang("No entry could be generated from the provided URL.\n" + "This entry may need to be added manually."));
Evidence
PR Compliance ID 20 requires localized UI text to avoid concatenation patterns and to use
consistent, reusable keys. The new warning dialog message passes a concatenated string expression
into Localization.lang(...) rather than using a single stable key (or a placeholder-based
message).

AGENTS.md
jabgui/src/main/java/org/jabref/gui/newentry/NewEntryViewModel.java[608-608]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`Localization.lang(...)` is called with a concatenated string expression, which is brittle for localization key lookup and reuse.

## Issue Context
The full message already exists as one localization entry (including the newline). Passing a single, non-concatenated key improves maintainability and reduces risk of translation mismatches.

## Fix Focus Areas
- jabgui/src/main/java/org/jabref/gui/newentry/NewEntryViewModel.java[608-608]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


6. Trivial comment in fetcher 📘 Rule violation ⚙ Maintainability
Description
A newly added comment restates what the code immediately does, adding noise without explaining
intent. This reduces readability and violates the project guidance to document “why” rather than
“what”.
Code

jablib/src/main/java/org/jabref/logic/importer/fetcher/GenericUrlBasedFetcher.java[R31-33]

+        // Create a new @Misc entry and set the URL field
+        BibEntry entry = new BibEntry(StandardEntryType.Misc);
+        entry.setField(StandardField.URL, normalizedUrl);
Evidence
PR Compliance ID 16 forbids adding comments that merely paraphrase the code. The comment `// Create
a new @Misc entry and set the URL field` repeats the subsequent statements.

AGENTS.md
jablib/src/main/java/org/jabref/logic/importer/fetcher/GenericUrlBasedFetcher.java[31-33]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
A trivial comment was added that restates the next lines of code.
## Issue Context
Comments should explain rationale/intent, not narrate obvious operations.
## Fix Focus Areas
- jablib/src/main/java/org/jabref/logic/importer/fetcher/GenericUrlBasedFetcher.java[31-33]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


7. toLowerCase() lacks locale 📘 Rule violation ≡ Correctness
Description
The new URL normalization uses toLowerCase() without specifying a locale, which can behave
incorrectly in some locales (e.g., Turkish). This is a Java best-practice issue for stable,
locale-independent processing.
Code

jablib/src/main/java/org/jabref/logic/importer/fetcher/GenericUrlBasedFetcher.java[R23-25]

+        if (!normalizedUrl.toLowerCase().startsWith("http://") && !normalizedUrl.toLowerCase().startsWith("https://")) {
+            normalizedUrl = "https://" + normalizedUrl;
+        }
Evidence
PR Compliance ID 5 requires established Java best practices. Calling toLowerCase() without
Locale.ROOT can produce incorrect results depending on the user’s default locale.

AGENTS.md
jablib/src/main/java/org/jabref/logic/importer/fetcher/GenericUrlBasedFetcher.java[23-25]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`toLowerCase()` is used without an explicit locale during URL scheme checking.
## Issue Context
Locale-dependent lowercasing can cause incorrect behavior in certain locales.
## Fix Focus Areas
- jablib/src/main/java/org/jabref/logic/importer/fetcher/GenericUrlBasedFetcher.java[23-25]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


View more (5)
8. Changelog entry spacing issue 📘 Rule violation ⚙ Maintainability
Description
The new changelog line is missing a space before the issue link, reducing consistency and
professionalism of release notes. This violates the changelog formatting/professional documentation
requirements.
Code

CHANGELOG.md[15]

+- We added "Enter URL" tab in New Entry dialog to create a `@Misc` entry from any URL.[#15411](https://github.com/JabRef/jabref/issues/15411)
Evidence
PR Compliance IDs 31 and 37 require consistent, professional changelog formatting. The added entry
has URL.[#15411] without a space separating the sentence and the issue reference.

AGENTS.md
CHANGELOG.md[15-15]
Best Practice: Learned patterns

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The new CHANGELOG entry is missing a space before the issue reference link.
## Issue Context
Changelog entries must be consistently formatted and professional.
## Fix Focus Areas
- CHANGELOG.md[15-15]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


9. Wiley changelog entry removed 📘 Rule violation ⚙ Maintainability
Description
The PR deletes an existing CHANGELOG entry about Wiley TDM PDF downloading, which is unrelated to
the new “Enter URL” feature and can unintentionally drop release notes. Unrelated modifications
reduce diff clarity and can cause documentation regressions.
Code

CHANGELOG.md[14]

-- We added support for downloading full-text PDFs from Wiley journals via the Wiley TDM API. [#13404](https://github.com/JabRef/jabref/issues/13404)
+- Added "Enter URL" tab in New Entry dialog to create a `@Misc` entry from any URL. [#15411](https://github.com/JabRef/jabref/issues/15411) 
Evidence
PR Compliance ID 2 requires limiting changes to relevant modifications; the diff shows removal of a
separate feature’s changelog bullet unrelated to this PR’s URL entry feature.

AGENTS.md
CHANGELOG.md[14-14]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
An unrelated CHANGELOG bullet (Wiley TDM PDF support) was removed in this PR.
## Issue Context
This PR is about adding an "Enter URL" tab; deleting other release notes is likely accidental and violates the guideline to keep unrelated changes out of the diff.
## Fix Focus Areas
- CHANGELOG.md[10-17]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


10. Trailing whitespace in changelog 📘 Rule violation ⚙ Maintainability
Description
The newly added CHANGELOG line ends with trailing whitespace, which can violate markdownlint rules
and create noisy diffs. This reduces documentation quality and consistency.
Code

CHANGELOG.md[13]

+- Added "Enter URL" tab in New Entry dialog to create a `@Misc` entry from any URL. [#15411](https://github.com/JabRef/jabref/issues/15411) 
Evidence
PR Compliance ID 28 requires CHANGELOG/Markdown to meet formatting and markdownlint expectations;
the added line has an extra trailing space at the end.

AGENTS.md
CHANGELOG.md[13-13]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The new CHANGELOG entry line ends with trailing whitespace, which can violate markdownlint and adds noise.
## Issue Context
Keep CHANGELOG.md compliant with markdownlint expectations.
## Fix Focus Areas
- CHANGELOG.md[13-13]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


11. Blank line before package 📘 Rule violation ⚙ Maintainability
Description
The new GenericUrlBasedFetcher.java file starts with an empty line before the package
declaration, which deviates from standard Java/JabRef formatting conventions. This introduces
avoidable style inconsistency in newly added code.
Code

jablib/src/main/java/org/jabref/logic/importer/fetcher/GenericUrlBasedFetcher.java[R1-2]

+
+package org.jabref.logic.importer.fetcher;
Evidence
PR Compliance ID 2 requires following JabRef formatting/style conventions; the added file shows a
leading blank line before package ....

AGENTS.md
jablib/src/main/java/org/jabref/logic/importer/fetcher/GenericUrlBasedFetcher.java[1-2]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`GenericUrlBasedFetcher.java` has a leading blank line before the `package` declaration.
## Issue Context
New Java files should start with the `package` declaration per typical JabRef/Java formatting.
## Fix Focus Areas
- jablib/src/main/java/org/jabref/logic/importer/fetcher/GenericUrlBasedFetcher.java[1-3]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


12. URL not format-validated 🐞 Bug ≡ Correctness
Description
NewEntryViewModel validates the Enter URL input as merely non-blank, so arbitrary strings (not
URLs) are accepted and stored in the url field. This undermines the UI semantics (“Enter URL”) and
can create entries with syntactically invalid URL values.
Code

jabgui/src/main/java/org/jabref/gui/newentry/NewEntryViewModel.java[R157-162]

+        urlText = new SimpleStringProperty();
+        urlTextValidator = new FunctionBasedValidator<>(
+                urlText,
+                StringUtil::isNotBlank,
+                ValidationMessage.error(Localization.lang("You must specify a URL.")));
+        urlWorker = null;
Evidence
The Enter URL validator only checks StringUtil::isNotBlank, and the fetcher will create a @Misc
entry for any non-blank input; meanwhile, the codebase already provides URL syntax validators
(URLUtil.isURL / URLUtil.isValidHttpUrl) that are not used here.

jabgui/src/main/java/org/jabref/gui/newentry/NewEntryViewModel.java[157-162]
jablib/src/main/java/org/jabref/logic/importer/fetcher/GenericUrlBasedFetcher.java[20-30]
jablib/src/main/java/org/jabref/logic/util/URLUtil.java[73-95]
jablib/src/main/java/org/jabref/logic/util/URLUtil.java[145-160]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The Enter URL flow currently treats any non-empty string as a URL and will generate an entry even for malformed/non-URL input. Update validation (and optionally normalization) so the tab enforces basic URL syntax (e.g., http/https) consistent with JabRef's existing URL utilities.
## Issue Context
- The UI is explicitly labeled as URL input.
- The logic layer already includes `URLUtil.isURL` and `URLUtil.isValidHttpUrl`.
## Fix Focus Areas
- jabgui/src/main/java/org/jabref/gui/newentry/NewEntryViewModel.java[157-162]
- jablib/src/main/java/org/jabref/logic/importer/fetcher/GenericUrlBasedFetcher.java[20-30]
- jablib/src/main/java/org/jabref/logic/util/URLUtil.java[73-95]
- jablib/src/main/java/org/jabref/logic/util/URLUtil.java[145-160]
## Suggested approach
1. Change the validator predicate from `StringUtil::isNotBlank` to a URL validator (e.g., `URLUtil::isValidHttpUrl`).
2. Decide on behavior for inputs like `www.example.com`:
- either reject with a clear error message, or
- normalize by prepending `https://` before validation/entry creation.
3. If you normalize, do it in one place (either in the view model before calling the fetcher, or inside `GenericUrlBasedFetcher.performSearch`).

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools



Advisory comments

13. Overlapping fetcher interfaces 🐞 Bug ⚙ Maintainability
Description
UrlBasedFetcher introduces a performSearch(String) method that overlaps with
SearchBasedFetcher’s existing performSearch(String) API, creating two similar abstractions for
string-input fetchers. This increases API ambiguity and maintenance surface for future fetchers and
callers.
Code

jablib/src/main/java/org/jabref/logic/importer/UrlBasedFetcher.java[R7-9]

+public interface UrlBasedFetcher extends WebFetcher {
+    List<BibEntry> performSearch(String url) throws FetcherException;
+}
Evidence
UrlBasedFetcher defines performSearch(String) while SearchBasedFetcher already provides a
string overload named performSearch(String) (as a default method), so the new interface duplicates
the naming/shape of an existing fetcher API.

jablib/src/main/java/org/jabref/logic/importer/UrlBasedFetcher.java[1-9]
jablib/src/main/java/org/jabref/logic/importer/SearchBasedFetcher.java[19-49]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`UrlBasedFetcher` adds another `performSearch(String)` interface alongside `SearchBasedFetcher`’s existing `performSearch(String)` overload. This overlap can confuse future implementations/callers about which interface should be used for string-based operations.
## Issue Context
The new URL feature does not perform a traditional web search; it generates a single entry from a URL string.
## Fix Focus Areas
- jablib/src/main/java/org/jabref/logic/importer/UrlBasedFetcher.java[1-9]
- jablib/src/main/java/org/jabref/logic/importer/SearchBasedFetcher.java[19-49]
- jablib/src/main/java/org/jabref/logic/importer/fetcher/GenericUrlBasedFetcher.java[13-30]
## Suggested approach (pick one)
1. Rename the URL-based API to avoid collision/ambiguity (e.g., `generateEntryFromUrl(String)` / `performSearchByUrl(String)`), and drop the `performSearch(String)` naming.
2. If you want to keep a fetcher-style interface, consider reusing an existing abstraction (or making this a small utility/service) rather than introducing a new interface with an already-established method name.
3. Keep the public surface minimal: since this fetcher is currently only used by the New Entry dialog, it may not need a new exported interface at all.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

ⓘ The new review experience is currently in Beta. Learn more

Grey Divider

Qodo Logo

Comment on lines +160 to +174
urlText = new SimpleStringProperty("");
urlTextValidator = new FunctionBasedValidator<>(urlText, input -> {
if (StringUtil.isBlank(input)) {
return false;
}

String normalized = input.trim();
String lower = normalized.toLowerCase(Locale.ROOT);

if (!lower.startsWith("http://") && !lower.startsWith("https://")) {
normalized = "https://" + normalized;
}

return URLUtil.isValidHttpUrl(normalized);
}, ValidationMessage.error(Localization.lang("Please enter a valid HTTP or HTTPS URL.")));
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Action required

2. Url scheme not stored 🐞 Bug ≡ Correctness

The URL validator accepts schemeless inputs by prepending "https://" only for validation, but the
worker/fetcher persists the original text, so entries can be created with invalid URL values (e.g.,
"example.com"). This breaks the promise of “valid URL” and can lead to non-clickable/unusable URL
fields downstream.
Agent Prompt
### Issue description
The URL validator prepends `https://` for validation, but the actual stored URL comes from the original `urlText` value, which may be schemeless. This allows a value to be considered “valid” in the UI while persisting an invalid URL into the created `@Misc` entry.

### Issue Context
- Validation currently normalizes into a local variable only.
- `WorkerLookupUrl` passes the original `urlText` to `GenericUrlBasedFetcher`.
- `GenericUrlBasedFetcher` trims and stores the URL as-is.

### Fix Focus Areas
- jabgui/src/main/java/org/jabref/gui/newentry/NewEntryViewModel.java[160-174]
- jabgui/src/main/java/org/jabref/gui/newentry/NewEntryViewModel.java[502-520]
- jablib/src/main/java/org/jabref/logic/importer/fetcher/GenericUrlBasedFetcher.java[16-27]

### Suggested fix
Apply the same normalization used during validation to the value that is persisted, e.g.:
- Normalize in `WorkerLookupUrl.call()` (preferred: single point before fetch/import), and pass `normalized` to the fetcher.
  - `normalized = text.trim();`
  - If missing scheme, prefix `https://`.
- Or move normalization into `GenericUrlBasedFetcher.fetchEntryFromUrl` so all callers get consistent behavior.
- Optionally update `urlText` with the normalized value so the UI and stored data match exactly.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

@InAnYan InAnYan removed their assignment Apr 7, 2026
@jabref-machine
Copy link
Copy Markdown
Collaborator

Your code currently does not meet JabRef's code guidelines. IntelliJ auto format covers some cases. There seem to be issues with your code style and autoformat configuration. Please reformat your code (Ctrl+Alt+L) and commit, then push.

Copy link
Copy Markdown
Contributor

@pluto-han pluto-han left a comment

Choose a reason for hiding this comment

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

This is far away from reviewable...At least please take a look at #15458 (review)


@FXML private TextArea bibtexText;

@FXML private Tab tabEnterUrl;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

You can move this line below @FXML private Tab tabSpecifyBibtex;

Comment on lines +493 to +495
if (urlText != null) {
Platform.runLater(() -> urlText.requestFocus());
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Clipboard content should also be in the text field.

see dialog-with-text-input.md

Comment on lines +12 to +14
public String getName() {
return "Generic URL Fetcher";
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Implement getName() in WebFetcher interface.

What's the use of a method if its only called by test?

import org.jabref.model.entry.field.StandardField;
import org.jabref.model.entry.types.StandardEntryType;

public class GenericUrlBasedFetcher {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Quote from issue description: "Add one implementation GenericUrlBasedFetcher just generating a @misc entry with URL."

You mark this PR reviewable again without doing anything from #15458 (review)???

return "Generic URL Fetcher";
}

public List<BibEntry> fetchEntryFromUrl(String url) throws FetcherException {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

FetcherException is never used?

Comment on lines +21 to +28
String trimmedUrl = url.trim();
if (!trimmedUrl.startsWith("http://") && !trimmedUrl.startsWith("https://")) {
trimmedUrl = "https://" + trimmedUrl;
}

BibEntry entry = new BibEntry(StandardEntryType.Misc)
.withField(StandardField.URL, trimmedUrl);
return List.of(entry);
Copy link
Copy Markdown
Contributor

@pluto-han pluto-han Apr 11, 2026

Choose a reason for hiding this comment

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

Too many flaws...

  1. It creats ONE entry and puts it into a list? So this method always returns a list containing ONE element?!

  2. This class is a "fetcher", but only creates a bibentry with the url? At least it should "fetch" something? Otherwise, is there any useful information for users? Please think about the requirement as a "user": what do you want for this feature?

Image
  1. I dont get the point of trimmedUrl, I think its a very very bad name...Also, you add url.trim().isEmpty() above, why don't you trim it at the very beginning, so you don't have to trim twice...

  2. You should at least check if the url is valid in viewmodel...

Image

}

return URLUtil.isValidHttpUrl(normalized);
}, ValidationMessage.error(Localization.lang("Please enter a valid HTTP or HTTPS URL.")));
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

  1. Why add http:// in a validator? So you add http:// for the url and expect validator to return error "Please enter a valid HTTP or HTTPS URL."?|

  2. What is lower and normalized? Bad naming

  3. What if users use "http://1234" or even "1234", validity check still passes...

  4. Line 169-171 is duplicate with Line 22-24 in GenericUrlBasedFetcher.java‎

initializeLookupIdentifier();
initializeInterpretCitations();
initializeSpecifyBibTeX();
initializeEnterUrl();
Copy link
Copy Markdown
Contributor

@pluto-han pluto-han Apr 12, 2026

Choose a reason for hiding this comment

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

Can you change the name? "EnterUrl" is the action of end users. Here, it should be something JabRef does.

Also for switchEnterUrl, tabEnterUrl, etc...

@github-actions github-actions bot added status: changes-required Pull requests that are not yet complete and removed status: no-bot-comments labels Apr 12, 2026
@pluto-han
Copy link
Copy Markdown
Contributor

pluto-han commented Apr 12, 2026

Plus, can you describe what you have done in commit messages, instead of update which file...
You should be responsible for people who review this PR in the future.

@subhramit
Copy link
Copy Markdown
Member

subhramit commented Apr 18, 2026

The PR seems too far away from mergeable state plus the contributor is inactive since a week, so closing for future tries.
Thanks for the effort in reviewing @pluto-han, hopefully your comments will still be helpful in future PRs to this issue.

@subhramit subhramit closed this Apr 18, 2026
@github-actions
Copy link
Copy Markdown
Contributor

This pull requests was closed without merging. You have been unassigned from the respective issue #15411. In case you closed the PR for yourself, you can re-open it. Please also check After submission of a pull request in CONTRIBUTING.md.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

component: fetcher good first issue An issue intended for project-newcomers. Varies in difficulty. status: changes-required Pull requests that are not yet complete

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add entry using URL

8 participants