You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commons-dev@ws.apache.org by aj...@apache.org on 2006/08/03 13:27:34 UTC

svn commit: r428350 - /webservices/commons/trunk/modules/axiom/src/org/apache/axiom/om/impl/llom/OMTextImpl.java

Author: ajith
Date: Thu Aug  3 04:27:33 2006
New Revision: 428350

URL: http://svn.apache.org/viewvc?rev=428350&view=rev
Log:
1. Optimized the serialization of the OMTextImpl.java. The code that existed was *very* unsafe!

Modified:
    webservices/commons/trunk/modules/axiom/src/org/apache/axiom/om/impl/llom/OMTextImpl.java

Modified: webservices/commons/trunk/modules/axiom/src/org/apache/axiom/om/impl/llom/OMTextImpl.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/src/org/apache/axiom/om/impl/llom/OMTextImpl.java?rev=428350&r1=428349&r2=428350&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/src/org/apache/axiom/om/impl/llom/OMTextImpl.java (original)
+++ webservices/commons/trunk/modules/axiom/src/org/apache/axiom/om/impl/llom/OMTextImpl.java Thu Aug  3 04:27:33 2006
@@ -404,25 +404,34 @@
     }
 
     private void internalSerializeLocal(XMLStreamWriter writer2) throws XMLStreamException {
-        MTOMXMLStreamWriter writer = (MTOMXMLStreamWriter) writer2;
-
+        
         if (!this.isBinary) {
-            writeOutput(writer);
+            writeOutput(writer2);
         } else {
-
-            if (writer.isOptimized()) {
-                if (contentID == null) {
-                    contentID = writer.getNextContentId();
+            //check whether we have a MTOMXMLStreamWriter. if so
+            //we can optimize the writing!
+            if (writer2 instanceof MTOMXMLStreamWriter){
+                MTOMXMLStreamWriter writer = (MTOMXMLStreamWriter) writer2;
+                if (writer.isOptimized()) {
+                    if (contentID == null) {
+                        contentID = writer.getNextContentId();
+                    }
+                    // send binary as MTOM optimised
+                    this.attribute = new OMAttributeImpl("href",
+                            new OMNamespaceImpl("", ""), "cid:" + getContentID(), this.factory);
+                    this.serializeStartpart(writer);
+                    writer.writeOptimized(this);
+                    writer.writeEndElement();
+                } else {
+                    //do normal base64
+                    writeOutput(writer);
                 }
-                // send binary as MTOM optimised
-                this.attribute = new OMAttributeImpl("href",
-                        new OMNamespaceImpl("", ""), "cid:" + getContentID(), this.factory);
-                this.serializeStartpart(writer);
-                writer.writeOptimized(this);
-                writer.writeEndElement();
-            } else {
-                writer.writeCharacters(this.getText());
+            }else{
+               //we do not have a optimized writer. Just do the normal
+               //base64 writing
+                writeOutput(writer2);
             }
+
         }
     }
 



---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: commons-dev-help@ws.apache.org