Skip to content

Support protected institutional authors in PersonNamesChecker#15175

Merged
Siedlerchr merged 4 commits intoJabRef:mainfrom
faneeshh:fix-institutional-author-warning
Feb 22, 2026
Merged

Support protected institutional authors in PersonNamesChecker#15175
Siedlerchr merged 4 commits intoJabRef:mainfrom
faneeshh:fix-institutional-author-warning

Conversation

@faneeshh
Copy link
Copy Markdown
Contributor

@faneeshh faneeshh commented Feb 21, 2026

Fixes #15157

Description
The PersonNamesChecker was stripping braces before validating the name format. This broke protected terms like {Institutional Author} because the parser would see them as "First Last" instead of a single unit, triggering a "not standard format" warning.

I've updated the logic to check the format with brackets first. If that's valid, we're good. If not, it falls back to the old behavior (stripping brackets) to make sure we don't break existing stuff like {JabRef}.

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

@github-actions github-actions Bot added the status: changes-required Pull requests that are not yet complete label Feb 21, 2026
@qodo-free-for-open-source-projects
Copy link
Copy Markdown
Contributor

Review Summary by Qodo

Support protected institutional authors in PersonNamesChecker

🐞 Bug fix

Grey Divider

Walkthroughs

Description
• Check name format with braces before stripping them
• Prevents false warnings for protected institutional authors
• Maintains backward compatibility with existing bracket handling
• Extracts format validation logic into reusable method
Diagram
flowchart LR
  A["Author name input"] --> B{"Check format<br/>with braces?"}
  B -->|Valid| C["Return empty<br/>no warning"]
  B -->|Invalid| D["Strip braces"]
  D --> E{"Check format<br/>without braces?"}
  E -->|Valid| C
  E -->|Invalid| F["Return format<br/>warning"]
Loading

Grey Divider

File Changes

1. jablib/src/main/java/org/jabref/logic/integrity/PersonNamesChecker.java 🐞 Bug fix +14/-4

Refactor format validation with bracket-first approach

• Reordered validation to check format with braces first before stripping them
• Extracted format validation logic into private isStandardFormat() method
• Changed variable name from value to valueWithoutBrackets for clarity
• Maintains fallback to bracket-stripping for backward compatibility

jablib/src/main/java/org/jabref/logic/integrity/PersonNamesChecker.java


2. jablib/src/test/java/org/jabref/logic/integrity/PersonNamesCheckerTest.java 🧪 Tests +6/-0

Add test for institutional author validation

• Added test case for institutional authors with spaces in author lists
• Verifies that {Institutional Author} in mixed author format produces no warnings

jablib/src/test/java/org/jabref/logic/integrity/PersonNamesCheckerTest.java


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

Document institutional author fix

• Added entry documenting the fix for institutional author warning issue
• References issue #15157 in the Fixed section

CHANGELOG.md


Grey Divider

Qodo Logo

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

Code Review by Qodo

🐞 Bugs (1) 📘 Rule violations (0) 📎 Requirement gaps (0)

Grey Divider


Remediation recommended

1. Redundant standard check 🐞 Bug ➹ Performance
Description
When a name string contains no curly braces and is not in standard format, the new logic calls
isStandardFormat twice with the exact same input, adding an unnecessary AuthorList.parse/cache
lookup on the error path.
Code

jablib/src/main/java/org/jabref/logic/integrity/PersonNamesChecker.java[R34-46]

+        // Check format with brackets first to support protected institutional authors
+        if (isStandardFormat(value)) {
+            return Optional.empty();
+        }
+
        // Remove all brackets to handle corporate names correctly, e.g., {JabRef}
-        value = new RemoveBrackets().format(value);
+        String valueWithoutBrackets = new RemoveBrackets().format(value);
+
        // Check that the value is in one of the two standard BibTeX formats:
        //  Last, First and ...
        //  First Last and ...
-        AuthorList authorList = AuthorList.parse(value);
-        if (!authorList.getAsLastFirstNamesWithAnd(false).equals(value)
-                && !authorList.getAsFirstLastNamesWithAnd().equals(value)) {
+        if (!isStandardFormat(valueWithoutBrackets)) {
            return Optional.of(Localization.lang("Names are not in the standard %0 format.", bibMode.getFormattedName()));
Evidence
PersonNamesChecker now checks standard format on the original string, then removes braces and checks
again. RemoveBrackets only removes '{' and '}', so if the input has no braces, the “without
brackets” string is identical, making the second check redundant. AuthorList.parse uses a
synchronized cache (computeIfAbsent), so the second call still performs a map lookup even if it does
not re-parse.

jablib/src/main/java/org/jabref/logic/integrity/PersonNamesChecker.java[34-46]
jablib/src/main/java/org/jabref/logic/layout/format/RemoveBrackets.java[10-18]
jablib/src/main/java/org/jabref/model/entry/AuthorList.java[173-177]

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

### Issue description
`PersonNamesChecker.checkValue` currently calls `isStandardFormat` twice even when removing brackets does not change the input (no `{`/`}` present). This adds a redundant `AuthorList.parse`/cache lookup on the invalid-name path.

### Issue Context
The first `isStandardFormat(value)` call is necessary to support protected institutional authors (the goal of this PR). The optimization should preserve that behavior.

### Fix Focus Areas
- jablib/src/main/java/org/jabref/logic/integrity/PersonNamesChecker.java[34-46]

### Suggested approach
After computing `valueWithoutBrackets`, short-circuit if it equals `value`:
- If `valueWithoutBrackets.equals(value)`, return the warning immediately (since the first check already failed).
- Otherwise, only then run `isStandardFormat(valueWithoutBrackets)`.

ⓘ 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

@github-actions
Copy link
Copy Markdown
Contributor

Your pull request conflicts with the target branch.

Please merge with your code. For a step-by-step guide to resolve merge conflicts, see https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/addressing-merge-conflicts/resolving-a-merge-conflict-using-the-command-line.

@github-actions github-actions Bot added the good first issue An issue intended for project-newcomers. Varies in difficulty. label Feb 21, 2026
calixtus
calixtus previously approved these changes Feb 21, 2026
Copy link
Copy Markdown
Member

@calixtus calixtus left a comment

Choose a reason for hiding this comment

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

Looks good to me. Awaiting second review.

@calixtus calixtus changed the title Fix #15157: Support protected institutional authors in PersonNamesChecker Support protected institutional authors in PersonNamesChecker Feb 21, 2026
@testlens-app
Copy link
Copy Markdown

testlens-app Bot commented Feb 21, 2026

✅ All tests passed ✅

🏷️ Commit: 5cc61a7
▶️ Tests: 11194 executed
⚪️ Checks: 51/51 completed


Learn more about TestLens at testlens.app.

@Siedlerchr Siedlerchr enabled auto-merge February 22, 2026 22:09
@github-actions github-actions Bot added status: no-bot-comments and removed status: changes-required Pull requests that are not yet complete labels Feb 22, 2026
@Siedlerchr Siedlerchr added this pull request to the merge queue Feb 22, 2026
@github-actions github-actions Bot added the status: to-be-merged PRs which are accepted and should go into the merge-queue. label Feb 22, 2026
Merged via the queue into JabRef:main with commit d5d7e96 Feb 22, 2026
51 checks passed
Siedlerchr added a commit to LoayTarek5/jabref that referenced this pull request Feb 23, 2026
…les-wizard-12709

* upstream/main: (106 commits)
  Merge common gating parts into composite action (JabRef#15197)
  Support protected institutional authors in PersonNamesChecker (JabRef#15175)
  adapt wix (JabRef#14969)
  Improve CI (JabRef#15189)
  Revert "Reduce complexity in dependencies setup (JabRef#15169)" (JabRef#15191)
  Fix compilation
  Fix heylogs test
  Fix icon on Linux (JabRef#15188)
  chore(deps): update dependency org.apache.maven.plugins:maven-surefire-plugin to v3.5.5 (JabRef#15178)
  New Crowdin updates (JabRef#15173)
  Reduce complexity in dependencies setup (JabRef#15169)
  Start new development cycle
  snapcraft
  snapcraft
  use snapctl
  update metadata fiels
  try with  mesa candidate
  fix snapcraft and skmanrc to use correct version
  Release v6.0-alpha.5
  chore(sbom): update CycloneDX SBOM files (JabRef#15172)
  ...
RakockiW pushed a commit to RakockiW/jabref that referenced this pull request Mar 1, 2026
…#15175)

* Fix JabRef#15157: Support protected institutional authors in PersonNamesChecker

* Fix CHANGELOG.md

---------

Co-authored-by: Carl Christian Snethlage <calixtus@users.noreply.github.com>
Co-authored-by: Christoph <siedlerkiller@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

good first issue An issue intended for project-newcomers. Varies in difficulty. status: no-bot-comments status: to-be-merged PRs which are accepted and should go into the merge-queue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Do not warn when author names include protected terms containing space

3 participants