Task #843
Updated by Petr FiĊĦer about 7 years ago
When backing up script from the library, invalid xml file can sometimes be produced. This boils down to using generics in the script, consider this (the script does nothing useful, but it contains reproducible case for reported bug): <pre> import org.joda.time.LocalDate; import eu.bcvsolutions.idm.core.api.dto.IdmIdentityContractDto; List<IdmIdentityContractDto> contracts = identityContractService.findAllValidForDate(entity.getId(),new LocalDate(),null); if (contracts == null) { return 1; } return 0; </pre> Resulting XML looks like: <pre> <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <script> <allowClasses> <allowClass> <className>org.joda.time.LocalDate</className> </allowClass> <allowClass> <className>eu.bcvsolutions.idm.core.api.dto.IdmIdentityContractDto</className> </allowClass> <allowClass> <className>eu.bcvsolutions.idm.core.eav.api.dto.IdmFormValueDto</className> </allowClass> </allowClasses> <body>import org.joda.time.LocalDate; import eu.bcvsolutions.idm.core.api.dto.IdmIdentityContractDto; List<IdmIdentityContractDto> contracts = identityContractService.findAllValidForDate(entity.getId(),new LocalDate(),null); if (contracts == null) { return 1; } return 0;</body> <category>TRANSFORM_TO</category> <code>somescript</code> <description><p><br></p></description> <name>Somescript</name> <services> <service> <name>identityContractService</name> </service> <service> <name>formService</name> </service> </services> <type>groovy</type> </script> </pre> Note the orphaned tag *<IdmIdentityContractDto>* which was generics in the code. However now it is creating malformed XML document. Possible resolutions: * Wrap script body in the CDATA tags. * Upon backup, convert every < and > in the script body into & lt; < and & gt;. >. Convert it to < and > upon import. Assigning to Ondra, reassign as needed. :)