diff --git a/src/main/java/edu/harvard/iq/dataverse/util/json/JsonParser.java b/src/main/java/edu/harvard/iq/dataverse/util/json/JsonParser.java index 49525c70a38..8b17e168e6d 100644 --- a/src/main/java/edu/harvard/iq/dataverse/util/json/JsonParser.java +++ b/src/main/java/edu/harvard/iq/dataverse/util/json/JsonParser.java @@ -172,8 +172,12 @@ public DatasetVersion parseDatasetVersion(JsonObject obj, DatasetVersion dsv) th dsv.setDeaccessionLink(obj.getString("deaccessionLink", null)); dsv.setVersionNumber((long) obj.getInt("versionNumber", -1)); dsv.setMinorVersionNumber(parseLong(obj.getString("minorVersionNumber", null))); - dsv.setId(parseLong(obj.getString("id", null))); - + // if the existing datasetversion doesn not have an id + // use the id from the json object. + if (dsv.getId()==null) { + dsv.setId(parseLong(obj.getString("id", null))); + } + String versionStateStr = obj.getString("versionState", null); if (versionStateStr != null) { dsv.setVersionState(DatasetVersion.VersionState.valueOf(versionStateStr));