custom attribute parser fails with empty string for namespace

Description

Our build has a dependency on a different implementation of the XMLStreamReader IF; specifically, we use the stax_parser class com.ctc.wstx.sr.ValidatingStreamReader

This implementation treats the target namespace as an empty string instead of a null value (as seen with the xerces class com.sun.org.apache.xerces.internal.impl.XMLStreamReaderImpl). I assume other parsers may have similar behavior. Would it be possible to check for both null and empty string in the BpmnXMLUtil method writeCustomAttributes() as follows:

if (attribute.getNamespacePrefix() == null) {
if (attribute.getNamespace() == null || "".equals(attribute.getNamespace()))
xtw.writeAttribute(attribute.getName(), attribute.getValue());
else {
xtw.writeAttribute(attribute.getNamespace(), attribute.getName(), attribute.getValue());
}

The NamespacePrefix is null in both cases, but perhaps it should also include an empty string check.

Note this was regressed using the existing org.activiti.editor.language.xml.ValuedDataObjectConverterTest case.

Environment

5.15 Activiti
Windows 7 Enterprise SP 1 on a 64 bit system

Assignee

Tijs Rademakers

Reporter

Lori Small

Labels

None

Components

Fix versions

Affects versions

Priority

Major
Configure