Skip to content

Conversation

@palukku
Copy link
Member

@palukku palukku commented Jan 5, 2026

User description

Closes #14807

Steps to test

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.

PR Type

Bug fix


Description


Diagram Walkthrough

flowchart LR
  A["ServiceLocator initialization"] -->|"addOneConstant"| B["preferences constant"]
  B -->|"with name & type"| C["CliPreferences injection"]
Loading

File Walkthrough

Relevant files
Bug fix
Server.java
Add name and type to preferences constant registration     

jabsrv/src/main/java/org/jabref/http/server/Server.java

  • Modified addOneConstant call for preferences to include name parameter
    "preferences"
  • Added type parameter CliPreferences.class for proper type binding
  • Ensures ServiceLocator can correctly inject preferences dependency
+1/-1     

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

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
🟡
🎫 #14807
🟢 Fix preferences dependency injection in ServiceLocator
Fix HTTP 500 error returned by /libraries/demo endpoint
Ensure endpoint returns HTTP 200 OK status
Ensure response Content-Type is application/json
Ensure /tmp/demo.json contains valid demo JSON payload (approximately 10,975 bytes)
Fix issue introduced by commit 636b37c from PR
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: Robust Error Handling and Edge Case Management

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

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: Security-First Input Validation and Data Handling

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

Status: Passed

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

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

Copy link
Member

@subhramit subhramit left a comment

Choose a reason for hiding this comment

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

approving based on discussion in call/chat

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

PR Code Suggestions ✨

Explore these optional code suggestions:

CategorySuggestion                                                                                                                                    Impact
Possible issue
Preserve interface bindings for dependency injection

To avoid breaking dependency injection, use an overload of addOneConstant that
preserves interface bindings while still adding a name to the preferences
object.

jabsrv/src/main/java/org/jabref/http/server/Server.java [98]

-ServiceLocatorUtilities.addOneConstant(serviceLocator, preferences, "preferences", CliPreferences.class);
+ServiceLocatorUtilities.addOneConstant(serviceLocator, preferences, "preferences");
  • Apply / Chat
Suggestion importance[1-10]: 7

__

Why: The suggestion correctly identifies a subtle but important change in the dependency injection binding behavior, which could unintentionally break other parts of the application that rely on interface injection.

Medium
  • More

@koppor koppor added this pull request to the merge queue Jan 6, 2026
Merged via the queue into JabRef:main with commit a99e92a Jan 6, 2026
69 of 78 checks passed
@koppor koppor deleted the fix-jabsrv-preferences-injection branch January 6, 2026 05:48
Siedlerchr added a commit that referenced this pull request Jan 6, 2026
…es/jablib/src/main/resources/csl-locales-50e46eb

* upstream/main: (119 commits)
  chore(sbom): update CycloneDX SBOM files (#14813)
  Add "preferences" constant to ServiceLocator initialization (#14810)
  adjust bom generation to only use runtime (#14809)
  Remove (nearly) obsolete hint in ghprcomment.yml
  Update dependency org.apache.commons:commons-lang3 to v3.20.0 (#14808)
  Fix Nullwarnings - B (#14802)
  Add https
  Add ouput
  Fix stale (again)
  Fix output
  Fix re-downloading of ltwa file
  Chore(deps): Bump jablib/src/main/resources/csl-styles from `9bb1fc1` to `0201999` (#14796)
  Chore(deps): Bump org.ow2.asm:asm from 9.9 to 9.9.1 in /versions (#14799)
  Chore(deps): Bump org.controlsfx:controlsfx in /versions (#14800)
  Chore(deps): Bump org.postgresql:postgresql in /versions (#14798)
  Chore(deps): Bump jablib/src/main/abbrv.jabref.org (#14795)
  Chore(deps): Bump org.apache.logging.log4j:log4j-to-slf4j in /versions (#14797)
  Chore(deps): Bump org.apache.commons:commons-text from 1.14.0 to 1.15.0 in /versions (#14801)
  fix postgres for arm (#14792)
  Docs: minor grammar and clarity fixes in privacy policy (#14786)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

HTTP server endpoint /libraries/demo fails (returns HTTP 500 with HTML), breaking demo library retrieval.

3 participants