Closed mwojno-tsg closed 3 years ago
Note - more evaluation is needed to see if this is happening only for certain forms, or if it's a certain feature within the form that triggers the error. When we tested the Change Request
form in the PnP accelerator back in February, it didn't run into this issue.
Fix with OC Revision: 26988 XML TO JSON, REPLACE EMPTY STRINGS WITH EMPTY OBJECTS - We updated the version of the JSON jar we pull in since newer versions of ACS use updated JSON jars, however with the newer jars the xml to json conversion was updated. Previously empty XML tags were set to empty JSONObjects in the converted JSON, however in newer versions the empty XML tags were set to empty strings in the converted JSON. We had a few places in our code that expected empty JSONObjects and thus had some failures. Linked below are two github issues that were the result of the new jar using empty strings. To fix this we created a util function in the JSONUtil to convert empty strings to empty objects, we don't want to do this for every empty string in the JSON however as there could be empty attributes such as name or type that came from the XML. Therefore, we set up a whitelist of XML tag names to convert from empty string to empty object in the wizard config. The whitelist can be found in the wizard-defaults.properties file and is accessed through a getter in the wizard config. Any area in the wizard code calling the XML to JSON method now calls the util function immediately after with the whitelist from the wizard config. CR aking, skovacinski
Reopening, needs fix to be compatible across json jars
Updated OC Revision for compatibility across JSON jars - 26999 JSONUTIL UPDATING JSON ITERATION TO WORK WITH ALL JARS - Needed to update the json iteration process to support older json jars utilized in older alfresco versions. We cannot use the keySet function across all jars switching to keys iterator.
CR: aking, skovacinski
Overview
This is an interesting that popped up in a customer's environment who was recently upgraded to Alfresco 7. The issue appears to have been found after a change was executed on the e-form within the WizardAdmin. To apply the change in the environment, a publish page set needs to be made and that appears to where the issue happened.
If you aren't familiar, the publish in WizardAdmin will create a JSON rendition of the xml pageset. It appears the JSON that is created is valid but has some issues within it because there are errors encountered on the OCMS side when a user tries to create a new form.
Another important detail is that the Change Request form that is deployed by default in the ACA PnP environments does not encounter this issue. So, that is why this edge case issue was not caught in our testing when upgrading to Alfresco 7. It appears this issue happens on complex forms. The form I tested has 140+ pages and a complex page flow with multiple queries.
Steps to Reproduce
/content/content
call where it grabs the JSON rendition of the form to then parse on the OCMS side. Here is the errors you will receive in the browser.Thoughts About Issue
json-20090211.jar
to usingjson-20200518.jar
. See: https://github.com/tsgrp/HPI/issues/2363. We fixed a few areas within OC that were breaking as a result. This change will be a great starting point to investigate a little more on what exactly changed.org.json.XML
.