Skip to content

Handle missing mapping namespaces gracefully#830

Open
prashantkumarniraj wants to merge 1 commit intodbpedia:masterfrom
prashantkumarniraj:fix-missing-mapping-namespaces
Open

Handle missing mapping namespaces gracefully#830
prashantkumarniraj wants to merge 1 commit intodbpedia:masterfrom
prashantkumarniraj:fix-missing-mapping-namespaces

Conversation

@prashantkumarniraj
Copy link

@prashantkumarniraj prashantkumarniraj commented Feb 5, 2026

This fixes a server startup crash when enabling languages that do not have
mapping namespaces (e.g. fi, et, lt).

Instead of throwing NoSuchElementException, such languages are now logged
and skipped.

Fixes #827

Summary by CodeRabbit

  • Bug Fixes
    • Improved reliability of namespace mapping resolution with enhanced error handling and early exit mechanisms when resources are unavailable.
    • Strengthened local mapping file handling with comprehensive validation and fallback support.
    • Enhanced diagnostic logging for missing namespaces and file-loading scenarios.

@coderabbitai
Copy link

coderabbitai bot commented Feb 5, 2026

📝 Walkthrough

Walkthrough

Modified error handling in ExtractionManager.scala to gracefully handle missing mapping namespaces for unsupported languages. Instead of throwing NoSuchElementException, the code now uses optional namespace resolution with early exits, logging warnings, and returning empty mappings when namespaces are unavailable.

Changes

Cohort / File(s) Summary
Error Handling for Missing Namespaces
server/src/main/scala/org/dbpedia/extraction/server/ExtractionManager.scala
Replaced mandatory namespace retrieval with optional approach using Some for "wikidata" and .get() fallback. Added early exit when namespace is missing with warning log. Centralized source selection logic to check local file existence before loading from server, with appropriate warning logs for missing files or local file usage.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title directly summarizes the main change: handling missing mapping namespaces gracefully instead of throwing exceptions.
Linked Issues check ✅ Passed The PR implements the required fix for issue #827 by handling languages without mapping namespaces gracefully and logging warnings instead of throwing exceptions.
Out of Scope Changes check ✅ Passed All changes in ExtractionManager.scala are directly scoped to resolving the missing mapping namespace issue and preventing server startup crashes.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@sonarqubecloud
Copy link

sonarqubecloud bot commented Feb 5, 2026

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

NoSuchElementExeption for languages fi,et,lt

1 participant