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

Missing null check during existing dataset export #306

Open
ValentinFutterer opened this issue Dec 16, 2024 · 0 comments · May be fixed by #313
Open

Missing null check during existing dataset export #306

ValentinFutterer opened this issue Dec 16, 2024 · 0 comments · May be fixed by #313
Labels
bug Something isn't working

Comments

@ValentinFutterer
Copy link
Collaborator

ValentinFutterer commented Dec 16, 2024

Describe the bug
Starting at line 1164 in composeTableReusedDatasets in AbstractTemplateExportScienceEuropeComponents :

        if (dataset.getDatasetIdentifier() != null) {
          docVar.add(dataset.getDatasetIdentifier().getIdentifier());
        } else {
          docVar.add("");
        }

This code only checks if the identifier is null, but it does not check if the identifier field is null. This causes an error in AbstractTemplateExportFunctions, insertTableCells :

List<String> lines = cellContent.get(i).lines().toList();

Both parts of the code should receive according null checks.

The bug causes certain legacy dmps in our demo instance to be unexportable, since they have identifiers where onyl the type is set. But this could theoretically also happen in production, when OpenAire returns an empty identifer (didnt check if this is possible)
You can also trigger it, when you manually add an existing dataset with a source and then delete the source. Then try to export. You should look into why this exact behaviour happens.

Is this a regression?
Yes.

Steps to Reproduce
Log into the db and add a dataset identifer with only the type set and the identifer string null. Then try to export. Or try to export DMP: 2146 in our demo instance.

Alternatively manually create an existing dataset with a source. Then delete the source and try to export.

Expected behavior
Exporting should still work.

Environment

  • Damap version 4.3.1
@ValentinFutterer ValentinFutterer added the bug Something isn't working label Dec 16, 2024
@GeoffreyKarnbach GeoffreyKarnbach self-assigned this Dec 23, 2024
@GeoffreyKarnbach GeoffreyKarnbach removed their assignment Dec 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants