Skip to content

500 server error when adding a dataset in dataverse where default template has no associated terms #8599

@scolapasta

Description

@scolapasta

This was reported by a user via RT:
They click Add Dataset on their dataverse and get a 500 error page.

The reason is that a null pointer is being thrown. After some investigation, it turns out that the dataset has a default template with no associated terms (termsofuseandaccess_id is null on the template) and that in turn causes the null pointer on line 163 of DatasetUtil:
License license = dsv.getTermsOfUseAndAccess().getLicense();

The workaround we suggested is to go and edit the template and associate terms (even if empty) to the template.

I did try to reproduce on demo with a new dataverse, but I wasn't able to create a template with no terms (I tried briefly) so it's possible that can't be done anymore and only affects some legacy templates (in prod, there were 89 such templates, 48 of which were set as a default template).

The fix could be one of:
• db update to create empty terms for any existing templates (and verify there is no way to create any such new ones)
• change line 163 to make sure dsv.getTermsOfUseAndAccess() is not null before calling getLicense()

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions