Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DANS-1691 - possible fix for NPE when using IndirectList #10983

Draft
wants to merge 4 commits into
base: develop
Choose a base branch
from

Conversation

qqmyers
Copy link
Member

@qqmyers qqmyers commented Oct 30, 2024

What this PR does / why we need it: DANS is seeing occasional 500 errors from a pre-publication workflow on a dataset with 12K files. The error comes from an NPE after a call the the IndirectList.iterator() method called from our code starting in the editVersionMetadata API call.

  java.lang.NullPointerException: Cannot invoke "org.eclipse.persistence.descriptors.DescriptorEvent.getDescriptor()" because "event" is null
        ...
        at org.eclipse.persistence.indirection.IndirectList.iterator(IndirectList.java:560)
        at edu.harvard.iq.dataverse.FileMetadata.getCategories(FileMetadata.java:221)
        at edu.harvard.iq.dataverse.FileMetadata.getCategoriesByName(FileMetadata.java:253)
        at edu.harvard.iq.dataverse.util.json.JsonPrinter.getFileCategories(JsonPrinter.java:996)
        at edu.harvard.iq.dataverse.util.json.JsonPrinter.json(JsonPrinter.java:698)
        at edu.harvard.iq.dataverse.util.json.JsonPrinter.json(JsonPrinter.java:680)
        at edu.harvard.iq.dataverse.util.json.JsonPrinter.jsonFileMetadatas(JsonPrinter.java:534)
        at edu.harvard.iq.dataverse.util.json.JsonPrinter.json(JsonPrinter.java:474)
        at edu.harvard.iq.dataverse.util.json.JsonPrinter.json(JsonPrinter.java:416)
        at edu.harvard.iq.dataverse.api.Datasets.processDatasetUpdate(Datasets.java:1145)
        at edu.harvard.iq.dataverse.api.Datasets.editVersionMetadata(Datasets.java:1031)
        ...

As we've seen bugs related to the IndirectList class before, this PR simply avoids using iterator by changing the format of the for loop used in FileMetadata.getCategories().

This is a draft PR so DANS can check that this has an effect/fixes the occasional bug.

Which issue(s) this PR closes:

  • Closes #

Special notes for your reviewer:

Suggestions on how to test this:

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:

@coveralls
Copy link

coveralls commented Oct 30, 2024

Coverage Status

coverage: 21.221% (-0.003%) from 21.224%
when pulling 22aa7dc on GlobalDataverseCommunityConsortium:DANS_1691
into 6a00ce5 on IQSS:develop.

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