You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-commits@axis.apache.org by ve...@apache.org on 2017/12/17 22:34:13 UTC

svn commit: r1818518 [11/30] - in /axis/axis2/java/core/branches/AXIS2-4091: ./ apidocs/ databinding-tests/ etc/ legal/ modules/adb-codegen/ modules/adb-codegen/src/org/apache/axis2/schema/ modules/adb-codegen/src/org/apache/axis2/schema/template/ modu...

Modified: axis/axis2/java/core/branches/AXIS2-4091/modules/jaxws/pom.xml
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/AXIS2-4091/modules/jaxws/pom.xml?rev=1818518&r1=1818517&r2=1818518&view=diff
==============================================================================
--- axis/axis2/java/core/branches/AXIS2-4091/modules/jaxws/pom.xml (original)
+++ axis/axis2/java/core/branches/AXIS2-4091/modules/jaxws/pom.xml Sun Dec 17 22:34:08 2017
@@ -22,9 +22,9 @@
     <modelVersion>4.0.0</modelVersion>
     <parent>
         <groupId>org.apache.axis2</groupId>
-        <artifactId>axis2-parent</artifactId>
-        <version>1.7.0-SNAPSHOT</version>
-        <relativePath>../parent/pom.xml</relativePath>
+        <artifactId>axis2</artifactId>
+        <version>1.8.0-SNAPSHOT</version>
+        <relativePath>../../pom.xml</relativePath>
     </parent>
     <artifactId>axis2-jaxws</artifactId>
     <name>Apache Axis2 - JAXWS</name>
@@ -54,8 +54,8 @@
             <version>${project.version}</version>
         </dependency>
         <dependency>
-            <groupId>org.apache.geronimo.specs</groupId>
-            <artifactId>geronimo-javamail_1.4_spec</artifactId>
+            <groupId>com.sun.mail</groupId>
+            <artifactId>javax.mail</artifactId>
         </dependency>
         <dependency>
             <groupId>xml-resolver</groupId>
@@ -115,10 +115,28 @@
             <scope>test</scope>
         </dependency>
         <dependency>
+            <groupId>org.apache.ws.commons.axiom</groupId>
+            <artifactId>xml-truth</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
             <groupId>log4j</groupId>
             <artifactId>log4j</artifactId>
             <scope>test</scope>
         </dependency>
+        <dependency>
+            <groupId>org.mockito</groupId>
+            <artifactId>mockito-core</artifactId>
+            <version>1.10.19</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>${project.groupId}</groupId>
+            <artifactId>addressing</artifactId>
+            <version>${project.version}</version>
+            <type>mar</type>
+            <scope>test</scope>
+        </dependency>
     </dependencies>
     <url>http://axis.apache.org/axis2/java/core/</url>
     <scm>
@@ -180,33 +198,27 @@
                 </executions>
             </plugin>
             <plugin>
-                <artifactId>maven-dependency-plugin</artifactId>
+                <groupId>com.github.veithen.alta</groupId>
+                <artifactId>alta-maven-plugin</artifactId>
                 <executions>
                     <execution>
-                        <phase>generate-resources</phase>
                         <goals>
-                            <goal>copy</goal>
+                            <goal>generate-properties</goal>
                         </goals>
                         <configuration>
-                            <artifactItems>
-                                <artifactItem>
+                            <artifacts>
+                                <artifact>
                                     <groupId>javax.xml.bind</groupId>
                                     <artifactId>jaxb-api</artifactId>
-                                    <type>jar</type>
-                                </artifactItem>
-                                <artifactItem>
-                                    <groupId>org.apache.geronimo.specs</groupId>
-                                    <artifactId>geronimo-saaj_1.3_spec</artifactId>
-                                    <type>jar</type>
-                                </artifactItem>
-                                <artifactItem>
+                                </artifact>
+                                <artifact>
                                     <groupId>org.apache.geronimo.specs</groupId>
                                     <artifactId>geronimo-jaxws_2.2_spec</artifactId>
-                                 </artifactItem>
-                            </artifactItems>
-                            <overWrite>true</overWrite>
-                            <outputDirectory>${project.build.directory}/endorsed</outputDirectory>
-                            <stripVersion>true</stripVersion>
+                                </artifact>
+                            </artifacts>
+                            <name>jaxws.bootclasspath</name>
+                            <value>%file%</value>
+                            <separator>${path.separator}</separator>
                         </configuration>
                     </execution>
                 </executions>
@@ -216,86 +228,101 @@
                 <inherited>true</inherited>
                 <configuration>
                     <compilerArgument>
-                        -Xbootclasspath/p:${project.build.directory}/endorsed/geronimo-jaxws_2.2_spec.jar${path.separator}${basedir}/../jaxws-api/target/classes${path.separator}${basedir}/../jws-api/target/classes
+                        -Xbootclasspath/p:${jaxws.bootclasspath}
                     </compilerArgument>
-                    <compilerVersion>1.5</compilerVersion>
-                    <source>1.5</source>
-                    <target>1.5</target>
-                    
                 </configuration>
             </plugin>
             <plugin>
-                <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-antrun-plugin</artifactId>
-                
+                <groupId>org.codehaus.mojo</groupId>
+                <artifactId>jaxb2-maven-plugin</artifactId>
                 <executions>
                     <execution>
-                        <id>gen-ts</id>
-                        <phase>generate-test-sources</phase>
+                        <id>xjc-echo</id>
+                        <goals>
+                            <goal>testXjc</goal>
+                        </goals>
                         <configuration>
-                            <tasks unless="maven.test.skip"> 
-                                <!-- Theres got to be a better way to do this -->
-                                <property name="schema.source.dir" value="test-resources/xsd" />
-                                <property name="wsdl.source.dir" value="test-resources/wsdl" />
-                                <property name="schema.output.base.dir" value="target/schema" />                             
-                                <property name="schema.generated.src.dir" value="${schema.output.base.dir}/src" />
-                                <property name="schema.generated.classes.dir" value="${schema.output.base.dir}/classes" />
-                               
-                                <!-- make the dirs -->
-                                <mkdir dir="${schema.output.base.dir}" />
-                                <mkdir dir="${schema.generated.src.dir}" />
-                                <mkdir dir="${schema.generated.classes.dir}" />
-
-                                <!-- Run JAXB schema compiler with designated schemas -->
-                                <echo>Generating JAX-B classes from XSDs</echo>
-
-                                <echo>Generating java from echo.xsd</echo>
-                                <java classname="com.sun.tools.xjc.Driver" fork="true">
-                                    <classpath refid="maven.runtime.classpath" />
-                                    
-                                    <classpath location="${compiled.classes.dir}" />
-                                    <arg line="-d ${schema.generated.src.dir} -quiet ${schema.source.dir}/echo.xsd" />
-                                </java>
-
-                                <echo>Generating java from stock1.xsd</echo>
-                                <java classname="com.sun.tools.xjc.Driver" fork="true">
-                                    <classpath refid="maven.runtime.classpath" />
-                                    <classpath location="${compiled.classes.dir}" />
-                                    <arg line="-d ${schema.generated.src.dir} -quiet ${schema.source.dir}/stock1.xsd" />
-                                </java>
-
-                                <echo>Generating java from stock2.xsd</echo>
-                                <java classname="com.sun.tools.xjc.Driver" fork="true">
-                                    <classpath refid="maven.runtime.classpath" />
-                                    <classpath location="${compiled.classes.dir}" />
-                                    <arg line="-d ${schema.generated.src.dir} -quiet ${schema.source.dir}/stock2.xsd" />
-                                </java>
-
-                                <echo>Generating java from samplemtom.xsd</echo>
-                                <java classname="com.sun.tools.xjc.Driver" fork="true">
-                                    <classpath refid="maven.runtime.classpath" />
-                                    <classpath location="${compiled.classes.dir}" />
-                                    <arg line="-d ${schema.generated.src.dir} -quiet ${schema.source.dir}/samplemtom.xsd" />
-                                </java>
-                                <echo>Generating java from ProxyDocLitWrapped.wsdl</echo>
-                                <java classname="com.sun.tools.xjc.Driver" fork="true">
-                                    <classpath refid="maven.runtime.classpath" />
-                                    <classpath location="${compiled.classes.dir}" />
-                                    <arg line="-d ${schema.generated.src.dir} -quiet -p org.test.proxy.doclitwrapped -quiet -wsdl ${wsdl.source.dir}/ProxyDocLitWrapped.wsdl" />
-                                </java>
-                                <echo>Generating java from AddNumbers.wsdl</echo>
-                                <java classname="com.sun.tools.xjc.Driver" fork="true">
-                                    <classpath refid="maven.runtime.classpath" />
-                                    <classpath location="${compiled.classes.dir}" />
-                                    <arg line="-d ${schema.generated.src.dir} -quiet -wsdl ${wsdl.source.dir}/AddNumbers.wsdl" />
-                                </java>                                
-                            </tasks>
+                            <sourceType>XmlSchema</sourceType>
+                            <testSources>
+                                <testSource>test-resources/xsd/echo.xsd</testSource>
+                            </testSources>
+                            <outputDirectory>${project.build.directory}/generated-test-sources/jaxb/echo</outputDirectory>
+                        </configuration>
+                    </execution>
+                    <execution>
+                        <id>xjc-stock1</id>
+                        <goals>
+                            <goal>testXjc</goal>
+                        </goals>
+                        <configuration>
+                            <sourceType>XmlSchema</sourceType>
+                            <testSources>
+                                <testSource>test-resources/xsd/stock1.xsd</testSource>
+                            </testSources>
+                            <outputDirectory>${project.build.directory}/generated-test-sources/jaxb/stock1</outputDirectory>
                         </configuration>
+                    </execution>
+                    <execution>
+                        <id>xjc-stock2</id>
                         <goals>
-                            <goal>run</goal>
+                            <goal>testXjc</goal>
                         </goals>
+                        <configuration>
+                            <sourceType>XmlSchema</sourceType>
+                            <testSources>
+                                <testSource>test-resources/xsd/stock2.xsd</testSource>
+                            </testSources>
+                            <outputDirectory>${project.build.directory}/generated-test-sources/jaxb/stock2</outputDirectory>
+                        </configuration>
+                    </execution>
+                    <execution>
+                        <id>xjc-samplemtom</id>
+                        <goals>
+                            <goal>testXjc</goal>
+                        </goals>
+                        <configuration>
+                            <sourceType>XmlSchema</sourceType>
+                            <testSources>
+                                <testSource>test-resources/xsd/samplemtom.xsd</testSource>
+                            </testSources>
+                            <outputDirectory>${project.build.directory}/generated-test-sources/jaxb/samplemtom</outputDirectory>
+                        </configuration>
+                    </execution>
+                    <execution>
+                        <id>xjc-ProxyDocLitWrapped</id>
+                        <goals>
+                            <goal>testXjc</goal>
+                        </goals>
+                        <configuration>
+                            <sourceType>WSDL</sourceType>
+                            <testSources>
+                                <testSource>test-resources/wsdl/ProxyDocLitWrapped.wsdl</testSource>
+                            </testSources>
+                            <packageName>org.test.proxy.doclitwrapped</packageName>
+                            <outputDirectory>${project.build.directory}/generated-test-sources/jaxb/ProxyDocLitWrapped</outputDirectory>
+                        </configuration>
                     </execution>
                     <execution>
+                        <id>xjc-AddNumbers</id>
+                        <goals>
+                            <goal>testXjc</goal>
+                        </goals>
+                        <configuration>
+                            <sourceType>WSDL</sourceType>
+                            <testSources>
+                                <testSource>test-resources/wsdl/AddNumbers.wsdl</testSource>
+                            </testSources>
+                            <outputDirectory>${project.build.directory}/generated-test-sources/jaxb/AddNumbers</outputDirectory>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-antrun-plugin</artifactId>
+                
+                <executions>
+                    <execution>
                         <id>build-repo</id>
                         <phase>test-compile</phase>
                         <configuration>
@@ -306,8 +333,6 @@
                                         <include name="**/axis2.xml" />
                                     </fileset>
                                 </copy>
-                                <property name="addressing_version" value="${project.version}" />
-                                <ant antfile="build.xml" inheritall="true" inheritrefs="true" dir="." target="build-repo" />
                             </tasks>
                         </configuration>
                         <goals>
@@ -317,19 +342,17 @@
                 </executions>
             </plugin>
             <plugin>
-                <groupId>org.codehaus.mojo</groupId>
-                <artifactId>build-helper-maven-plugin</artifactId>
+                <groupId>org.apache.axis2</groupId>
+                <artifactId>axis2-repo-maven-plugin</artifactId>
                 <executions>
                     <execution>
-                        <id>add-test-source</id>
-                        <phase>process-test-resources</phase>
                         <goals>
-                            <goal>add-test-source</goal>
+                            <goal>create-test-repository</goal>
                         </goals>
                         <configuration>
-                            <sources>
-                                <source>${basedir}/target/schema/src</source>
-                            </sources>
+                            <axis2xml>../kernel/conf/axis2.xml</axis2xml>
+                            <configurationDirectory>conf</configurationDirectory>
+                            <outputDirectory>${project.build.directory}/repository</outputDirectory>
                         </configuration>
                     </execution>
                 </executions>
@@ -339,7 +362,7 @@
                 <inherited>true</inherited>
                 <configuration>
                     <forkMode>once</forkMode>
-                    <argLine>-Xms256m -Xmx512m -Xbootclasspath/p:${project.build.directory}/endorsed/jaxb-api.jar${path.separator}${project.build.directory}/endorsed/geronimo-saaj_1.3_spec.jar${path.separator}${project.build.directory}/endorsed/geronimo-jaxws_2.2_spec.jar</argLine>
+                    <argLine>-Xms256m -Xmx512m -Xbootclasspath/p:${jaxws.bootclasspath}</argLine>
                     <!-- Enable the next 2 lines if you want to attach a debugger
                     <argLine>-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5006</argLine>-->
                     <includes>

Modified: axis/axis2/java/core/branches/AXIS2-4091/modules/jaxws/src/org/apache/axis2/datasource/SourceDataSource.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/AXIS2-4091/modules/jaxws/src/org/apache/axis2/datasource/SourceDataSource.java?rev=1818518&r1=1818517&r2=1818518&view=diff
==============================================================================
--- axis/axis2/java/core/branches/AXIS2-4091/modules/jaxws/src/org/apache/axis2/datasource/SourceDataSource.java (original)
+++ axis/axis2/java/core/branches/AXIS2-4091/modules/jaxws/src/org/apache/axis2/datasource/SourceDataSource.java Sun Dec 17 22:34:08 2017
@@ -19,10 +19,8 @@
 
 package org.apache.axis2.datasource;
 
-
-import org.apache.axiom.om.OMDataSourceExt;
 import org.apache.axiom.om.OMException;
-import org.apache.axiom.om.ds.OMDataSourceExtBase;
+import org.apache.axiom.om.ds.AbstractPullOMDataSource;
 import org.apache.axiom.om.util.StAXUtils;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
@@ -44,23 +42,16 @@ import java.io.UnsupportedEncodingExcept
 /**
  * OMDataSource backed by a source
  */
-public class SourceDataSource extends OMDataSourceExtBase {
+public class SourceDataSource extends AbstractPullOMDataSource {
     private static final Log log = LogFactory.getLog(SourceDataSource.class);
-    Source data;
+
+    private final Source data;
 
     public SourceDataSource(Source data) {
-        super();
         this.data = data;
     }
 
-    public void close() {
-    }
-
-    public OMDataSourceExt copy() {
-        return null;
-    }
-
-    public Object getObject() {
+    public Source getObject() {
         return data;
     }
 
@@ -68,14 +59,14 @@ public class SourceDataSource extends OM
 
         try {
             String encoding = "utf-8";
-            InputStream is = new ByteArrayInputStream(getXMLBytes(encoding));
+            InputStream is = new ByteArrayInputStream(getContent(encoding));
             return StAXUtils.createXMLStreamReader(is, encoding);
         } catch (UnsupportedEncodingException e) {
             throw new XMLStreamException(e);
         }
     }
 
-    public byte[] getXMLBytes(String encoding) throws UnsupportedEncodingException {
+    private byte[] getContent(String encoding) throws UnsupportedEncodingException {
         if (log.isDebugEnabled()) {
             log.debug("Start getXMLBytes");
         }
@@ -113,10 +104,6 @@ public class SourceDataSource extends OM
         return false;
     }
 
-    public boolean isDestructiveWrite() {
-        return false;
-    }
-    
     private static byte[] getBytesFromStream(InputStream is) throws IOException {
         // TODO This code assumes that available is the length of the stream.
         byte[] bytes = new byte[is.available()];

Modified: axis/axis2/java/core/branches/AXIS2-4091/modules/jaxws/src/org/apache/axis2/datasource/jaxb/JAXBAttachmentMarshaller.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/AXIS2-4091/modules/jaxws/src/org/apache/axis2/datasource/jaxb/JAXBAttachmentMarshaller.java?rev=1818518&r1=1818517&r2=1818518&view=diff
==============================================================================
--- axis/axis2/java/core/branches/AXIS2-4091/modules/jaxws/src/org/apache/axis2/datasource/jaxb/JAXBAttachmentMarshaller.java (original)
+++ axis/axis2/java/core/branches/AXIS2-4091/modules/jaxws/src/org/apache/axis2/datasource/jaxb/JAXBAttachmentMarshaller.java Sun Dec 17 22:34:08 2017
@@ -23,7 +23,6 @@ import org.apache.axiom.om.OMException;
 import org.apache.axiom.om.impl.MTOMXMLStreamWriter;
 import org.apache.axiom.util.UIDGenerator;
 import org.apache.axis2.Constants;
-import org.apache.axis2.Constants.Configuration;
 import org.apache.axis2.context.MessageContext;
 import org.apache.axis2.java.security.AccessController;
 import org.apache.axis2.transport.http.HTTPConstants;
@@ -40,16 +39,12 @@ import javax.xml.stream.XMLStreamWriter;
 
 import java.security.PrivilegedAction;
 
-/**
- * An implementation of the JAXB AttachmentMarshaller that is used to handle binary data from JAXB
- * and create populate the appropriate constructs on the MessageContext
- */
-public class JAXBAttachmentMarshaller extends AttachmentMarshaller {
+public final class JAXBAttachmentMarshaller extends AttachmentMarshaller {
 
     private static final Log log = LogFactory.getLog(JAXBAttachmentMarshaller.class);
 
-    private MessageContext msgContext;
-    private XMLStreamWriter writer;
+    private final AttachmentContext context;
+    private final XMLStreamWriter writer;
     private static final String APPLICATION_OCTET = "application/octet-stream";
     
     /**
@@ -57,8 +52,8 @@ public class JAXBAttachmentMarshaller ex
      * @param msgContext
      * @param writer
      */
-    public JAXBAttachmentMarshaller(MessageContext msgContext, XMLStreamWriter writer) {
-        this.msgContext = msgContext;
+    public JAXBAttachmentMarshaller(AttachmentContext context, XMLStreamWriter writer) {
+        this.context = context;
         this.writer = writer;
     }
 
@@ -70,7 +65,7 @@ public class JAXBAttachmentMarshaller ex
         
         // For outbound messages, only trigger MTOM if
         // the message is mtom enabled.
-        value = isMTOMEnabled();
+        value = context.isMTOMEnabled();
         
         // If the writer is not an MTOM XMLStreamWriter then we don't have
         // any place to store the attachment
@@ -92,7 +87,7 @@ public class JAXBAttachmentMarshaller ex
     /* (non-Javadoc)
      * @see javax.xml.bind.attachment.AttachmentMarshaller#addMtomAttachment(byte[], int, int, java.lang.String, java.lang.String, java.lang.String)
      */
-    public String addMtomAttachment(byte[] data, int offset, int length,
+    public final String addMtomAttachment(byte[] data, int offset, int length,
                                     String mimeType, String namespace, String localPart) {
 
         if (offset != 0 || length != data.length) {
@@ -118,8 +113,8 @@ public class JAXBAttachmentMarshaller ex
             final InternetHeaders ih = new InternetHeaders();
             final byte[] dataArray = data; 
             ih.setHeader(HTTPConstants.HEADER_CONTENT_TYPE, mimeType);
-            final MimeBodyPart mbp = (MimeBodyPart) AccessController.doPrivileged(new PrivilegedAction() {
-                public Object run() {
+            final MimeBodyPart mbp = AccessController.doPrivileged(new PrivilegedAction<MimeBodyPart>() {
+                public MimeBodyPart run() {
                     try {
                         return new MimeBodyPart(ih, dataArray);
                     } catch (MessagingException e) {
@@ -128,12 +123,13 @@ public class JAXBAttachmentMarshaller ex
                 }});
 
             //Create a data source for the MIME Body Part
-            MimePartDataSource mpds = (MimePartDataSource) AccessController.doPrivileged(new PrivilegedAction() {
-                public Object run() {
+            MimePartDataSource mpds = AccessController.doPrivileged(new PrivilegedAction<MimePartDataSource>() {
+                public MimePartDataSource run() {
                     return new MimePartDataSource(mbp);
                 }});
             long dataLength =data.length;
             Integer value = null;
+            MessageContext msgContext = context.getMessageContext();
             if (msgContext != null) {
                 value = (Integer) msgContext.getProperty(Constants.Configuration.MTOM_THRESHOLD);
             } else if (log.isDebugEnabled()) {
@@ -160,7 +156,7 @@ public class JAXBAttachmentMarshaller ex
     /* (non-Javadoc)
      * @see javax.xml.bind.attachment.AttachmentMarshaller#addMtomAttachment(javax.activation.DataHandler, java.lang.String, java.lang.String)
      */
-    public String addMtomAttachment(DataHandler data, String namespace, String localPart) {
+    public final String addMtomAttachment(DataHandler data, String namespace, String localPart) {
         if (log.isDebugEnabled()){ 
             log.debug("Adding MTOM/XOP datahandler attachment for element: " + 
                       "{" + namespace + "}" + localPart);
@@ -173,13 +169,13 @@ public class JAXBAttachmentMarshaller ex
     /* (non-Javadoc)
      * @see javax.xml.bind.attachment.AttachmentMarshaller#addSwaRefAttachment(javax.activation.DataHandler)
      */
-    public String addSwaRefAttachment(DataHandler data) {
+    public final String addSwaRefAttachment(DataHandler data) {
         if (log.isDebugEnabled()){ 
             log.debug("Adding SWAREF attachment");
         }
         
         String cid = addDataHandler(data, true);
-        setDoingSWA();
+        context.setDoingSWA();
         return "cid:" + cid;
     }
     
@@ -200,7 +196,7 @@ public class JAXBAttachmentMarshaller ex
             }
             // If old SWA attachments, get the ID and add the attachment to message
             cid = UIDGenerator.generateContentId();
-            addDataHandler(dh, cid);   
+            context.addDataHandler(dh, cid);   
         } else {
             if (log.isDebugEnabled()){ 
                 log.debug("adding DataHandler for MTOM");
@@ -212,7 +208,7 @@ public class JAXBAttachmentMarshaller ex
                         log.debug("The MTOM attachment is written as an attachment part.");
                     }
                     // Remember the attachment on the message.
-                    addDataHandler(dh, cid);
+                    context.addDataHandler(dh, cid);
                 } else {
                     if (log.isDebugEnabled()){ 
                         log.debug("The MTOM attachment is inlined.");
@@ -231,43 +227,4 @@ public class JAXBAttachmentMarshaller ex
         }
         return cid;
     }
-
-    /**
-     * @return if MTOM enabled calculated from the context information
-     */
-    public boolean isMTOMEnabled() {
-        if (msgContext == null) {
-            return false;
-        } else {
-            String value = (String) msgContext.getProperty(Configuration.ENABLE_MTOM);
-            return ("true".equalsIgnoreCase(value));
-        }  
-    }
-    
-    /**
-     * Indicate on the context that SWA attachments are encountered
-     */
-    public void setDoingSWA() {
-        if (msgContext != null) {
-            msgContext.setDoingSwA(true);
-            msgContext.setProperty(Configuration.ENABLE_SWA, "true");
-        }
-    }
-    
-    /**
-     * Inform the context that an Attachment (DataHandler, CID) is written.
-     * @param dh
-     * @param cid
-     */
-    public void addDataHandler(DataHandler dh, String cid) {
-        if (msgContext != null) {
-            msgContext.addAttachment(cid, dh);
-        } else {
-            if (log.isDebugEnabled()) {
-                log.debug("The msgContext is null.  The attachment is not stored");
-                log.debug("   content id=" + cid);
-                log.debug("   dataHandler  =" + dh);
-            }
-        }
-    }
 }

Modified: axis/axis2/java/core/branches/AXIS2-4091/modules/jaxws/src/org/apache/axis2/datasource/jaxb/JAXBAttachmentUnmarshaller.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/AXIS2-4091/modules/jaxws/src/org/apache/axis2/datasource/jaxb/JAXBAttachmentUnmarshaller.java?rev=1818518&r1=1818517&r2=1818518&view=diff
==============================================================================
--- axis/axis2/java/core/branches/AXIS2-4091/modules/jaxws/src/org/apache/axis2/datasource/jaxb/JAXBAttachmentUnmarshaller.java (original)
+++ axis/axis2/java/core/branches/AXIS2-4091/modules/jaxws/src/org/apache/axis2/datasource/jaxb/JAXBAttachmentUnmarshaller.java Sun Dec 17 22:34:08 2017
@@ -19,28 +19,151 @@
 
 package org.apache.axis2.datasource.jaxb;
 
-import org.apache.axiom.util.stax.xop.MimePartProvider;
-import org.apache.axis2.context.MessageContext;
+import org.apache.axiom.om.OMAttachmentAccessor;
+import org.apache.axiom.om.OMException;
+import org.apache.axis2.jaxws.i18n.Messages;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 
 import javax.activation.DataHandler;
+import javax.xml.bind.attachment.AttachmentUnmarshaller;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
 
 /**
- * JAXBAttachmentUnmarshaller
- * <p/>
- * An implementation of the <link>javax.xml.bind.attachment.AttachmentUnmarshaller</link> that is
- * used for deserializing XOP elements into their corresponding binary data packages.
+ * Implementation of the {@link AttachmentUnmarshaller} class that handles the attachments provided
+ * by Axiom through the {@link MimePartProvider} interface. It should be noted that while Axiom only
+ * handles attachments referenced using XOP, {@link AttachmentUnmarshaller} is also used to retrieve
+ * attachments from SwA messages. Hence the {@link #getDataHandlerForSwA(String)} method.
  */
-public class JAXBAttachmentUnmarshaller extends AbstractJAXBAttachmentUnmarshaller {
-    private final MessageContext msgContext;
+public final class JAXBAttachmentUnmarshaller extends AttachmentUnmarshaller {
+
+    private static final Log log = LogFactory.getLog(JAXBAttachmentUnmarshaller.class);
+
+    private final AttachmentContext context;
+    private final OMAttachmentAccessor attachmentAccessor;
 
-    public JAXBAttachmentUnmarshaller(MimePartProvider mimePartProvider,
-            MessageContext msgContext) {
-        super(mimePartProvider);
-        this.msgContext = msgContext;
+    public JAXBAttachmentUnmarshaller(AttachmentContext context, OMAttachmentAccessor attachmentAccessor) {
+        this.context = context;
+        this.attachmentAccessor = attachmentAccessor;
     }
 
-    @Override
-    protected DataHandler getDataHandlerForSwA(String blobcid) {
-        return msgContext.getAttachment(blobcid);
+    public final boolean isXOPPackage() {
+        
+        // Any message that is received might contain MTOM.
+        // So always return true.
+        boolean value = true;
+    
+        if (log.isDebugEnabled()){ 
+            log.debug("isXOPPackage returns " + value);
+        }
+        return value;
+    }
+
+    public final byte[] getAttachmentAsByteArray(String cid) {
+        if (log.isDebugEnabled()) {
+            log.debug("Attempting to retrieve attachment [" + cid + "] as a byte[]");
+        }
+        DataHandler dh = getAttachmentAsDataHandler(cid);
+        if (dh != null) {
+            try {
+                return convert(dh);
+            } catch (IOException ioe) {
+                if (log.isDebugEnabled()) {
+                    log.debug("Exception occurred while getting the byte[] " + ioe);
+                }
+                throw new OMException(ioe);
+            }
+        }
+        if (log.isDebugEnabled()) {
+            log.debug("returning null byte[]");
+        }
+        return null;
+    }
+
+    public final DataHandler getAttachmentAsDataHandler(String cid) {
+        if (log.isDebugEnabled()) {
+            log.debug("Attempting to retrieve attachment [" + cid + "] as a DataHandler");
+        }
+
+        DataHandler dh = getDataHandler(cid);
+        if (dh != null) {
+            return dh;
+        } else {
+            String cid2 = getNewCID(cid);
+            if (log.isDebugEnabled()) {
+                log.debug("A dataHandler was not found for [" + cid + "] trying [" + cid2 + "]");
+            }
+            dh = getDataHandler(cid2);
+            if (dh != null) {
+                return dh;
+            }
+        }
+        // No Data Handler found
+        throw new OMException(Messages.getMessage("noDataHandler", cid));
+    }
+    
+    /**
+     * @param cid
+     * @return cid with translated characters
+     */
+    private String getNewCID(String cid) {
+        String cid2 = cid;
+
+        try {
+            cid2 = java.net.URLDecoder.decode(cid, "UTF-8");
+        } catch (Exception e) {
+            if (log.isDebugEnabled()) {
+                log.debug("getNewCID decoding " + cid + " as UTF-8 decoding error: " + e);
+            }
+        }
+        return cid2;
+    }
+
+    /**
+     * Read the bytes from the DataHandler
+     * 
+     * @param dh
+     * @return byte[]
+     * @throws IOException
+     */
+    private byte[] convert(DataHandler dh) throws IOException {
+        if (log.isDebugEnabled()) {
+            log.debug("Reading byte[] from DataHandler " + dh);
+        }
+        InputStream is = dh.getInputStream();
+        if (log.isDebugEnabled()) {
+            log.debug("DataHandler InputStream " + is);
+        }
+        ByteArrayOutputStream baos = new ByteArrayOutputStream();
+        byte[] b = new byte[1024];
+        int num = is.read(b);
+        if (log.isDebugEnabled()) {
+            if (num <= 0) {
+                log.debug("DataHandler InputStream contains no data. num=" + num);
+            }
+        }
+        while (num > 0) {
+            baos.write(b, 0, num);
+            num = is.read(b);
+        }
+        return baos.toByteArray();
+    }
+    
+    private DataHandler getDataHandler(String cid) {
+        String blobcid = cid;
+        if (blobcid.startsWith("cid:")) {
+            blobcid = blobcid.substring(4);
+        }
+        DataHandler dh = attachmentAccessor.getDataHandler(blobcid);
+        if (dh == null) {
+            dh = context.getDataHandlerForSwA(blobcid);
+        }
+        if (dh != null) {
+            JAXBAttachmentUnmarshallerMonitor.addBlobCID(blobcid);
+        }
+        return dh;
     }
 }

Modified: axis/axis2/java/core/branches/AXIS2-4091/modules/jaxws/src/org/apache/axis2/datasource/jaxb/JAXBCustomBuilder.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/AXIS2-4091/modules/jaxws/src/org/apache/axis2/datasource/jaxb/JAXBCustomBuilder.java?rev=1818518&r1=1818517&r2=1818518&view=diff
==============================================================================
--- axis/axis2/java/core/branches/AXIS2-4091/modules/jaxws/src/org/apache/axis2/datasource/jaxb/JAXBCustomBuilder.java (original)
+++ axis/axis2/java/core/branches/AXIS2-4091/modules/jaxws/src/org/apache/axis2/datasource/jaxb/JAXBCustomBuilder.java Sun Dec 17 22:34:08 2017
@@ -21,27 +21,22 @@ package org.apache.axis2.datasource.jaxb
 
 import org.apache.axiom.om.OMContainer;
 import org.apache.axiom.om.OMDataSource;
+import org.apache.axiom.om.OMDocument;
 import org.apache.axiom.om.OMElement;
 import org.apache.axiom.om.OMException;
-import org.apache.axiom.om.OMFactory;
-import org.apache.axiom.om.OMNamespace;
-import org.apache.axiom.om.OMSourcedElement;
-import org.apache.axiom.om.impl.builder.CustomBuilder;
-import org.apache.axis2.context.MessageContext;
-import org.apache.axis2.jaxws.Constants;
+import org.apache.axiom.om.ds.custombuilder.CustomBuilder;
+import org.apache.axiom.soap.SOAPBody;
 import org.apache.axis2.jaxws.handler.HandlerUtils;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
 import javax.xml.bind.JAXBException;
-import javax.xml.soap.SOAPConstants;
-import javax.xml.stream.XMLStreamReader;
 
 /**
  * JAXBCustomBuilder creates an OMSourcedElement backed by a JAXBDataSource
  * for the specified namespace and localPart.
  */
-public class JAXBCustomBuilder implements CustomBuilder {
+public class JAXBCustomBuilder implements CustomBuilder, CustomBuilder.Selector {
 
     private static final Log log = LogFactory.getLog(JAXBCustomBuilder.class);
     
@@ -57,33 +52,17 @@ public class JAXBCustomBuilder implement
         JAXBCustomBuilderMonitor.updateTotalBuilders();
     }
 
-
-    public OMElement create(String namespace, 
-                            String localPart, 
-                            OMContainer parent,
-                            XMLStreamReader reader, 
-                            OMFactory factory) throws OMException {
-        
-        if (log.isDebugEnabled()) {
-            log.debug("create namespace = " + namespace);
-            log.debug("  localPart = " + localPart);
-            log.debug("  reader = " + reader.getClass());
-        }
-        
-        // There are some situations where we want to use normal
-        // unmarshalling, so return null
-        if (!shouldUnmarshal(namespace, localPart)) {
-            JAXBCustomBuilderMonitor.updateTotalFailedCreates();
-            return null;
-        }
+    @Override
+    public OMDataSource create(OMElement element) throws OMException {
         try {
+            if (log.isDebugEnabled()) {
+                log.debug("create namespace = " + element.getNamespaceURI());
+                log.debug("  localPart = " + element.getLocalName());
+            }
+        
             // Create an OMSourcedElement backed by an unmarshalled JAXB object
             
-            // Currently we cannot control how the unmarshaller will emit the prefix
-            // So if the value of the prefix is needed, full expansion is necessary.
-            OMNamespace ns = factory.createOMNamespace(namespace, null);
-            
-            Object jaxb = jdsContext.unmarshal(reader);
+            Object jaxb = jdsContext.unmarshal(element);
             if (log.isDebugEnabled()) {
                 log.debug("Successfully unmarshalled jaxb object " + jaxb);
             }
@@ -92,48 +71,31 @@ public class JAXBCustomBuilder implement
             if (log.isDebugEnabled()) {
                 log.debug("The JAXBDataSource is " + ds);
             }
-            OMSourcedElement omse = factory.createOMElement(ds, localPart, ns);
-            
-            parent.addChild(omse);
             JAXBCustomBuilderMonitor.updateTotalCreates();
-            return omse;
+            return ds;
         } catch (JAXBException e) {
             JAXBCustomBuilderMonitor.updateTotalFailedCreates();
             throw new OMException(e);
         }
     }
     
-    /**
-     * @param namespace
-     * @param localPart
-     * @return true if this ns and local part is acceptable for unmarshalling
-     */
-    private boolean shouldUnmarshal(String namespace, String localPart) {
-        boolean isHighFidelity = HandlerUtils.isHighFidelity(jdsContext.getMessageContext());
-
-        if (isHighFidelity) {
-            if (log.isDebugEnabled()) {
+    @Override
+    public boolean accepts(OMContainer parent, int depth, String namespaceURI, String localName) {
+        if (parent instanceof OMDocument || parent instanceof SOAPBody) {
+            boolean shouldUnmarshal;
+            if (HandlerUtils.isHighFidelity(jdsContext.getMessageContext())) {
                 log.debug("JAXB payload streaming disabled because high fidelity messages are requested.");
+                shouldUnmarshal = false;
+            } else {
+                // Don't unmarshal if this looks like encrypted data
+                shouldUnmarshal = !localName.equals("EncryptedData");
             }
-            return false;
-
-        }
-        
-        // Don't unmarshall SOAPFaults or anything else in the SOAP 
-        // namespace.
-        // Don't unmarshall elements that are unqualified
-        if (localPart == null || namespace == null || namespace.length() == 0 ||
-            SOAPConstants.URI_NS_SOAP_1_1_ENVELOPE.equals(namespace) ||
-            SOAPConstants.URI_NS_SOAP_1_2_ENVELOPE.equals(namespace)) {
-            return false;
-        }
-       
-        // Don't unmarshal if this looks like encrypted data
-        if (localPart.equals("EncryptedData")) {
+            if (!shouldUnmarshal) {
+                JAXBCustomBuilderMonitor.updateTotalFailedCreates();
+            }
+            return shouldUnmarshal;
+        } else {
             return false;
         }
-        
-        return true;
-                
     }
 }

Modified: axis/axis2/java/core/branches/AXIS2-4091/modules/jaxws/src/org/apache/axis2/datasource/jaxb/JAXBDSContext.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/AXIS2-4091/modules/jaxws/src/org/apache/axis2/datasource/jaxb/JAXBDSContext.java?rev=1818518&r1=1818517&r2=1818518&view=diff
==============================================================================
--- axis/axis2/java/core/branches/AXIS2-4091/modules/jaxws/src/org/apache/axis2/datasource/jaxb/JAXBDSContext.java (original)
+++ axis/axis2/java/core/branches/AXIS2-4091/modules/jaxws/src/org/apache/axis2/datasource/jaxb/JAXBDSContext.java Sun Dec 17 22:34:08 2017
@@ -19,13 +19,10 @@
 
 package org.apache.axis2.datasource.jaxb;
 
+import org.apache.axiom.om.OMElement;
 import org.apache.axiom.om.OMException;
+import org.apache.axiom.om.XOPEncoded;
 import org.apache.axiom.om.impl.MTOMXMLStreamWriter;
-import org.apache.axiom.om.util.XMLStreamWriterRemoveIllegalChars;
-import org.apache.axiom.util.stax.XMLStreamReaderUtils;
-import org.apache.axiom.util.stax.xop.MimePartProvider;
-import org.apache.axiom.util.stax.xop.XOPEncodedStream;
-import org.apache.axiom.util.stax.xop.XOPUtils;
 import org.apache.axis2.context.MessageContext;
 import org.apache.axis2.java.security.AccessController;
 import org.apache.axis2.jaxws.context.utils.ContextUtils;
@@ -59,7 +56,6 @@ import javax.xml.ws.WebServiceException;
 import java.io.OutputStream;
 import java.lang.ref.WeakReference;
 import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
 import java.security.PrivilegedAction;
 import java.text.ParseException;
 import java.util.HashMap;
@@ -96,7 +92,7 @@ public class JAXBDSContext {
     //              Doc/Lit Bare "Minimal" Processing (JAXB ObjectFactories are missing...
     //                   and thus we must use "by type" for primitives/String)
     // Please don't use "by java type" processing to get around errors.
-    private Class processType = null;
+    private Class<?> processType = null;
     private boolean isxmlList =false;
     
     private String webServiceNamespace;
@@ -127,7 +123,7 @@ public class JAXBDSContext {
      * @deprecated
      */
     public JAXBDSContext(String contextPackage) {
-        this.contextPackages = new TreeSet();
+        this.contextPackages = new TreeSet<String>();
         this.contextPackages.add(contextPackage);
         this.contextPackagesKey = this.contextPackages.toString();
     }
@@ -234,7 +230,7 @@ public class JAXBDSContext {
     }
     
     /** @return RPC Declared Type */
-    public Class getProcessType() {
+    public Class<?> getProcessType() {
         return processType;
     }
 
@@ -246,7 +242,7 @@ public class JAXBDSContext {
      *
      * @param type
      */
-    public void setProcessType(Class type) {
+    public void setProcessType(Class<?> type) {
     	if (log.isDebugEnabled()) {
      		log.debug("Process Type set to: " + type);
      	}
@@ -287,43 +283,21 @@ public class JAXBDSContext {
         return null;
     }
     
-    /**
-     * Create an AttachmentMarshaller to marshal MTOM/SWA Attachments
-     * @param writer
-     * @return
-     */
-    protected AttachmentMarshaller createAttachmentMarshaller(XMLStreamWriter writer) {
-        return new JAXBAttachmentMarshaller(getMessageContext(), writer);
-    }
-    
-    /**
-     * Create an Attachment unmarshaller for unmarshalling MTOM/SWA Attachments
-     * @return AttachmentUnmarshaller
-     */
-    protected AttachmentUnmarshaller createAttachmentUnmarshaller(MimePartProvider mimePartProvider) {
-        return new JAXBAttachmentUnmarshaller(mimePartProvider, getMessageContext());
+    protected AttachmentContext createAttachmentContext() {
+        return new MessageContextAttachmentContext(getMessageContext());
     }
 
     /**
      * Unmarshal the xml into a JAXB object
-     * @param inputReader
+     * @param element
      * @return
      * @throws JAXBException
      */
-    public Object unmarshal(XMLStreamReader inputReader) throws JAXBException {
+    public Object unmarshal(OMElement element) throws JAXBException {
 
-        if (DEBUG_ENABLED) {
-            String clsText = (inputReader !=null) ? inputReader.getClass().toString() : "null";
-            log.debug("unmarshal with inputReader=" + clsText);
-        } 
         // See the Javadoc of the CustomBuilder interface for a complete explanation of
         // the following two instructions:
-        XOPEncodedStream xopEncodedStream = XOPUtils.getXOPEncodedStream(inputReader);
-        XMLStreamReader reader = XMLStreamReaderUtils.getOriginalXMLStreamReader(xopEncodedStream.getReader());
-        if (DEBUG_ENABLED) {
-            String clsText = (reader !=null) ? reader.getClass().toString() : "null";
-            log.debug("  originalReader=" + clsText);
-        } 
+        XOPEncoded<XMLStreamReader> xopEncodedStream = element.getXOPEncodedStreamReader(false);
         
         // There may be a preferred classloader that should be used
         ClassLoader cl = getClassLoader();
@@ -332,7 +306,7 @@ public class JAXBDSContext {
 
         
         // Create an attachment unmarshaller
-        AttachmentUnmarshaller aum = createAttachmentUnmarshaller(xopEncodedStream.getMimePartProvider());
+        AttachmentUnmarshaller aum = new JAXBAttachmentUnmarshaller(createAttachmentContext(), xopEncodedStream.getAttachmentAccessor());
 
         if (aum != null) {
             if (DEBUG_ENABLED) {
@@ -344,6 +318,7 @@ public class JAXBDSContext {
         Object jaxb = null;
 
         // Unmarshal into the business object.
+        XMLStreamReader reader = xopEncodedStream.getRootPart();
         if (getProcessType() == null) {
             jaxb = unmarshalByElement(u, reader);   // preferred and always used for
                                                     // style=document
@@ -375,90 +350,83 @@ public class JAXBDSContext {
         if (log.isDebugEnabled()) {
             log.debug("enter marshal");
         }
-        boolean installedFilter = false;
 
-        try {
-            // There may be a preferred classloader that should be used
-            ClassLoader cl = getClassLoader();
+        // There may be a preferred classloader that should be used
+        ClassLoader cl = getClassLoader();
 
 
-            // Very easy, use the Context to get the Marshaller.
-            // Use the marshaller to write the object.
-            JAXBContext jbc = getJAXBContext(cl);
-            Marshaller m = JAXBUtils.getJAXBMarshaller(jbc);
-            if (writer instanceof MTOMXMLStreamWriter && ((MTOMXMLStreamWriter) writer).getOutputFormat() != null) {
-                String encoding = ((MTOMXMLStreamWriter) writer).getOutputFormat().getCharSetEncoding();
-
-                String marshallerEncoding = (String) m.getProperty(Marshaller.JAXB_ENCODING);
-
-                // Make sure that the marshaller respects the encoding of the message.
-                // This is accomplished by setting the encoding on the Marshaller's JAXB_ENCODING property.
-                if (encoding == null && marshallerEncoding == null) {
+        // Very easy, use the Context to get the Marshaller.
+        // Use the marshaller to write the object.
+        JAXBContext jbc = getJAXBContext(cl);
+        Marshaller m = JAXBUtils.getJAXBMarshaller(jbc);
+        if (writer instanceof MTOMXMLStreamWriter && ((MTOMXMLStreamWriter) writer).getOutputFormat() != null) {
+            String encoding = ((MTOMXMLStreamWriter) writer).getOutputFormat().getCharSetEncoding();
+
+            String marshallerEncoding = (String) m.getProperty(Marshaller.JAXB_ENCODING);
+
+            // Make sure that the marshaller respects the encoding of the message.
+            // This is accomplished by setting the encoding on the Marshaller's JAXB_ENCODING property.
+            if (encoding == null && marshallerEncoding == null) {
+                if (log.isDebugEnabled()) {
+                    log.debug("The encoding and the marshaller's JAXB_ENCODING are both set to the default (UTF-8)");
+                }
+            } else {
+                // Must set the encoding to an actual String to set it on the Marshaller
+                if (encoding == null) {
+                    encoding = "UTF-8";
+                }
+                if (!encoding.equalsIgnoreCase(marshallerEncoding)) {
                     if (log.isDebugEnabled()) {
-                        log.debug("The encoding and the marshaller's JAXB_ENCODING are both set to the default (UTF-8)");
+                        log.debug("The Marshaller.JAXB_ENCODING is " + marshallerEncoding);
+                        log.debug("The Marshaller.JAXB_ENCODING is changed to the message encoding " + 
+                                encoding);
                     }
+                    m.setProperty(Marshaller.JAXB_ENCODING, encoding);
                 } else {
-                    // Must set the encoding to an actual String to set it on the Marshaller
-                    if (encoding == null) {
-                        encoding = "UTF-8";
-                    }
-                    if (!encoding.equalsIgnoreCase(marshallerEncoding)) {
-                        if (log.isDebugEnabled()) {
-                            log.debug("The Marshaller.JAXB_ENCODING is " + marshallerEncoding);
-                            log.debug("The Marshaller.JAXB_ENCODING is changed to the message encoding " + 
-                                    encoding);
-                        }
-                        m.setProperty(Marshaller.JAXB_ENCODING, encoding);
-                    } else {
-                        if (log.isDebugEnabled()) {
-                            log.debug("The encoding and the marshaller's JAXB_ENCODING are both set to:" + 
-                                    marshallerEncoding);
-                        }
+                    if (log.isDebugEnabled()) {
+                        log.debug("The encoding and the marshaller's JAXB_ENCODING are both set to:" + 
+                                marshallerEncoding);
                     }
                 }
             }
+        }
 
-            AttachmentMarshaller am = createAttachmentMarshaller(writer);
-            if (am != null) {
-                if (DEBUG_ENABLED) {
-                    log.debug("Adding JAXBAttachmentMarshaller to Marshaller");
-                }
-                m.setAttachmentMarshaller(am);
+        AttachmentMarshaller am = new JAXBAttachmentMarshaller(createAttachmentContext(), writer);
+        if (am != null) {
+            if (DEBUG_ENABLED) {
+                log.debug("Adding JAXBAttachmentMarshaller to Marshaller");
             }
+            m.setAttachmentMarshaller(am);
+        }
 
-            MessageContext mc = getMessageContext();
-
-            // If requested install a filter to remove illegal characters
-            installedFilter = installFilter(mc, writer);
+        MessageContext mc = getMessageContext();
 
+        // If requested install a filter to remove illegal characters
+        if (writer instanceof MTOMXMLStreamWriter && ContextUtils.isJAXBRemoveIllegalChars(mc)) {
+            writer = new XMLStreamWriterRemoveIllegalChars((MTOMXMLStreamWriter)writer);
+        }
 
-            // Marshal the object
-            if (getProcessType() == null) {
-                marshalByElement(obj, 
-                        m, 
-                        writer, 
-                        true);
-                //!am.isXOPPackage());
-            } else {
-                marshalByType(obj,
-                        m,
-                        writer,
-                        getProcessType(),
-                        isxmlList(),
-                        getConstructionType(),
-                        true); // Attempt to optimize by writing to OutputStream
-            }
+        // Marshal the object
+        if (getProcessType() == null) {
+            marshalByElement(obj, 
+                    m, 
+                    writer, 
+                    true);
+            //!am.isXOPPackage());
+        } else {
+            marshalByType(obj,
+                    m,
+                    writer,
+                    getProcessType(),
+                    isxmlList(),
+                    getConstructionType(),
+                    true); // Attempt to optimize by writing to OutputStream
+        }
 
-            JAXBUtils.releaseJAXBMarshaller(jbc, m);
+        JAXBUtils.releaseJAXBMarshaller(jbc, m);
 
-            if (log.isDebugEnabled()) {
-                log.debug("exit marshal");
-            }
-        } finally {
-            // Make sure the filter is uninstalled
-            if (installedFilter) {
-                uninstallFilter(writer);
-            }
+        if (log.isDebugEnabled()) {
+            log.debug("exit marshal");
         }
     }
     
@@ -474,8 +442,8 @@ public class JAXBDSContext {
     private static void marshalByElement(final Object b, final Marshaller m, 
                                          final XMLStreamWriter writer,
                                          final boolean optimize) {
-        AccessController.doPrivileged(new PrivilegedAction() {
-            public Object run() {
+        AccessController.doPrivileged(new PrivilegedAction<Void>() {
+            public Void run() {
                 // Marshalling directly to the output stream is faster than marshalling through the
                 // XMLStreamWriter. 
                 // Take advantage of this optimization if there is an output stream.
@@ -517,7 +485,7 @@ public class JAXBDSContext {
     private static String getDebugName(Object o) {
         String name = (o == null) ? "null" : o.getClass().getCanonicalName();
         if (o instanceof JAXBElement) {
-            name += " containing " + getDebugName(((JAXBElement) o).getValue());
+            name += " containing " + getDebugName(((JAXBElement<?>) o).getValue());
         }
         return name;
     }
@@ -534,13 +502,13 @@ public class JAXBDSContext {
             log.debug("XMLStreamWriter is " + writer);
         }
         OutputStream os = null;
-        if (writer.getClass() == MTOMXMLStreamWriter.class) {
+        if (writer instanceof MTOMXMLStreamWriter) {
             os = ((MTOMXMLStreamWriter) writer).getOutputStream();
             if (log.isDebugEnabled()) {
                 log.debug("OutputStream accessible from MTOMXMLStreamWriter is " + os);
             }
         }
-        if (writer.getClass() == XMLStreamWriterWithOS.class) {
+        if (writer instanceof XMLStreamWriterWithOS) {
             os = ((XMLStreamWriterWithOS) writer).getOutputStream();
             if (log.isDebugEnabled()) {
                 log.debug("OutputStream accessible from XMLStreamWriterWithOS is " + os);
@@ -578,7 +546,7 @@ public class JAXBDSContext {
      * @throws WebServiceException
      */
     public static Object unmarshalByType(final Unmarshaller u, final XMLStreamReader reader,
-                                          final Class type, final boolean isList,
+                                          final Class<?> type, final boolean isList,
                                           final JAXBUtils.CONSTRUCTION_TYPE ctype)
         throws WebServiceException {
 
@@ -589,7 +557,7 @@ public class JAXBDSContext {
             log.debug("  ctype = "+ ctype);
         }
 
-        return AccessController.doPrivileged(new PrivilegedAction() {
+        return AccessController.doPrivileged(new PrivilegedAction<Object>() {
             public Object run() {
                 try {
                     // Unfortunately RPC is type based. Thus a
@@ -618,7 +586,7 @@ public class JAXBDSContext {
                             	//process primitives first
                             	//first verify if we have a primitive type associated in the array.
                             	//array could be single dimension or multi dimension.
-                            	Class cType = type.getComponentType();
+                            	Class<?> cType = type.getComponentType();
                             	while(cType.isArray()){
                             		cType = cType.getComponentType();
                             	}
@@ -700,14 +668,13 @@ public class JAXBDSContext {
                         
                     }
                     if (log.isDebugEnabled()) {
-                        Class cls;
                         if (jaxb == null) {
                             if (DEBUG_ENABLED) {
                                 log.debug("End unmarshalByType returning null object");
                             }
 
                         } else if (jaxb instanceof JAXBElement) {
-                            JAXBElement jbe = (JAXBElement) jaxb;
+                            JAXBElement<?> jbe = (JAXBElement<?>) jaxb;
                             if (DEBUG_ENABLED) {
                                 log.debug("End unmarshalByType returning JAXBElement");
                                 log.debug("  Class = " + jbe.getDeclaredType());
@@ -731,13 +698,13 @@ public class JAXBDSContext {
 
     private static Object unmarshalArray(final XMLStreamReader reader, 
                                          final Unmarshaller u, 
-                                         Class type)
+                                         Class<?> type)
        throws Exception {
         try {
             if (DEBUG_ENABLED) {
                 log.debug("Invoking unmarshalArray");
             }
-            Object jaxb = AccessController.doPrivileged(new PrivilegedAction() {
+            Object jaxb = AccessController.doPrivileged(new PrivilegedAction<Object>() {
                 public Object run() {
                     try {
                         return u.unmarshal(reader, String[].class);
@@ -783,7 +750,7 @@ public class JAXBDSContext {
      */
     public static Object unmarshalAsListOrArray(final XMLStreamReader reader, 
                                                 final Unmarshaller u, 
-                                                 Class type)
+                                                 Class<?> type)
         throws IllegalAccessException, ParseException,NoSuchMethodException,
         InstantiationException,
         DatatypeConfigurationException,InvocationTargetException,JAXBException {
@@ -798,7 +765,7 @@ public class JAXBDSContext {
             // First unmarshal as a String
             Object jaxb = null;
             try {
-                jaxb = AccessController.doPrivileged(new PrivilegedAction() {
+                jaxb = AccessController.doPrivileged(new PrivilegedAction<Object>() {
                     public Object run() {
                         try {
                             return u.unmarshal(reader, String.class);
@@ -836,14 +803,14 @@ public class JAXBDSContext {
             return null;
         }
         if (obj instanceof JAXBElement) {
-            return ((JAXBElement) obj).getValue();
+            return ((JAXBElement<?>) obj).getValue();
         }
         return obj;
     }
 
     private static boolean isOccurrenceArray(Object obj) {
         return (obj instanceof JAXBElement) &&
-            (((JAXBElement)obj).getValue() instanceof OccurrenceArray);
+            (((JAXBElement<?>)obj).getValue() instanceof OccurrenceArray);
                 
     }
     /**
@@ -860,7 +827,7 @@ public class JAXBDSContext {
      * outputstream should be attempted.
      */
     private void marshalByType(final Object b, final Marshaller m,
-                                      final XMLStreamWriter writer, final Class type,
+                                      final XMLStreamWriter writer, final Class<?> type,
                                       final boolean isList, 
                                       final JAXBUtils.CONSTRUCTION_TYPE ctype,
                                       final boolean optimize) 
@@ -876,11 +843,11 @@ public class JAXBDSContext {
                         
         }
         if (isOccurrenceArray(b)) {
-            marshalOccurrenceArray((JAXBElement) b, m, writer);
+            marshalOccurrenceArray((JAXBElement<?>) b, m, writer);
             return;
         }
-        AccessController.doPrivileged(new PrivilegedAction() {
-            public Object run() {
+        AccessController.doPrivileged(new PrivilegedAction<Void>() {
+            public Void run() {
                 try {
 
                     // NOTE
@@ -928,7 +895,7 @@ public class JAXBDSContext {
                                 log.debug("marshalling [context path approach] " +
                                                 "with xmllist text = " + text);
                             }
-                            jbo = new JAXBElement(qName, String.class, text);
+                            jbo = new JAXBElement<String>(qName, String.class, text);
                         } else if (ctype == JAXBUtils.CONSTRUCTION_TYPE.BY_CLASS_ARRAY) {
                             // Some versions of JAXB have array/list processing built in.
                             // This code is a safeguard because apparently some versions
@@ -939,7 +906,7 @@ public class JAXBDSContext {
                                 log.debug("marshalling [class array approach] " +
                                                 "with xmllist text = " + text);
                             }
-                            jbo = new JAXBElement(qName, String.class, text); 
+                            jbo = new JAXBElement<String>(qName, String.class, text); 
                         }
                     }
                     // When JAXBContext is created using a context path, it will not include Enum
@@ -963,10 +930,10 @@ public class JAXBDSContext {
                                 log.debug("marshalByType. Marshaling " + type.getName()
                                         + " as Enum");
                             }
-                            JAXBElement jbe = (JAXBElement) b;
-                            String value = XMLRootElementUtil.getEnumValue((Enum) jbe.getValue());
+                            JAXBElement<?> jbe = (JAXBElement<?>) b;
+                            String value = XMLRootElementUtil.getEnumValue((Enum<?>) jbe.getValue());
 
-                            jbo = new JAXBElement(jbe.getName(), String.class, value);
+                            jbo = new JAXBElement<String>(jbe.getName(), String.class, value);
                         }
                     }
 
@@ -1008,7 +975,7 @@ public class JAXBDSContext {
      * @param writer_in XMLStreamWriter
      */
     private void marshalOccurrenceArray(
-                final JAXBElement jbe_in, 
+                final JAXBElement<?> jbe_in, 
                 final Marshaller m_in,
                 final XMLStreamWriter writer_in) {
         
@@ -1017,8 +984,8 @@ public class JAXBDSContext {
             log.debug("  Marshaller = " + JavaUtils.getObjectIdentity(m_in));
         }
         
-        AccessController.doPrivileged(new PrivilegedAction() {
-            public Object run() {
+        AccessController.doPrivileged(new PrivilegedAction<Void>() {
+            public Void run() {
                 try {
                     
                     Marshaller m = m_in;
@@ -1044,7 +1011,7 @@ public class JAXBDSContext {
                     // The name is the name of the individual occurence elements
                     // Type type is Object[]
                     // The value is the array of Object[] representing each element
-                    JAXBElement jbe = new JAXBElement(jbe_in.getName(), 
+                    JAXBElement<Object[]> jbe = new JAXBElement<Object[]>(jbe_in.getName(), 
                             Object[].class, 
                             occurArray.getAsArray());
 
@@ -1091,7 +1058,7 @@ public class JAXBDSContext {
             if (DEBUG_ENABLED) {
                 log.debug("Invoking unMarshalByElement");
             }
-            return AccessController.doPrivileged(new PrivilegedAction() {
+            return AccessController.doPrivileged(new PrivilegedAction<Object>() {
                 public Object run() {
                     try {
                         return u.unmarshal(reader);
@@ -1109,37 +1076,4 @@ public class JAXBDSContext {
             throw new OMException(t);
         }
     }
-    
-
-    /**
-     * Install a JAXB filter if requested
-     * @param mc
-     * @param writer
-     * @return true if filter installed
-     */
-    private boolean installFilter(MessageContext mc, XMLStreamWriter writer) {
-        if (!(writer instanceof MTOMXMLStreamWriter)) {
-            return false;
-        }
-        if (!ContextUtils.isJAXBRemoveIllegalChars(mc)) {
-            return false;
-        }
-        
-         
-        MTOMXMLStreamWriter mtomWriter = (MTOMXMLStreamWriter) writer;
-        mtomWriter.setFilter(new XMLStreamWriterRemoveIllegalChars());
-        return true;
-    }
-    
-    /**
-     * UninstallInstall a JAXB filter if requested
-     * @param mc
-     * @param writer
-     * @return true if filter installed
-     */
-    private void uninstallFilter(XMLStreamWriter writer) {
-        MTOMXMLStreamWriter mtomWriter = (MTOMXMLStreamWriter) writer;
-        mtomWriter.removeFilter();
-    }
-
 }

Modified: axis/axis2/java/core/branches/AXIS2-4091/modules/jaxws/src/org/apache/axis2/datasource/jaxb/JAXBDataSource.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/AXIS2-4091/modules/jaxws/src/org/apache/axis2/datasource/jaxb/JAXBDataSource.java?rev=1818518&r1=1818517&r2=1818518&view=diff
==============================================================================
--- axis/axis2/java/core/branches/AXIS2-4091/modules/jaxws/src/org/apache/axis2/datasource/jaxb/JAXBDataSource.java (original)
+++ axis/axis2/java/core/branches/AXIS2-4091/modules/jaxws/src/org/apache/axis2/datasource/jaxb/JAXBDataSource.java Sun Dec 17 22:34:08 2017
@@ -21,45 +21,29 @@ package org.apache.axis2.datasource.jaxb
 
 
 import org.apache.axiom.om.OMDataSourceExt;
-import org.apache.axiom.om.OMException;
-import org.apache.axiom.om.OMOutputFormat;
-import org.apache.axiom.om.ds.OMDataSourceExtBase;
-import org.apache.axiom.om.impl.MTOMXMLStreamWriter;
-import org.apache.axiom.om.util.StAXUtils;
-import org.apache.axis2.jaxws.message.util.XMLStreamWriterWithOS;
+import org.apache.axiom.om.ds.AbstractPushOMDataSource;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
 import javax.xml.bind.JAXBException;
 import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamReader;
 import javax.xml.stream.XMLStreamWriter;
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.io.UnsupportedEncodingException;
-import java.io.Writer;
 
 /**
  * OMDataSource backed by a jaxb object
  */
-public class JAXBDataSource extends OMDataSourceExtBase {
+public class JAXBDataSource extends AbstractPushOMDataSource {
     
     private static final Log log = LogFactory.getLog(JAXBDataSource.class);
     
-    Object jaxb;
-    JAXBDSContext context;
+    private final Object jaxb;
+    private final JAXBDSContext context;
 
     public JAXBDataSource(Object jaxb, JAXBDSContext context) {
-        super();
         this.jaxb = jaxb;
         this.context = context;
     }
 
-    public void close() {
-    }
-
     public OMDataSourceExt copy() {
         return new JAXBDataSource(jaxb, context);
     }
@@ -72,42 +56,6 @@ public class JAXBDataSource extends OMDa
         return context;
     }
 
-    public XMLStreamReader getReader() throws XMLStreamException {
-
-        try {
-            String encoding = "utf-8";
-            InputStream is = new ByteArrayInputStream(getXMLBytes(encoding));
-            return StAXUtils.createXMLStreamReader(is, encoding);
-        } catch (UnsupportedEncodingException e) {
-            throw new XMLStreamException(e);
-        }
-    }
-
-    public void serialize(OutputStream output, OMOutputFormat format) throws XMLStreamException {
-        MTOMXMLStreamWriter writer = new MTOMXMLStreamWriter(output, format);
-        serialize(writer);
-        writer.flush();
-        try {
-            writer.close();
-        } catch (XMLStreamException e) {
-            // An exception can occur if nothing is written to the 
-            // writer.  This is possible if the underlying data source
-            // writers to the output stream directly.
-            if (log.isDebugEnabled()) {
-                log.debug("Catching and swallowing exception " + e);
-            }
-        }
-    }
-
-    public void serialize(Writer writerTarget, OMOutputFormat format) throws XMLStreamException {
-        MTOMXMLStreamWriter writer =
-            new MTOMXMLStreamWriter(StAXUtils.createXMLStreamWriter(writerTarget));
-        writer.setOutputFormat(format);
-        serialize(writer);
-        writer.flush();
-        writer.close();
-    }
-
     public void serialize(XMLStreamWriter xmlWriter) throws XMLStreamException {
         try {
             context.marshal(jaxb, xmlWriter);
@@ -122,32 +70,8 @@ public class JAXBDataSource extends OMDa
             throw new XMLStreamException(je);
         }
     }
-    
-    public byte[] getXMLBytes(String encoding) throws UnsupportedEncodingException {
-        try {
-            ByteArrayOutputStream baos = new ByteArrayOutputStream();
-
-            // Exposes getOutputStream, which allows faster writes.
-            XMLStreamWriterWithOS writer = new XMLStreamWriterWithOS(baos, encoding);
-
-            // Write the business object to the writer
-            serialize(writer);
-
-            // Flush the writer
-            writer.flush();
-            writer.close();
-            return baos.toByteArray();
-        } catch (XMLStreamException e) {
-            throw new OMException(e);
-        }
-    }
-
-    public boolean isDestructiveRead() {
-        return false;
-    }
 
     public boolean isDestructiveWrite() {
         return false;
     }
-    
 }

Propchange: axis/axis2/java/core/branches/AXIS2-4091/modules/jaxws/src/org/apache/axis2/datasource/jaxb/XMLStreamWriterFilterBase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: axis/axis2/java/core/branches/AXIS2-4091/modules/jaxws/src/org/apache/axis2/datasource/jaxb/XMLStreamWriterFilterBase.java
------------------------------------------------------------------------------
--- svn:mergeinfo (added)
+++ svn:mergeinfo Sun Dec 17 22:34:08 2017
@@ -0,0 +1,23 @@
+/axis/axis2/java/core/branches/1_6/modules/jaxws/src/org/apache/axis2/datasource/jaxb/XMLStreamWriterFilterBase.java:1295540
+/axis/axis2/java/core/branches/AXIOM-420/modules/jaxws/src/org/apache/axis2/datasource/jaxb/XMLStreamWriterFilterBase.java:1334386-1336397
+/axis/axis2/java/core/branches/AXIS2-4318/modules/jaxws/src/org/apache/axis2/datasource/jaxb/XMLStreamWriterFilterBase.java:1230452,1295542,1324772,1327468,1329571,1332141,1335355,1335357,1340985
+/axis/axis2/java/core/branches/AXIS2-5785/modules/jaxws/src/org/apache/axis2/datasource/jaxb/XMLStreamWriterFilterBase.java:1793298-1793391
+/axis/axis2/java/core/branches/google-java-format/modules/jaxws/src/org/apache/axis2/datasource/jaxb/XMLStreamWriterFilterBase.java:1800516-1800554
+/axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/datasource/jaxb/XMLStreamWriterFilterBase.java:1441270-1536050,1745426-1818516
+/webservices/axiom/branches/AXIOM-201/axiom-api/src/main/java/org/apache/axiom/om/util/XMLStreamWriterFilterBase.java:1183599-1433135
+/webservices/axiom/branches/AXIOM-399/axiom-api/src/main/java/org/apache/axiom/om/util/XMLStreamWriterFilterBase.java:1329379-1331100
+/webservices/axiom/branches/AXIOM-412/axiom-api/src/main/java/org/apache/axiom/om/util/XMLStreamWriterFilterBase.java:1311325-1325526
+/webservices/axiom/branches/AXIOM-420/axiom-api/src/main/java/org/apache/axiom/om/util/XMLStreamWriterFilterBase.java:1334121-1336372
+/webservices/axiom/branches/AXIOM-435/axiom-api/src/main/java/org/apache/axiom/om/util/XMLStreamWriterFilterBase.java:1361507-1366198
+/webservices/axiom/branches/AXIOM-437/axiom-api/src/main/java/org/apache/axiom/om/util/XMLStreamWriterFilterBase.java:1364041-1364239
+/webservices/axiom/branches/AXIOM-476/axiom-api/src/main/java/org/apache/axiom/om/util/XMLStreamWriterFilterBase.java:1718738-1718932
+/webservices/axiom/branches/CHECK_PARENT_BUG/axiom-api/src/main/java/org/apache/axiom/om/util/XMLStreamWriterFilterBase.java:1338398-1338886
+/webservices/axiom/branches/CLONE/axiom-api/src/main/java/org/apache/axiom/om/util/XMLStreamWriterFilterBase.java:1337822-1339011
+/webservices/axiom/branches/CLONE_NODE/axiom-api/src/main/java/org/apache/axiom/om/util/XMLStreamWriterFilterBase.java:1346607-1353106
+/webservices/axiom/branches/DOXIA-492/axiom-api/src/main/java/org/apache/axiom/om/util/XMLStreamWriterFilterBase.java:1715574-1716528
+/webservices/axiom/branches/JAXB2_DS/axiom-api/src/main/java/org/apache/axiom/om/util/XMLStreamWriterFilterBase.java:1366463-1367737
+/webservices/axiom/branches/attrs-aspects/axiom-api/src/main/java/org/apache/axiom/om/util/XMLStreamWriterFilterBase.java:1685218-1686663
+/webservices/axiom/branches/maven-site-plugin-3.5/axiom-api/src/main/java/org/apache/axiom/om/util/XMLStreamWriterFilterBase.java:1731125-1732708
+/webservices/axiom/branches/namespaceURIInterning/axiom-api/src/main/java/org/apache/axiom/om/util/XMLStreamWriterFilterBase.java:1293148-1293587
+/webservices/axiom/branches/osgi-redesign/axiom-api/src/main/java/org/apache/axiom/om/util/XMLStreamWriterFilterBase.java:1180368-1180596
+/webservices/axiom/branches/stax-stream/axiom-api/src/main/java/org/apache/axiom/om/util/XMLStreamWriterFilterBase.java:1733528-1733796

Propchange: axis/axis2/java/core/branches/AXIS2-4091/modules/jaxws/src/org/apache/axis2/datasource/jaxb/XMLStreamWriterRemoveIllegalChars.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: axis/axis2/java/core/branches/AXIS2-4091/modules/jaxws/src/org/apache/axis2/datasource/jaxb/XMLStreamWriterRemoveIllegalChars.java
------------------------------------------------------------------------------
--- svn:mergeinfo (added)
+++ svn:mergeinfo Sun Dec 17 22:34:08 2017
@@ -0,0 +1,23 @@
+/axis/axis2/java/core/branches/1_6/modules/jaxws/src/org/apache/axis2/datasource/jaxb/XMLStreamWriterRemoveIllegalChars.java:1295540
+/axis/axis2/java/core/branches/AXIOM-420/modules/jaxws/src/org/apache/axis2/datasource/jaxb/XMLStreamWriterRemoveIllegalChars.java:1334386-1336397
+/axis/axis2/java/core/branches/AXIS2-4318/modules/jaxws/src/org/apache/axis2/datasource/jaxb/XMLStreamWriterRemoveIllegalChars.java:1230452,1295542,1324772,1327468,1329571,1332141,1335355,1335357,1340985
+/axis/axis2/java/core/branches/AXIS2-5785/modules/jaxws/src/org/apache/axis2/datasource/jaxb/XMLStreamWriterRemoveIllegalChars.java:1793298-1793391
+/axis/axis2/java/core/branches/google-java-format/modules/jaxws/src/org/apache/axis2/datasource/jaxb/XMLStreamWriterRemoveIllegalChars.java:1800516-1800554
+/axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/datasource/jaxb/XMLStreamWriterRemoveIllegalChars.java:1441270-1536050,1745426-1818516
+/webservices/axiom/branches/AXIOM-201/axiom-api/src/main/java/org/apache/axiom/om/util/XMLStreamWriterRemoveIllegalChars.java:1183599-1433135
+/webservices/axiom/branches/AXIOM-399/axiom-api/src/main/java/org/apache/axiom/om/util/XMLStreamWriterRemoveIllegalChars.java:1329379-1331100
+/webservices/axiom/branches/AXIOM-412/axiom-api/src/main/java/org/apache/axiom/om/util/XMLStreamWriterRemoveIllegalChars.java:1311325-1325526
+/webservices/axiom/branches/AXIOM-420/axiom-api/src/main/java/org/apache/axiom/om/util/XMLStreamWriterRemoveIllegalChars.java:1334121-1336372
+/webservices/axiom/branches/AXIOM-435/axiom-api/src/main/java/org/apache/axiom/om/util/XMLStreamWriterRemoveIllegalChars.java:1361507-1366198
+/webservices/axiom/branches/AXIOM-437/axiom-api/src/main/java/org/apache/axiom/om/util/XMLStreamWriterRemoveIllegalChars.java:1364041-1364239
+/webservices/axiom/branches/AXIOM-476/axiom-api/src/main/java/org/apache/axiom/om/util/XMLStreamWriterRemoveIllegalChars.java:1718738-1718932
+/webservices/axiom/branches/CHECK_PARENT_BUG/axiom-api/src/main/java/org/apache/axiom/om/util/XMLStreamWriterRemoveIllegalChars.java:1338398-1338886
+/webservices/axiom/branches/CLONE/axiom-api/src/main/java/org/apache/axiom/om/util/XMLStreamWriterRemoveIllegalChars.java:1337822-1339011
+/webservices/axiom/branches/CLONE_NODE/axiom-api/src/main/java/org/apache/axiom/om/util/XMLStreamWriterRemoveIllegalChars.java:1346607-1353106
+/webservices/axiom/branches/DOXIA-492/axiom-api/src/main/java/org/apache/axiom/om/util/XMLStreamWriterRemoveIllegalChars.java:1715574-1716528
+/webservices/axiom/branches/JAXB2_DS/axiom-api/src/main/java/org/apache/axiom/om/util/XMLStreamWriterRemoveIllegalChars.java:1366463-1367737
+/webservices/axiom/branches/attrs-aspects/axiom-api/src/main/java/org/apache/axiom/om/util/XMLStreamWriterRemoveIllegalChars.java:1685218-1686663
+/webservices/axiom/branches/maven-site-plugin-3.5/axiom-api/src/main/java/org/apache/axiom/om/util/XMLStreamWriterRemoveIllegalChars.java:1731125-1732708
+/webservices/axiom/branches/namespaceURIInterning/axiom-api/src/main/java/org/apache/axiom/om/util/XMLStreamWriterRemoveIllegalChars.java:1293148-1293587
+/webservices/axiom/branches/osgi-redesign/axiom-api/src/main/java/org/apache/axiom/om/util/XMLStreamWriterRemoveIllegalChars.java:1180368-1180596
+/webservices/axiom/branches/stax-stream/axiom-api/src/main/java/org/apache/axiom/om/util/XMLStreamWriterRemoveIllegalChars.java:1733528-1733796

Modified: axis/axis2/java/core/branches/AXIS2-4091/modules/jaxws/src/org/apache/axis2/jaxws/api/MessageAccessor.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/AXIS2-4091/modules/jaxws/src/org/apache/axis2/jaxws/api/MessageAccessor.java?rev=1818518&r1=1818517&r2=1818518&view=diff
==============================================================================
--- axis/axis2/java/core/branches/AXIS2-4091/modules/jaxws/src/org/apache/axis2/jaxws/api/MessageAccessor.java (original)
+++ axis/axis2/java/core/branches/AXIS2-4091/modules/jaxws/src/org/apache/axis2/jaxws/api/MessageAccessor.java Sun Dec 17 22:34:08 2017
@@ -18,23 +18,13 @@
  */
 package org.apache.axis2.jaxws.api;
 
-import java.io.ByteArrayOutputStream;
-import java.io.UnsupportedEncodingException;
-
-import javax.xml.stream.FactoryConfigurationError;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.ws.WebServiceException;
-
-import org.apache.axiom.om.OMOutputFormat;
-import org.apache.axiom.om.impl.MTOMXMLStreamWriter;
-import org.apache.axis2.Constants;
 import org.apache.axis2.jaxws.core.MessageContext;
 import org.apache.axis2.jaxws.message.Message;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
 /**
- * Value of the Constants.JAXWS_MESSAGE_ACCESSOR property 
+ * Value of the {@link org.apache.axis2.jaxws.Constants#JAXWS_MESSAGE_ACCESSOR} property.
  * Allows a user to gain access to certain Message information
  * that are not exposed by the Message on the
  * javax.xml.ws.handler.MessageContext
@@ -63,15 +53,7 @@ public class MessageAccessor {
         
         if (msg != null) {
             try {
-                ByteArrayOutputStream baos = new ByteArrayOutputStream();
-                OMOutputFormat format = new OMOutputFormat();
-                String charSetEncoding = (String) mc.getProperty(Constants.Configuration.CHARACTER_SET_ENCODING);
-                charSetEncoding = (charSetEncoding == null) ? "UTF-8" : charSetEncoding;
-                format.setCharSetEncoding(charSetEncoding);
-                MTOMXMLStreamWriter writer  = new MTOMXMLStreamWriter(baos, format);
-                msg.outputTo(writer, false);
-                writer.flush();
-                text =  baos.toString(charSetEncoding);
+                text = msg.getAsOMElement().toString();
             } catch (Throwable t) {
                 if (log.isDebugEnabled()) {
                     log.debug("Cannot access message as string", t);
@@ -84,11 +66,4 @@ public class MessageAccessor {
         }
         return text;
     }
-  
-    /* (non-Javadoc)
-     * @see java.lang.Object#toString()
-     */
-    public String toString() {
-        return getMessageAsString();
-    }
 }

Modified: axis/axis2/java/core/branches/AXIS2-4091/modules/jaxws/src/org/apache/axis2/jaxws/core/MessageContext.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/AXIS2-4091/modules/jaxws/src/org/apache/axis2/jaxws/core/MessageContext.java?rev=1818518&r1=1818517&r2=1818518&view=diff
==============================================================================
--- axis/axis2/java/core/branches/AXIS2-4091/modules/jaxws/src/org/apache/axis2/jaxws/core/MessageContext.java (original)
+++ axis/axis2/java/core/branches/AXIS2-4091/modules/jaxws/src/org/apache/axis2/jaxws/core/MessageContext.java Sun Dec 17 22:34:08 2017
@@ -19,11 +19,8 @@
 
 package org.apache.axis2.jaxws.core;
 
-import org.apache.axiom.om.util.DetachableInputStream;
 import org.apache.axis2.AxisFault;
-import org.apache.axis2.Constants;
 import org.apache.axis2.description.AxisService;
-import org.apache.axis2.jaxws.api.MessageAccessor;
 import org.apache.axis2.jaxws.api.MessageAccessorFactory;
 import org.apache.axis2.jaxws.description.EndpointDescription;
 import org.apache.axis2.jaxws.description.OperationDescription;
@@ -31,8 +28,7 @@ import org.apache.axis2.jaxws.handler.ME
 import org.apache.axis2.jaxws.message.Message;
 import org.apache.axis2.jaxws.message.util.MessageUtils;
 import org.apache.axis2.jaxws.registry.FactoryRegistry;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
+import org.apache.axis2.transport.TransportUtils;
 
 import javax.xml.namespace.QName;
 import javax.xml.ws.BindingProvider;
@@ -56,9 +52,6 @@ import java.util.Map;
  * is available.
  */
 public class MessageContext {
-
-    private static Log log = LogFactory.getLog(MessageContext.class);
-    
     private InvocationContext invocationCtx;
     private org.apache.axis2.context.MessageContext axisMsgCtx;
     private EndpointDescription endpointDesc;
@@ -145,10 +138,10 @@ public class MessageContext {
     public Map<String, Object> getProperties() {
         // only use properties that are local to the axis2 MC,
         // not the options bag.  See org.apache.axis2.context.AbstractContext
-        Iterator names = axisMsgCtx.getPropertyNames();
-        HashMap tempProps = new HashMap<String, Object>();
+        Iterator<String> names = axisMsgCtx.getPropertyNames();
+        HashMap<String, Object> tempProps = new HashMap<String, Object>();
         for (; names.hasNext();) {
-            String name = (String)names.next();
+            String name = names.next();
             tempProps.put(name, axisMsgCtx.getProperty(name));
         }
         //return new ReadOnlyProperties(tempProps);
@@ -356,18 +349,6 @@ public class MessageContext {
      * This allows the transport layer to free resources and pool connections
      */
     public void freeInputStream() throws IOException {
-        
-        
-        // During builder processing, the original input stream was wrapped with
-        // a detachable input stream.  The detachable input stream's detach method
-        // causes the original stream to be consumed and closed.
-        DetachableInputStream is = (DetachableInputStream) 
-            getProperty(Constants.DETACHABLE_INPUT_STREAM);
-        if (is != null) {
-            if (log.isDebugEnabled()) {
-                log.debug("Detaching inbound input stream " + is);
-            }
-            is.detach();
-        }
+        TransportUtils.detachInputStream(axisMsgCtx);
     }
 }

Modified: axis/axis2/java/core/branches/AXIS2-4091/modules/jaxws/src/org/apache/axis2/jaxws/core/controller/impl/AxisInvocationController.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/AXIS2-4091/modules/jaxws/src/org/apache/axis2/jaxws/core/controller/impl/AxisInvocationController.java?rev=1818518&r1=1818517&r2=1818518&view=diff
==============================================================================
--- axis/axis2/java/core/branches/AXIS2-4091/modules/jaxws/src/org/apache/axis2/jaxws/core/controller/impl/AxisInvocationController.java (original)
+++ axis/axis2/java/core/branches/AXIS2-4091/modules/jaxws/src/org/apache/axis2/jaxws/core/controller/impl/AxisInvocationController.java Sun Dec 17 22:34:08 2017
@@ -49,7 +49,7 @@ import org.apache.axis2.jaxws.util.Const
 import org.apache.axis2.jaxws.utility.ClassUtils;
 import org.apache.axis2.transport.http.HTTPConstants;
 import org.apache.axis2.transport.http.HttpTransportProperties;
-import org.apache.axis2.transport.http.impl.httpclient3.HttpTransportPropertiesImpl;
+import org.apache.axis2.transport.http.impl.httpclient4.HttpTransportPropertiesImpl;
 import org.apache.axis2.util.ThreadContextMigratorUtil;
 import org.apache.axis2.wsdl.WSDLConstants;
 import org.apache.commons.logging.Log;