You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In our application we are using the jibx 1.4.2 marshalling API in the following manner (error handling omitted for brevity):
final IBindingFactory factory = BindingDirectory.getFactory(SomeClass.class);
final IMarshallingContext mctx = factory.createMarshallingContext();
mctx.setIndent(4); // pretty print
mctx.startDocument("UTF-8", null, new FileOutputStream(settingsFile));
mctx.marshalDocument(settings);
When attempting to serialize a structure SomeClass using a value-style="attribute" for String field which contains a character belonging to the Unicode supplementary plane such as "\ud83d\udc27" this causes jibx to throw an exception:
Caused by: java.io.IOException: Illegal character code 0xd83e in attribute value text
A similar issue was fixed shortly before jibx 1.4.2 has been released through this commit, but the fix was only applied to the ICharacterEscaper implementations. Problem is that the above shown example effectively calls org.jibx.runtime.impl.MarshallingContext.startDocument(String enc, Boolean alone, OutputStream outs), which delegates to org.jibx.runtime.impl.MarshallingContext.setOutput(OutputStream outs, String enc). This method begins with a special handling for detecting the encoding types "UTF-8" and "ISO-8859-1" and calls setOutput(outs, enc, createEscaper(enc)) affected by the fix only otherwise. The special handling for "UTF-8" and "ISO-8859-1" invoke org.jibx.runtime.impl.UTF8StreamWriter and org.jibx.runtime.impl.ISO88591StreamWriter, respectively, but both stream writers use writeAttributeText in this case where an equivalent fix has not been applied (Their writeTextContent and writeCData methods seem to be affected by the issue as well).
The text was updated successfully, but these errors were encountered:
In our application we are using the jibx 1.4.2 marshalling API in the following manner (error handling omitted for brevity):
When attempting to serialize a structure
SomeClass
using a value-style="attribute" forString
field which contains a character belonging to the Unicode supplementary plane such as "\ud83d\udc27" this causes jibx to throw an exception:A similar issue was fixed shortly before jibx 1.4.2 has been released through this commit, but the fix was only applied to the
ICharacterEscaper
implementations. Problem is that the above shown example effectively callsorg.jibx.runtime.impl.MarshallingContext.startDocument(String enc, Boolean alone, OutputStream outs)
, which delegates toorg.jibx.runtime.impl.MarshallingContext.setOutput(OutputStream outs, String enc)
. This method begins with a special handling for detecting the encoding types "UTF-8" and "ISO-8859-1" and callssetOutput(outs, enc, createEscaper(enc))
affected by the fix only otherwise. The special handling for "UTF-8" and "ISO-8859-1" invokeorg.jibx.runtime.impl.UTF8StreamWriter
andorg.jibx.runtime.impl.ISO88591StreamWriter
, respectively, but both stream writers usewriteAttributeText
in this case where an equivalent fix has not been applied (TheirwriteTextContent
andwriteCData
methods seem to be affected by the issue as well).The text was updated successfully, but these errors were encountered: