Skip to content

Fix MyData 500 Error when results include files - #12663

Open
ChengShi-1 wants to merge 2 commits into
developfrom
mydata-bigint-fix
Open

Fix MyData 500 Error when results include files#12663
ChengShi-1 wants to merge 2 commits into
developfrom
mydata-bigint-fix

Conversation

@ChengShi-1

@ChengShi-1 ChengShi-1 commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

What this PR does / why we need it:

Related to #12498 merged
dvId = ((Number)ra[0]).longValue(); here

On installations whose database was created recently, dvobject.id is a bigint column, so the JDBC driver returns a Long for it. My Data read that value as an Integer, which made /api/mydata/retrieve (and the My Data page) fail with a ClassCastException and an HTTP 500 for any request whose results included a file. The value is now read as a Number, which is correct whether the column is an integer (older databases) or a bigint (newer ones).

Which issue(s) this PR closes:

  • Closes #

Special notes for your reviewer:

Suggestions on how to test this:

Requires a freshly created database

  • Log in as a superuser.
  • As that user, create a collection, create a dataset in it, and upload a file to the dataset.
  • Wait for the dataset and file to be indexed in Solr.
  • Open My Data, or call:
    GET /api/v1/mydata/retrieve ?role_ids=1&role_ids=2&role_ids=3&role_ids=4&role_ids=5&role_ids=6&role_ids=7&role_ids=8 &dvobject_types=Dataverse&dvobject_types=Dataset&dvobject_types=DataFile &published_states=Draft&published_states=Unpublished

Before this change that returns a 500; after it, the collection, dataset and file are returned. Requests that exclude DataFile succeed either way, which is a useful control:

dvobject_types before after
Dataverse + Dataset + DataFile 500 3 results
DataFile 500 1 result
Dataverse + Dataset 2 results 2 results

Does this PR introduce a user interface change? If mockups are available, please link/include them here:

Is there a release notes update needed for this change?:

Additional documentation:

RoleTagRetriever.findDataverseIdsForFiles cast dvobject.id to Integer.
That column is an integer in databases created by older releases but a
bigint in newly created ones, so the JDBC driver returns a Long and the
cast threw a ClassCastException, failing every My Data request whose
results included a file.

Read the value as a Number instead, which is correct for both column
types and needs no migration. DvObjectServiceBean.getObjectPathsByIds
had the same cast, where it silently skipped rows rather than throwing.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@coveralls

coveralls commented Sep 1, 2026

Copy link
Copy Markdown

Coverage Status

coverage: 25.242%. remained the same — mydata-bigint-fix into develop

@sonarqubecloud

sonarqubecloud Bot commented Sep 1, 2026

Copy link
Copy Markdown

@github-actions

This comment has been minimized.

@ChengShi-1 ChengShi-1 added Size: 0.5 A percentage of a sprint. 0.35 hours FY27 Sprint 5 FY27 Sprint 5 (2026-08-26 - 2026-09-09) labels Sep 1, 2026
@ChengShi-1 ChengShi-1 moved this to Ready for Review ⏩ in IQSS Dataverse Project Sep 1, 2026
@ChengShi-1 ChengShi-1 added the Type: Bug a defect label Sep 1, 2026
@github-actions

github-actions Bot commented Sep 1, 2026

Copy link
Copy Markdown

📦 Pushed preview images as

ghcr.io/gdcc/dataverse:mydata-bigint-fix
ghcr.io/gdcc/configbaker:mydata-bigint-fix

🚢 See on GHCR. Use by referencing with full name as printed above, mind the registry name.

@github-actions

github-actions Bot commented Sep 1, 2026

Copy link
Copy Markdown

Test Results

404 tests  ±0   389 ✅ +2   38m 10s ⏱️ + 6m 42s
 55 suites ±0    15 💤 ±0 
 55 files   ±0     0 ❌  - 2 

Results for commit 7112a27. ± Comparison against base commit 44f0f27.

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

Labels

FY27 Sprint 5 FY27 Sprint 5 (2026-08-26 - 2026-09-09) Size: 0.5 A percentage of a sprint. 0.35 hours Type: Bug a defect

Projects

Status: Ready for Review ⏩

Development

Successfully merging this pull request may close these issues.

2 participants