Fix crossRef fetcher#14696
Conversation
PR Compliance Guide 🔍Below is a summary of compliance checks for this PR:
Compliance status legend🟢 - Fully Compliant🟡 - Partial Compliant 🔴 - Not Compliant ⚪ - Requires Further Human Verification 🏷️ - Compliance label |
||||||||||||||||||||||||
PR Code Suggestions ✨Explore these optional code suggestions:
|
|||||||||||
| if (unstructured.isMissingNode()) { | ||
| LOGGER.error("Reference has neither DOI nor unstructured text: {}", reference); | ||
| return new BibEntry() | ||
| .withField(StandardField.NOTE, "Could not retrieve reference information from CrossRef") |
There was a problem hiding this comment.
I suppose this is intentional
There was a problem hiding this comment.
Yes - quick hack to transport that to the user somehow.
Future work: investigate the cases.
* main: Update AI usage policy (#14698) Fix handling of DOIs (#14704) Handle ohter CrossRef response (#14696) Fix condition for processing closed issues/PRs Translate the English "change to Chinese(simplified)" to the Chinese in the warning dialog (#14690) More performance optimization (#14695) Add missing dot (and a link) Add link to PR template also if checklist is present, but not OK (#14694) Fix typo in IntelliJ code style instructions (#14693) Add import into new library to Welcome Tab (#14669) Add initial search requirements (#14633)
User description
Triggered by #14652
Follow-up to #14357
Still has issues with some references - but this is future work.
Steps to test
Patch this into #14652 and select "CrossRef"
Mandatory checks
CHANGELOG.mdin a way that is understandable for the average user (if change is visible to the user)PR Type
Bug fix
Description
Handle CrossRef responses missing unstructured reference text
Add null-safety checks for optional reference fields
Return fallback BibEntry when both DOI and unstructured text unavailable
Improve error logging for incomplete reference data
Diagram Walkthrough
flowchart LR A["CrossRef Response"] --> B{"Has DOI?"} B -->|Yes| C{"Has unstructured?"} B -->|No| D{"Has unstructured?"} C -->|Yes| E["Create from DOI + text"] C -->|No| F["Create from DOI only"] D -->|Yes| G["Parse unstructured text"] D -->|No| H["Return fallback entry"]File Walkthrough
CrossRefCitationFetcher.java
Add null-safety for missing reference fieldsjablib/src/main/java/org/jabref/logic/importer/fetcher/citation/crossref/CrossRefCitationFetcher.java
unstructuredfromStringtoJsonNodeto detect missing valuesunstructured text are missing
getBibEntryFromDoi()to conditionally set NOTE field only whenunstructured text exists
information