You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ws.apache.org by ve...@apache.org on 2016/05/14 10:58:56 UTC
svn commit: r1743809 -
/webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/stream/stax/MTOMXMLStreamWriterImpl.java
Author: veithen
Date: Sat May 14 10:58:56 2016
New Revision: 1743809
URL: http://svn.apache.org/viewvc?rev=1743809&view=rev
Log:
Code simplification.
Modified:
webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/stream/stax/MTOMXMLStreamWriterImpl.java
Modified: webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/stream/stax/MTOMXMLStreamWriterImpl.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/stream/stax/MTOMXMLStreamWriterImpl.java?rev=1743809&r1=1743808&r2=1743809&view=diff
==============================================================================
--- webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/stream/stax/MTOMXMLStreamWriterImpl.java (original)
+++ webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/stream/stax/MTOMXMLStreamWriterImpl.java Sat May 14 10:58:56 2016
@@ -74,7 +74,7 @@ public class MTOMXMLStreamWriterImpl ext
private static final Log log = LogFactory.getLog(MTOMXMLStreamWriterImpl.class);
private XMLStreamWriter xmlWriter;
private List<Part> otherParts = new LinkedList<Part>();
- private OMMultipartWriter multipartWriter;
+ private final OMMultipartWriter multipartWriter;
private final OutputStream rootPartOutputStream;
private OMOutputFormat format;
private final OptimizationPolicy optimizationPolicy;
@@ -96,6 +96,7 @@ public class MTOMXMLStreamWriterImpl ext
this.format = format;
optimizationPolicy = new OptimizationPolicyImpl(format);
preserveAttachments = true;
+ multipartWriter = null;
rootPartOutputStream = null;
}
@@ -150,19 +151,24 @@ public class MTOMXMLStreamWriterImpl ext
} catch (IOException ex) {
throw new XMLStreamException(ex);
}
+ } else {
+ multipartWriter = null;
+ rootPartOutputStream = outStream;
+ }
+
+ xmlWriter = StAXUtils.createXMLStreamWriter(format.getStAXWriterConfiguration(),
+ rootPartOutputStream, encoding);
+
+ if (format.isOptimized()) {
ContentIDGenerator contentIDGenerator = new ContentIDGenerator() {
public String generateContentID(String existingContentID) {
return existingContentID != null ? existingContentID : getNextContentId();
}
};
- xmlWriter = new XOPEncodingStreamWriter(StAXUtils.createXMLStreamWriter(
- format.getStAXWriterConfiguration(), rootPartOutputStream, encoding),
+ xmlWriter = new XOPEncodingStreamWriter(xmlWriter,
contentIDGenerator, optimizationPolicy);
- } else {
- rootPartOutputStream = outStream;
- xmlWriter = StAXUtils.createXMLStreamWriter(format.getStAXWriterConfiguration(),
- outStream, format.getCharSetEncoding());
}
+
xmlStreamWriterFilter = format.getXmlStreamWriterFilter();
if (xmlStreamWriterFilter != null) {
if (log.isDebugEnabled()) {