Repository navigation
[Port to black-forest] Handle missing entry types in shared databases - #15
Merged
Merged
Conversation
### Summary Shared database entry loading now falls back to `Misc` when the stored entry type is null or blank, preventing malformed rows from crashing JabRef. The behavior is covered by PostgreSQL-backed tests and an OpenFastTrace requirement. Analogies: Like honey, the fallback smooths a rough edge; like chocolate, it makes an unpleasant database state easier to handle; like the moon, it keeps the shared database visible when its type is missing. jabref-contrib-policy:4.2:reviewed:ok ### Steps to test 1. Set up a PostgreSQL shared database and connect JabRef to it. 2. Insert a shared entry whose `entrytype` is `NULL` or contains only whitespace. 3. Reconnect or reload the shared database. 4. Confirm that JabRef loads the entry as `Misc`, preserves the entry, and logs a warning instead of failing. No screenshot is applicable because this is a backend-only robustness change with no new or changed UI. ### Related issues and pull requests Closes JabRef#15658 ### AI usage Codex (model GPT-5), AIL2: used for repository investigation, implementation assistance, test creation, documentation updates, and verification. The contributor reviewed, understood, and takes full ownership of the submitted changes. <details> <summary>AI CHECKLIST.md walkthrough</summary> ## 1. Code self-review ### Nullability and control flow - [x] No `== null` / `!= null` checks — JSpecify annotations (`@NullMarked`, `@Nullable`, `@NonNull`) used instead. - [x] No `Objects.requireNonNull(...)` — nullability expressed via JSpecify annotations. - [/] New classes annotated with `@NullMarked` (`org.jspecify.annotations.NullMarked`): no new classes. - [/] New packages annotated with `@NullMarked` (`org.jspecify.annotations.NullMarked`): no new packages. - [x] `Optional` consumed with `ifPresent` / `ifPresentOrElse` / `map` / `orElseThrow` — never `orElse(unusedValue)` nor an `isPresent()` + `get()` block. - [x] `StringUtil.isBlank(...)` used instead of `s == null || s.isBlank()`. ### Exceptions - [x] No `catch (Exception e)` — only specific exceptions are caught. - [x] No `throw new RuntimeException(...)` / `IllegalStateException(...)` — these tear down the whole application. - [x] Logged exceptions are passed as the **last** logger argument (`LOGGER.info("...", e)`), not concatenated into the message string. ### Style and idioms - [x] New `BibEntry` objects built with withers (`withField`, not `setField`). - [x] Modern Java used: `List.of()` / `Map.of()` / `Set.of()`, `Path.of()`, `SequencedCollection` / `SequencedSet`, text blocks. - [x] Regexes use a precompiled `Pattern.compile(...)` constant, not `String.matches(...)`. - [x] Keep alphabetical ordering when adding variables or enum items. - [x] Background work uses `org.jabref.logic.util.BackgroundTask`, not `new Thread()`. - [x] No commented-out code, no trivial comments restating the code, no AI-disclosure comments in source. - [x] Markdown Javadoc (`///`) uses Markdown syntax, not JavaDoc inline tags: `` `code` `` instead of `{@code}`, `[ClassName]` instead of `{@link}`. ### User-facing text - [/] All user-facing text localized (`Localization.lang` in Java, `%` prefix in FXML): no new user-facing text. - [/] Sentence case (not Title Case); no trailing `!`; labels do not end with `:`: no new UI labels. - [/] Variance expressed with placeholders (`"...: %0"`), not string concatenation: no localized text added. ### Security - [/] User-controlled data (request params, entry fields, file contents) is HTML-escaped before being written into any `text/html` response: no HTML response changed. ### Tests - [x] In case issue lists an example, this concrete example is covered by a test case. - [x] Behavior changes in `org.jabref.model` / `org.jabref.logic` have added or updated tests. - [x] Tests assert object contents (`assertEquals`), use plain JUnit asserts (not AssertJ), have no `@DisplayName`, do not catch exceptions, and use `@TempDir` instead of manual temp directories. - [/] Fetcher tests hit the live endpoints — no fetcher tests changed. ## 2. Verification commands - [x] `./gradlew :jablib:check` (or `./gradlew check` for all modules). - [x] `./gradlew checkstyleMain checkstyleTest checkstyleJmh`. - [x] `./gradlew modernizer`. - [x] `./gradlew --no-configuration-cache :rewriteDryRun` reports no changes. - [x] `./gradlew javadoc`. - [x] `npx markdownlint-cli2 "docs/**/*.md" "*.md"`. - [x] `npm ci && npm run textlint` reports no misspellings. - [/] Docker IntelliJ formatting: formatting was already clean after rewrite validation. ## 3. Documentation - [x] CHANGELOG.md entry added for the user-visible shared-database robustness fix. - [x] Searched for and linked the confident matching JabRef issue. - [x] Requirement added to `docs/requirements/shared-database.md`. - [x] Developer documentation/requirements updated for the changed shared-database behavior. ## 4. Pull request - [x] PR body built from `.github/PULL_REQUEST_TEMPLATE.md`, every section filled. - [x] All checklist items kept and marked `[x]`, `[ ]`, or `[/]`. - [/] Steps include no screenshot because the change has no visible UI. - [x] All HTML comments removed from the PR body. - [x] PR created with `gh pr create --body-file <file>`. - [/] No `TODO` placeholder was used because issue JabRef#15658 is identified. </details> ### Checklist - [x] I own the copyright of the code submitted and I license it under the [MIT license](https://github.com/JabRef/jabref/blob/main/LICENSE) - [x] If AI tools were used, I disclosed them in the "AI usage" section and reviewed, understood, and take full ownership of all AI-generated code - [ ] I manually tested my changes in running JabRef (always required) - [x] I added JUnit tests for changes (if applicable) - [/] I added screenshots in the PR description (if change is visible to the user) - [x] I added **one sentence (max 20 words)** to `CHANGELOG.md` describing the change from the user's point of view (if the change is visible to the user) - [/] I checked the [user documentation](https://docs.jabref.org/) for up to dateness and submitted a pull request to our [user documentation repository](https://github.com/JabRef/user-documentation/tree/main/en) (cherry picked from commit 388f89b)
36 of 37 tasks
github-merge-queue
Bot
removed this pull request from the merge queue due to a conflict with the base branch
Nov 2, 2026
…650-to-black-forest
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
koppor
enabled auto-merge
November 4, 2026 21:58
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Port of JabRef#17650 to
black-forest, see Branching strategy.If this PR is a draft, the cherry-pick conflicted: the conflicting files are committed with Git's conflict markers left in. Resolve the markers locally, push, and mark the PR ready.