Skip to content

Fix DiscoJuice feeds 204 on no-SP dev instances: ship discofeedResponse.json in main resources - #1414

Closed
Kasinhou wants to merge 1 commit into
dtq-dev-9-basefrom
ufal/discojuice-testfeed-9-base
Closed

Fix DiscoJuice feeds 204 on no-SP dev instances: ship discofeedResponse.json in main resources#1414
Kasinhou wants to merge 1 commit into
dtq-dev-9-basefrom
ufal/discojuice-testfeed-9-base

Conversation

@Kasinhou

Copy link
Copy Markdown

Problem

On dev-6 (no Shibboleth SP), GET /server/api/discojuice/feeds returns HTTP 204. The Angular UI's DiscoJuice auto-popup then crashes in discojuice.js ($.merge(a.data, undefined)Cannot read properties of undefined (reading 'length')), which:

  • logs a console error on /login and /register (the latter redirects to /login), and
  • prevents the "Local authentication" entry from rendering, so login-from-search can't click it.

This breaks three dspace-ui-tests (NAME=lindat-9) Playwright tests. The frontend discojuice.js is byte-identical to v7 and works on dev-5 (prod) because there the feed is populated by a real SP — so the fix is backend-only.

Root cause

ClarinDiscoJuiceFeedsDownloadService.openURLConnection() serves the bundled feed via getResource("discofeedResponse.json") when shibboleth.discofeed.url starts with TEST:. But discofeedResponse.json lived only under src/test/resources, so it is not packaged into the server webapp. On a real deployment TEST: resolves to nullNoContentExceptiondownloadJSON() swallows the IOException → the feed cache stays empty → controller returns 204.

(dev-6 also can't use the default shibboleth.discofeed.url = https://dev-5.pc:8443/...: that host uses a self-signed cert and the default disable.ssl.check.specific.requests = false makes Java reject it — another path to an empty feed.)

Change

Move discofeedResponse.json from src/test/resources to src/main/resources (identical classpath location org/dspace/app/rest/). It now ships in the webapp so TEST: serves a non-empty feed at runtime. It remains on the test classpath, so ClarinDiscoJuiceFeedsControllerIT is unaffected.

Verified mvn -pl dspace-server-webapp process-resources copies it to target/classes/org/dspace/app/rest/discofeedResponse.json — exactly where getResource(...) looks at runtime.

Deploy step for dev-6 (server-side local.cfg, not committed — keeps it scoped to dev-6)

shibboleth.discofeed.allowed = true
shibboleth.discofeed.url = TEST:
# discojuice.rewriteCountries is inherited from clarin-dspace.cfg

With this, /api/discojuice/feeds returns 200 with the bundled feed (?callback=dj_md_1 wraps it), the DiscoJuice crash is gone, and the three UI tests pass. No global config is changed, so prod (dev-5) keeps fetching its real SP feed.

🤖 Generated with Claude Code

… when deployed

ClarinDiscoJuiceFeedsDownloadService.openURLConnection() resolves the bundled
DiscoJuice feed via getResource("discofeedResponse.json") whenever
shibboleth.discofeed.url starts with `TEST:`. That resource only existed under
src/test/resources, so it is absent from the packaged server webapp: on a real
deployment `TEST:` resolves to null, downloadJSON() catches the resulting
IOException, the feed cache stays empty, and GET /api/discojuice/feeds returns
204. The UI DiscoJuice auto-popup then crashes on an undefined feed.

Move the fixture into src/main/resources (same classpath location) so it ships
in the webapp and TEST: serves a non-empty feed at runtime. It stays on the
test classpath too, so ClarinDiscoJuiceFeedsControllerIT is unaffected.

Enables no-SP dev instances (e.g. dev-6) to serve a populated feed via
local.cfg: shibboleth.discofeed.allowed=true + shibboleth.discofeed.url=TEST:

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot wasn't able to review any files in this pull request.


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@Kasinhou
Kasinhou requested a review from milanmajchrak August 19, 2026 08:23
@Kasinhou

Copy link
Copy Markdown
Author

Closed as wont fix an actual problem

@Kasinhou Kasinhou closed this Aug 19, 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.

2 participants