IQSS / IQSS/dataverse

MyData and non-harvested datasets in harvested dataverses

Open
#11,083 8 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Type: Bug
Dominant language
Java
Stars
1.1k
Forks
564
Avg merge
2d 2h
Merged PRs (30d)
29

Description

The MyData API implicitely assumes that all datasets in a dataverse linked to a harvesting client are harvested datasets. This produces incomplete results.

Steps to reproduce

  • create a dataverse and publish it
  • make this dataverse an harvest client and harvest some datasets
  • create a user with 'Dataset creator' rights in this dataverse
  • create a dataset with this user in this dataverse
  • go to 'My Data'
  • select only the role 'Dataset Creator'

Tested on 5.13, 6.0 and develop (6.4)

Results
The request to load the data fails with a NullPointerException and results are never shown:

api/v1/mydata/retrieve?selected_page=1&dvobject_types=Dataverse&dvobject_types=Dataset&published_states=Published&published_states=Unpublished&published_states=Draft&published_states=In%20Review&published_states=Deaccessioned&role_ids=5&&mydata_search_term=
java.lang.NullPointerException: Cannot invoke "java.util.List.isEmpty()" because "results" is null
at edu.harvard.iq.dataverse.mydata.MyDataFinder.runStep2DirectAssignments(MyDataFinder.java:500)
at edu.harvard.iq.dataverse.mydata.MyDataFinder.runFindDataSteps(MyDataFinder.java:177)
at edu.harvard.iq.dataverse.mydata.DataRetrieverAPI.retrieveMyDataAsJsonString(DataRetrieverAPI.java:347)
...

The underlying cause of the NPE is that all checks regarding the absence of results are made before filtering against harvested dataverses.
If the user has other datasets in another dataverse, the request doesn't fail but the dataset in the harvesting dataverse is not listed.

Are you thinking about creating a pull request for this issue?
I can look into a PR to fix the NPE.
Adapting MyData to list the missing datasets feels like a bigger undertaking.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in src/main/java/edu/harvard/iq/dataverse/mydata/MyDataFinder.java, especially runFindDataSteps, runStep2DirectAssignments, and the referenced logic around line 120; then trace the request through DataRetrieverAPI.retrieveMyDataAsJsonString. Reproduce the harvested-dataverse scenario and verify that My Data no longer fails with a NullPointerException and lists the non-harvested dataset.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
api, backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.