Skip to content

Conversation

@kammari-ashritha
Copy link

@kammari-ashritha kammari-ashritha commented Jan 28, 2026

Closes #14185

I implemented the logic to update bibliographic information using entry data (Title/Author) via the MultiMergeEntriesView. This adds a new action to the "Lookup" menu and renames the existing identifier-based action for clarity.

Steps to test

  1. Create a new entry with only a Title and Author (e.g., Title: Attention is All You Need, Author: Vaswani).
  2. Select the entry in the main table.
  3. Go to Lookup -> Update with bibliographic information from the web via entry data.
  4. The merge dialog should appear with fetched data.

Screenshots

Screenshot 1
Screenshot 2

Mandatory checks

  • 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 described the change in CHANGELOG.md in a way that is understandable for the average user (if change is visible to the user)
  • [/] I checked the user 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 updating file(s) in https://github.com/JabRef/user-documentation/tree/main/en.

@github-actions
Copy link
Contributor

Hey @kammari-ashritha! 👋

Thank you for contributing to JabRef!

We have automated checks in place, based on which you will soon get feedback if any of them are failing. We also use Qodo for review assistance. It will update your pull request description with a review help and offer suggestions to improve the pull request.

After all automated checks pass, a maintainer will also review your contribution. Once that happens, you can go through their comments in the "Files changed" tab and act on them, or reply to the conversation if you have further inputs. You can read about the whole pull request process in our contribution guide.

Please ensure that your pull request is in line with our AI Usage Policy and make necessary disclosures.

@github-actions github-actions bot added first contrib good first issue An issue intended for project-newcomers. Varies in difficulty. labels Jan 28, 2026
@qodo-free-for-open-source-projects
Copy link
Contributor

qodo-free-for-open-source-projects bot commented Jan 28, 2026

PR Compliance Guide 🔍

Below is a summary of compliance checks for this PR:

Security Compliance
🟢
No security concerns identified No security vulnerabilities detected by AI analysis. Human verification advised for critical code.
Ticket Compliance
🎫 No ticket provided
  • Create ticket/issue
Codebase Duplication Compliance
Codebase context is not defined

Follow the guide to enable codebase context checks.

Custom Compliance
🟢
Generic: Comprehensive Audit Trails

Objective: To create a detailed and reliable record of critical system actions for security analysis
and compliance.

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Meaningful Naming and Self-Documenting Code

Objective: Ensure all identifiers clearly express their purpose and intent, making code
self-documenting

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Secure Error Handling

Objective: To prevent the leakage of sensitive system information through error messages while
providing sufficient detail for internal debugging.

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Secure Logging Practices

Objective: To ensure logs are useful for debugging and auditing without exposing sensitive
information like PII, PHI, or cardholder data.

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

🔴
Generic: Robust Error Handling and Edge Case Management

Objective: Ensure comprehensive error handling that provides meaningful context and graceful
degradation

Status:
Silent Exception Handling: The FetcherException is caught and returns null without logging the error or providing
user feedback about the failure.

Referred Code
try {
    return fetcher.performSearch(selectedEntry).stream().findFirst().orElse(null);
} catch (FetcherException e) {
    return null;
}

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Security-First Input Validation and Data Handling

Objective: Ensure all data inputs are validated, sanitized, and handled securely to prevent
vulnerabilities

Status:
Missing Input Validation: The selectedEntry from user selection is used directly without validation of its fields
before being passed to web fetchers.

Referred Code
BibEntry selectedEntry = stateManager.getSelectedEntries().get(0);

// This constructor is correct (GuiPreferences, TaskExecutor)
MultiMergeEntriesView mergeView = new MultiMergeEntriesView(preferences, taskExecutor);

mergeView.addSource("Original", () -> selectedEntry);

// FIXED: The 4th argument must be the BibDatabaseContext
var fetchers = WebFetchers.getEntryBasedFetchers(
        preferences.getImporterPreferences(),
        preferences.getImportFormatPreferences(),
        preferences.getFilePreferences(),
        stateManager.getActiveDatabase().get() // THIS WAS THE MISSING KEY
);

for (var fetcher : fetchers) {
    mergeView.addSource(fetcher.getName(), () -> {
        try {
            return fetcher.performSearch(selectedEntry).stream().findFirst().orElse(null);

Learn more about managing compliance generic rules or creating your own custom rules

  • Update
Compliance status legend 🟢 - Fully Compliant
🟡 - Partial Compliant
🔴 - Not Compliant
⚪ - Requires Further Human Verification
🏷️ - Compliance label

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

qodo-free-for-open-source-projects bot commented Jan 28, 2026

PR Code Suggestions ✨

Explore these optional code suggestions:

CategorySuggestion                                                                                                                                    Impact
Possible issue
Disable action for multiple selections
Suggestion Impact:The commit directly implements the suggestion by adding the import for ActionHelper (line 5) and binding the executable property to needsEntriesSelected(1, stateManager) in the constructor (line 14). This ensures the action is only enabled when exactly one entry is selected.

code diff:

+import org.jabref.gui.actions.ActionHelper;
 import org.jabref.gui.actions.SimpleCommand;
 import org.jabref.gui.mergeentries.multiwaymerge.MultiMergeEntriesView;
 import org.jabref.gui.preferences.GuiPreferences;
@@ -25,6 +26,8 @@
         this.dialogService = dialogService;
         this.preferences = preferences;
         this.taskExecutor = taskExecutor;
+
+        this.executableProperty().bind(ActionHelper.needsEntriesSelected(1, stateManager));

Disable the action if more than one entry is selected. This can be done by
binding the executable property in the constructor to only allow execution when
exactly one entry is selected.

jabgui/src/main/java/org/jabref/gui/importer/actions/UpdateWithWebInfoAction.java [13-36]

+    import org.jabref.gui.actions.ActionHelper;
+
     public class UpdateWithWebInfoAction extends SimpleCommand {
 
         private final StateManager stateManager;
         private final DialogService dialogService;
         private final GuiPreferences preferences;
         private final TaskExecutor taskExecutor;
 
         public UpdateWithWebInfoAction(StateManager stateManager,
                                        DialogService dialogService,
                                        GuiPreferences preferences,
                                        TaskExecutor taskExecutor) {
             this.stateManager = stateManager;
             this.dialogService = dialogService;
             this.preferences = preferences;
             this.taskExecutor = taskExecutor;
+
+            this.executable.bind(ActionHelper.needsEntriesSelected(1, stateManager));
         }
 
         @Override
         public void execute() {
-            if (stateManager.getActiveDatabase().isEmpty() || stateManager.getSelectedEntries().isEmpty()) {
+            // The check for isEmpty() is still useful as a safeguard, even with the executable binding.
+            if (stateManager.getSelectedEntries().isEmpty()) {
                 return;
             }
 
             BibEntry selectedEntry = stateManager.getSelectedEntries().get(0);
     ...
-```

[To ensure code accuracy, apply this suggestion manually]

Suggestion importance[1-10]: 7

__

Why: The suggestion correctly identifies that the action silently operates on only the first of multiple selected entries, which is poor usability. Binding the action's executability to a single selection is a significant improvement for user experience.

Medium
General
Log exceptions from web fetchers

Log the FetcherException instead of silently ignoring it. This will aid in
debugging when a web fetcher fails to retrieve information.

jabgui/src/main/java/org/jabref/gui/importer/actions/UpdateWithWebInfoAction.java [51-59]

+    private static final org.slf4j.Logger LOGGER = org.slf4j.LoggerFactory.getLogger(UpdateWithWebInfoAction.class);
+
+    ...
+
     for (var fetcher : fetchers) {
         mergeView.addSource(fetcher.getName(), () -> {
             try {
                 return fetcher.performSearch(selectedEntry).stream().findFirst().orElse(null);
             } catch (FetcherException e) {
+                LOGGER.warn("Failed to fetch information for entry {} using fetcher {}", selectedEntry.getCitationKey().orElse("<no key>"), fetcher.getName(), e);
                 return null;
             }
         });
     }
-```

[To ensure code accuracy, apply this suggestion manually]

Suggestion importance[1-10]: 6

__

Why: The suggestion correctly points out that silently catching the FetcherException is bad practice. Logging the exception improves maintainability and debuggability by providing insights into why a fetcher might have failed.

Low
  • Update

@github-actions github-actions bot added the status: changes-required Pull requests that are not yet complete label Jan 28, 2026
@kammari-ashritha kammari-ashritha force-pushed the main branch 2 times, most recently from 5eacee9 to a005057 Compare January 28, 2026 17:07
@kammari-ashritha
Copy link
Author

@koppor I have fixed the localization keys and resolved the conflicts. All unit tests are now passing (green). Ready for review!

@koppor
Copy link
Member

koppor commented Jan 30, 2026

@koppor I have fixed the localization keys and resolved the conflicts. All unit tests are now passing (green). Ready for review!

Please also address #14947 (comment)

@kammari-ashritha
Copy link
Author

@koppor I have updated the PR description to strictly follow the standard template and included all mandatory checklist items. The description is now manually formatted. Ready for review.

@koppor
Copy link
Member

koppor commented Jan 30, 2026

@koppor I have updated the PR description to strictly follow the standard template and included all mandatory checklist items. The description is now manually formatted. Ready for review.

Please go through the checklist and either finish the TODO or mark it as n/a. See the temple.

@kammari-ashritha
Copy link
Author

@koppor I have updated the checklist. I marked the TODO items as n/a ([/]) because they are not applicable to this specific change. Ready for review.

@koppor
Copy link
Member

koppor commented Jan 30, 2026

@koppor I have updated the checklist. I marked the TODO items as n/a ([/]) because they are not applicable to this specific change. Ready for review.

Nice. Next time do it straight from the beginning!

@kammari-ashritha
Copy link
Author

Understood. I will ensure to follow the guidelines strictly from the start in future contributions. Thanks for your patience.

@kammari-ashritha
Copy link
Author

@koppor I have updated the code to use the executableProperty binding as requested.

The Unit Tests and Binaries are all passing (Green). The JBang failures seem unrelated to my changes in UpdateWithWebInfoAction.java.

Ready for final review!

@koppor koppor added the status: ready-for-review Pull Requests that are ready to be reviewed by the maintainers label Feb 1, 2026
@github-actions github-actions bot removed the status: ready-for-review Pull Requests that are ready to be reviewed by the maintainers label Feb 1, 2026
@kammari-ashritha
Copy link
Author

@koppor Thank you for the review. I have refactored the code to use getFirst() and wrapped the source name in Localization.lang("Original") to ensure proper translation support. Ready for merge.

@koppor
Copy link
Member

koppor commented Feb 2, 2026

@koppor Thank you for the review. I have refactored the code to use getFirst() and wrapped the source name in Localization.lang("Original") to ensure proper translation support. Ready for merge.

It's ready for review - however, it's not. See comments of the bot. Plesae check

rg.jabref.logic.l10n.LocalizationConsistencyTest findMissingLocalizationKeys() FAILED

  org.opentest4j.AssertionFailedError: 
  DETECTED LANGUAGE KEYS WHICH ARE NOT IN THE ENGLISH LANGUAGE FILE.
  PASTE THESE INTO THE ENGLISH LANGUAGE FILE "JabRef_en.properties".
  Search for a proper place; typically related keys are grouped together.
  If a similar key is already present, please adapt your language instead of adding load to translators by adding a new key.
  
  Original=Original
  
   ==> expected: <[]> but was: <[Original (../jabgui/src/main/java/org/jabref/gui/importer/actions/UpdateWithWebInfoAction.java LANG)]>
      at app/org.jabref.jablib/org.jabref.logic.l10n.LocalizationConsistencyTest.findMissingLocalizationKeys(LocalizationConsistencyTest.java:131)

@koppor
Copy link
Member

koppor commented Feb 2, 2026

PR was more than 800 commits behind main. WHY?

grafik

@kammari-ashritha
Copy link
Author

@koppor I have removed var and used explicit types (Set). I also added the missing Original=Original key to JabRef_en.properties to fix the localization test.

I am fully committed to completing this task correctly. Ready for review.

@jabref-machine
Copy link
Collaborator

You committed your code on the main brach of your fork. This is a bad practice. The right way is to branch out from main, work on your patch/feature in that new branch, and then get that branch merged via the pull request (see GitHub flow).

For this pull request, this is OK. For subsequent pull requests, please start with a different branch with a proper branch name. See CONTRIBUTING.md for more details.

@koppor koppor added the status: ready-for-review Pull Requests that are ready to be reviewed by the maintainers label Feb 2, 2026
@github-actions github-actions bot removed the status: ready-for-review Pull Requests that are ready to be reviewed by the maintainers label Feb 2, 2026
@ZiadAbdElFatah
Copy link
Contributor

ZiadAbdElFatah commented Feb 2, 2026

@koppor I tried the application using this pr, and found that the logic is ok. Some comments in the code seem suspicious, and you commented on them here #14947 (comment).
It's the first time for me to know that there is no var in JabRef.
I can see now that this issue is about to be closed so should I look for a new one or you want me to do anything in this issue before moving on to a new one ?

@jabref-machine
Copy link
Collaborator

Hey, we noticed that you force-pushed your changes. Force pushing is a bad practice when working together on a project (mainly because it is not supported well by GitHub itself). Commits are lost and comments on commits lose their context, thus making it harder to review changes.

When the pull request is getting integrated into main, all commits will be squashed anyway. Thus, your individual commit history will not be visible in main.

In future, please avoid that. For now, you can continue working.

@jabref-machine
Copy link
Collaborator

JUnit tests of jablib are failing. You can see which checks are failing by locating the box "Some checks were not successful" on the pull request page. To see the test output, locate "Source Code Tests / Unit tests (pull_request)" and click on it.

You can then run these tests in IntelliJ to reproduce the failing tests locally. We offer a quick test running howto in the section Final build system checks in our setup guide.

@koppor koppor added the status: ready-for-review Pull Requests that are ready to be reviewed by the maintainers label Feb 2, 2026
@koppor
Copy link
Member

koppor commented Feb 2, 2026

It's the first time for me to know that there is no var in JabRef.

Comes with more code reading.

What you could have seen that a CHANGELOG.md is missing.

@ZiadAbdElFatah
Copy link
Contributor

Yeah that is true.
I am glad that you gave me the opportunity to review some code, and hope to get better in reviewing codes in the future.

@koppor
Copy link
Member

koppor commented Feb 2, 2026

@ZiadAbdElFatah Can you re-create the PR? I think, you are using AI more properly than @kammari-ashritha . I am not patient enough to comment again.

@koppor koppor closed this Feb 2, 2026
@koppor
Copy link
Member

koppor commented Feb 2, 2026

@kammari-ashritha At first, your PR looked promising, but then it lost quality.

  • Menu item not available in JabRef
  • No CHANGELOG.md entry

I cannot work on that basis. The PR makes the impression, you are guiding an AI, but not checking its result.

@ZiadAbdElFatah
Copy link
Contributor

@ZiadAbdElFatah Can you re-create the PR? I think, you are using AI more properly than @kammari-ashritha . I am not patient enough to comment again.

Ok sure.

@koppor
Copy link
Member

koppor commented Feb 2, 2026

@kammari-ashritha You can try another issue if you want.

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

Labels

first contrib good first issue An issue intended for project-newcomers. Varies in difficulty. Review effort 2/5 status: changes-required Pull requests that are not yet complete status: ready-for-review Pull Requests that are ready to be reviewed by the maintainers

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Refine "Update with bibliographic information from the web"

4 participants