Skip to content

Commit

Permalink
Add null check to avoid future issues
Browse files Browse the repository at this point in the history
  • Loading branch information
qqmyers committed Sep 27, 2023
1 parent e3fbd02 commit c9c6cf2
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/main/java/edu/harvard/iq/dataverse/DatasetPage.java
Original file line number Diff line number Diff line change
Expand Up @@ -2863,6 +2863,12 @@ public void sort() {
public String refresh() {
logger.fine("refreshing");

//In v5.14, versionId was null here. In 6.0, it appears not to be.
//This check is to handle the null if it reappears/occurs under other circumstances
if(versionId==null) {
logger.fine("versionId was null in refresh");
versionId = workingVersion.getId();
}
//dataset = datasetService.find(dataset.getId());
dataset = null;
workingVersion = null;
Expand All @@ -2872,10 +2878,9 @@ public String refresh() {
DatasetVersionServiceBean.RetrieveDatasetVersionResponse retrieveDatasetVersionResponse = null;

if (versionId != null) {
// versionId must have been set by now, in the init() method,
// regardless of how the page was originally called - by the dataset
// database id, by the persistent identifier, or by the db id of
// the version.
// versionId must have been set by now (see null check above), in the init()
// method, regardless of how the page was originally called - by the dataset
// database id, by the persistent identifier, or by the db id of the version.
this.workingVersion = datasetVersionService.findDeep(versionId);
dataset = workingVersion.getDataset();
}
Expand Down

0 comments on commit c9c6cf2

Please sign in to comment.