tsgrp / HPI

OpenContent Management Suite (OCMS)
http://www.tsgrp.com/products
17 stars 5 forks source link

Complex Form's JSON Rendition Invalid After Publish in Alfresco 7 in ACA PnP #2430

Closed mwojno-tsg closed 3 years ago

mwojno-tsg commented 3 years ago

Overview

Steps to Reproduce

image

Thoughts About Issue

gsteimer commented 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.

engerernoah commented 3 years ago

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

engerernoah commented 3 years ago

Reopening, needs fix to be compatible across json jars

engerernoah commented 3 years ago

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