Skip to content

Commit

Permalink
backward compatibility for the old style license encoding. #9148 #9155
Browse files Browse the repository at this point in the history
  • Loading branch information
landreev committed Apr 28, 2023
1 parent 332742f commit a82d3a7
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions src/main/java/edu/harvard/iq/dataverse/util/json/JsonParser.java
Original file line number Diff line number Diff line change
Expand Up @@ -373,14 +373,22 @@ public DatasetVersion parseDatasetVersion(JsonObject obj, DatasetVersion dsv) th
License license = null;

try {
// This method will attempt to parse the license in the format
// in which it appears in our json exports, as a compound
// field, for ex.:
// "license": {
// "name": "CC0 1.0",
// "uri": "http://creativecommons.org/publicdomain/zero/1.0"
// }
license = parseLicense(obj.getJsonObject("license"));
} catch (ClassCastException cce) {
// TODO: decide if we want to leave some backward compatibility code
// in place, in case someone is still using the "license" : "CC0 NN"
// json form.
logger.info("class cast exception parsing the license section");
// attempt to parse as string: (?)
// license = parseLicense(obj.getString("license", null));
logger.fine("class cast exception parsing the license section (will try parsing as a string)");
// attempt to parse as string:
// i.e. this is for backward compatibility, after the bug in #9155
// was fixed, with the old style of encoding the license info
// in input json, for ex.:
// "license" : "CC0 1.0"
license = parseLicense(obj.getString("license", null));
}

if (license == null) {
Expand Down

0 comments on commit a82d3a7

Please sign in to comment.