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 2018/12/22 10:35:27 UTC

svn commit: r1849535 - in /axis/axis2/java/core/trunk/modules: fastinfoset/src/org/apache/axis2/fastinfoset/ json/src/org/apache/axis2/json/gson/ kernel/src/org/apache/axis2/transport/http/

Author: veithen
Date: Sat Dec 22 10:35:26 2018
New Revision: 1849535

URL: http://svn.apache.org/viewvc?rev=1849535&view=rev
Log:
Replace usages of deprecated Axiom APIs.

Modified:
    axis/axis2/java/core/trunk/modules/fastinfoset/src/org/apache/axis2/fastinfoset/FastInfosetMessageFormatter.java
    axis/axis2/java/core/trunk/modules/fastinfoset/src/org/apache/axis2/fastinfoset/FastInfosetPOXMessageFormatter.java
    axis/axis2/java/core/trunk/modules/json/src/org/apache/axis2/json/gson/JsonFormatter.java
    axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/transport/http/ApplicationXMLFormatter.java
    axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/transport/http/SOAPMessageFormatter.java

Modified: axis/axis2/java/core/trunk/modules/fastinfoset/src/org/apache/axis2/fastinfoset/FastInfosetMessageFormatter.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/fastinfoset/src/org/apache/axis2/fastinfoset/FastInfosetMessageFormatter.java?rev=1849535&r1=1849534&r2=1849535&view=diff
==============================================================================
--- axis/axis2/java/core/trunk/modules/fastinfoset/src/org/apache/axis2/fastinfoset/FastInfosetMessageFormatter.java (original)
+++ axis/axis2/java/core/trunk/modules/fastinfoset/src/org/apache/axis2/fastinfoset/FastInfosetMessageFormatter.java Sat Dec 22 10:35:26 2018
@@ -145,11 +145,7 @@ public class FastInfosetMessageFormatter
             //Create the StAX document serializer
             XMLStreamWriter streamWriter = new StAXDocumentSerializer(outputStream);
             streamWriter.writeStartDocument();
-            if (preserve) {
-                element.serialize(streamWriter);
-            } else {
-                element.serializeAndConsume(streamWriter);
-            }
+            element.serialize(streamWriter, preserve);
 //            TODO Looks like the SOAP envelop doesn't have a end document tag. Find out why?
             streamWriter.writeEndDocument();
         } catch (XMLStreamException xmlse) {

Modified: axis/axis2/java/core/trunk/modules/fastinfoset/src/org/apache/axis2/fastinfoset/FastInfosetPOXMessageFormatter.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/fastinfoset/src/org/apache/axis2/fastinfoset/FastInfosetPOXMessageFormatter.java?rev=1849535&r1=1849534&r2=1849535&view=diff
==============================================================================
--- axis/axis2/java/core/trunk/modules/fastinfoset/src/org/apache/axis2/fastinfoset/FastInfosetPOXMessageFormatter.java (original)
+++ axis/axis2/java/core/trunk/modules/fastinfoset/src/org/apache/axis2/fastinfoset/FastInfosetPOXMessageFormatter.java Sat Dec 22 10:35:26 2018
@@ -148,11 +148,7 @@ public class FastInfosetPOXMessageFormat
             XMLStreamWriter streamWriter = new StAXDocumentSerializer(outputStream);
             //Since we drop the SOAP envelop we have to manually write the start document and the end document events            
             streamWriter.writeStartDocument();
-            if (preserve) {
-                element.serialize(streamWriter);
-            } else {
-                element.serializeAndConsume(streamWriter);
-            }
+            element.serialize(streamWriter, preserve);
             streamWriter.writeEndDocument();
         } catch (XMLStreamException xmlse) {
             logger.error(xmlse.getMessage());

Modified: axis/axis2/java/core/trunk/modules/json/src/org/apache/axis2/json/gson/JsonFormatter.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/json/src/org/apache/axis2/json/gson/JsonFormatter.java?rev=1849535&r1=1849534&r2=1849535&view=diff
==============================================================================
--- axis/axis2/java/core/trunk/modules/json/src/org/apache/axis2/json/gson/JsonFormatter.java (original)
+++ axis/axis2/java/core/trunk/modules/json/src/org/apache/axis2/json/gson/JsonFormatter.java Sat Dec 22 10:35:26 2018
@@ -52,7 +52,7 @@ public class JsonFormatter implements Me
         return new byte[0];
     }
 
-    public void writeTo(MessageContext outMsgCtxt, OMOutputFormat omOutputFormat, OutputStream outputStream, boolean b) throws AxisFault {
+    public void writeTo(MessageContext outMsgCtxt, OMOutputFormat omOutputFormat, OutputStream outputStream, boolean preserve) throws AxisFault {
         String charSetEncoding = (String) outMsgCtxt.getProperty(Constants.Configuration.CHARACTER_SET_ENCODING);
         JsonWriter jsonWriter;
         String msg;
@@ -94,11 +94,7 @@ public class JsonFormatter implements Me
                                                                     outMsgCtxt.getConfigurationContext());
                 try {
                     xmlsw.writeStartDocument();
-                    if (b) {
-                        element.serialize(xmlsw);
-                    } else {
-                        element.serializeAndConsume(xmlsw);
-                    }
+                    element.serialize(xmlsw, preserve);
                     xmlsw.writeEndDocument();
                 } catch (XMLStreamException e) {
                     throw new AxisFault("Error while writing to the output stream using JsonWriter", e);

Modified: axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/transport/http/ApplicationXMLFormatter.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/transport/http/ApplicationXMLFormatter.java?rev=1849535&r1=1849534&r2=1849535&view=diff
==============================================================================
--- axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/transport/http/ApplicationXMLFormatter.java (original)
+++ axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/transport/http/ApplicationXMLFormatter.java Sat Dec 22 10:35:26 2018
@@ -33,7 +33,6 @@ import org.apache.axis2.util.JavaUtils;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
-import javax.xml.stream.XMLStreamException;
 import java.io.ByteArrayOutputStream;
 import java.io.IOException;
 import java.io.OutputStream;
@@ -92,12 +91,8 @@ public class ApplicationXMLFormatter imp
             if (omElement != null) {
 
                 try {
-                    if (preserve) {
-                        omElement.serialize(bytesOut, format);
-                    } else {
-                        omElement.serializeAndConsume(bytesOut, format);
-                    }
-                } catch (XMLStreamException e) {
+                    omElement.serialize(bytesOut, format, preserve);
+                } catch (IOException e) {
                     throw AxisFault.makeFault(e);
                 }
 
@@ -136,12 +131,8 @@ public class ApplicationXMLFormatter imp
             }
             if (omElement != null) {
                 try {
-                    if (preserve) {
-                        omElement.serialize(outputStream, format);
-                    } else {
-                        omElement.serializeAndConsume(outputStream, format);
-                    }
-                } catch (XMLStreamException e) {
+                    omElement.serialize(outputStream, format, preserve);
+                } catch (IOException e) {
                     throw AxisFault.makeFault(e);
                 }
             }

Modified: axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/transport/http/SOAPMessageFormatter.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/transport/http/SOAPMessageFormatter.java?rev=1849535&r1=1849534&r2=1849535&view=diff
==============================================================================
--- axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/transport/http/SOAPMessageFormatter.java (original)
+++ axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/transport/http/SOAPMessageFormatter.java Sat Dec 22 10:35:26 2018
@@ -38,7 +38,6 @@ import org.apache.axis2.util.Utils;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
-import javax.xml.stream.FactoryConfigurationError;
 import javax.xml.stream.XMLStreamException;
 import java.io.ByteArrayOutputStream;
 import java.io.IOException;
@@ -84,13 +83,9 @@ public class SOAPMessageFormatter implem
                     message = ((SOAPFactory)envelope.getOMFactory()).createSOAPMessage();
                     message.setSOAPEnvelope(envelope);
                 }
-                if (preserve) {
-                    message.serialize(out, format);
-                } else {
-                    message.serializeAndConsume(out, format);
-                }
+                message.serialize(out, format, preserve);
             }
-        } catch (XMLStreamException e) {
+        } catch (IOException e) {
             throw AxisFault.makeFault(e);
         } finally {
             if (log.isDebugEnabled()) {