Skip to content

Commit

Permalink
NullPointerException for custom dataset terms
Browse files Browse the repository at this point in the history
  • Loading branch information
jo-pol committed Dec 22, 2023
1 parent 2b7e43d commit 54e7bd3
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/main/java/edu/harvard/iq/dataverse/dataset/DatasetUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import edu.harvard.iq.dataverse.DatasetField;
import edu.harvard.iq.dataverse.DatasetVersion;
import edu.harvard.iq.dataverse.FileMetadata;
import edu.harvard.iq.dataverse.GlobalId;
import edu.harvard.iq.dataverse.TermsOfUseAndAccess;
import edu.harvard.iq.dataverse.authorization.groups.impl.ipaddress.ip.IpAddress;
import edu.harvard.iq.dataverse.authorization.users.AuthenticatedUser;
Expand Down Expand Up @@ -584,10 +585,18 @@ public static String getLicenseURI(DatasetVersion dsv) {
: (dsv.getVersionState().name().equals("DRAFT")
? dsv.getDataverseSiteUrl()
+ "/api/datasets/:persistentId/versions/:draft/customlicense?persistentId="
+ dsv.getDataset().getGlobalId().asString()
+ getPid(dsv)
: dsv.getDataverseSiteUrl() + "/api/datasets/:persistentId/versions/" + dsv.getVersionNumber()
+ "." + dsv.getMinorVersionNumber() + "/customlicense?persistentId="
+ dsv.getDataset().getGlobalId().asString());
+ getPid(dsv));
}

private static String getPid(DatasetVersion dsv) {
GlobalId globalId = dsv.getDataset().getGlobalId();
if (globalId == null)
return "no-doi-yet";
else
return globalId.asString();
}

public static String getLicenseIcon(DatasetVersion dsv) {
Expand Down

0 comments on commit 54e7bd3

Please sign in to comment.