XMLStreamWriter writer = message.getContent(XMLStreamWriter.class);
if (os == null || writer != null) {
return;
}
String encoding = getEncoding(message);
<BUG>try {
writer = getXMLOutputFactory(message).createXMLStreamWriter(os, encoding);

if (Boolean.TRUE.equals(message.getContextualProperty(FORCE_START_DOCUMENT))) {</BUG>
writer.writeStartDocument(encoding, "1.0");

XMLStreamWriter writer = message.getContent(XMLStreamWriter.class);
if (os == null || writer != null) {
return;
}
String encoding = getEncoding(message);
try {
XMLOutputFactory factory = getXMLOutputFactory(message);
synchronized (factory) {
writer = factory.createXMLStreamWriter(os, encoding);
}
if (Boolean.TRUE.equals(message.getContextualProperty(FORCE_START_DOCUMENT))) {
writer.writeStartDocument(encoding, "1.0");
