-
Notifications
You must be signed in to change notification settings - Fork 552
Provenance related fixes #12468
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Provenance related fixes #12468
Changes from 6 commits
d31dff7
916c464
4fdcc53
6a64bf9
c0ed795
37440da
40acb0f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| This release resolves two older issues about provenance files and improves the related documentation. | ||
|
|
||
| When uploading a wrong provenance JSON, the user was still able to click on the preview button which caused an exception. | ||
| From now on, this button will not be available. Also, the error message about the wrong JSON now includes information about what the error actually is. | ||
|
|
||
| The user guide and the GUI now explicitly state that Dataverse only accepts the PROV-JSON format. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -59,8 +59,9 @@ | |
| return error(FORBIDDEN, BundleUtil.getStringFromBundle("api.prov.error.jsonUpdateNotAllowed")); | ||
| } | ||
|
|
||
| if(!provUtil.isProvValid(body)) { | ||
| return error(BAD_REQUEST, BundleUtil.getStringFromBundle("file.editProvenanceDialog.invalidSchemaError")); | ||
| var schemaErrorMessages = provUtil.isProvValid(body); | ||
| if(!schemaErrorMessages.isEmpty()) { | ||
| return error(BAD_REQUEST, BundleUtil.getStringFromBundle("file.editProvenanceDialog.invalidSchemaError") + schemaErrorMessages.get()); | ||
Check warningCode scanning / CodeQL Information exposure through an error message Medium Error information Error loading related location Loading |
||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The exposed information is just error messages about a file uploaded by the user. Besides, only an authenticated user can call this endpoint. |
||
| } | ||
|
|
||
| /*Add when we actually integrate provCpl*/ | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -11,6 +11,7 @@ | |
| import java.util.Set; | ||
| import java.util.logging.Logger; | ||
| import jakarta.json.JsonObject; | ||
| import java.util.Optional; | ||
| import org.everit.json.schema.Schema; | ||
| import org.everit.json.schema.ValidationException; | ||
| import org.everit.json.schema.loader.SchemaLoader; | ||
|
|
@@ -114,18 +115,18 @@ public String getPrettyJsonString(JsonObject jsonObject) { | |
| return gson.toJson(je); | ||
| } | ||
|
|
||
| public boolean isProvValid(String jsonInput) { | ||
| public Optional<String> isProvValid(String jsonInput) { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. One would assume isProvValid would be a boolean. Consider re-naming the method to something that is more meaningful, I.e. optionalProvValidationMessage
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @stevenwinship Done! |
||
| try { | ||
| schema.validate(new JSONObject(jsonInput)); // throws a ValidationException if this object is invalid | ||
| } catch (ValidationException vx) { | ||
| logger.info("Prov schema error : " + vx); //without classLoader is blows up in actual deployment | ||
| return false; | ||
| return Optional.of(vx.getAllMessages().toString()); | ||
| } catch (Exception ex) { | ||
| logger.info("Prov file error : " + ex); | ||
| return false; | ||
| return Optional.of(ex.getMessage()); | ||
| } | ||
|
|
||
| return true; | ||
| return Optional.empty(); | ||
| } | ||
|
|
||
| //Pulled from https://www.w3.org/Submission/2013/SUBM-prov-json-20130424/schema | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.