You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ws.apache.org by ve...@apache.org on 2016/05/07 06:56:11 UTC

svn commit: r1742687 - /webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/stream/serializer/

Author: veithen
Date: Sat May  7 06:56:10 2016
New Revision: 1742687

URL: http://svn.apache.org/viewvc?rev=1742687&view=rev
Log:
Use StreamException instead of SAXException.

Modified:
    webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/stream/serializer/ExtendedContentHandler.java
    webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/stream/serializer/ExtendedLexicalHandler.java
    webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/stream/serializer/SerializationHandler.java
    webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/stream/serializer/SerializerBase.java
    webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/stream/serializer/SerializerWriter.java
    webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/stream/serializer/SerializerXmlHandler.java
    webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/stream/serializer/ToStream.java
    webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/stream/serializer/ToXMLStream.java

Modified: webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/stream/serializer/ExtendedContentHandler.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/stream/serializer/ExtendedContentHandler.java?rev=1742687&r1=1742686&r2=1742687&view=diff
==============================================================================
--- webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/stream/serializer/ExtendedContentHandler.java (original)
+++ webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/stream/serializer/ExtendedContentHandler.java Sat May  7 06:56:10 2016
@@ -22,7 +22,7 @@ package org.apache.axiom.core.stream.ser
 
 import javax.xml.transform.SourceLocator;
 
-import org.xml.sax.SAXException;
+import org.apache.axiom.core.stream.StreamException;
 
 /**
  * This interface describes extensions to the SAX ContentHandler interface.
@@ -54,7 +54,7 @@ public interface ExtendedContentHandler
      * @param type the attribute type typically character data (CDATA)
      * @param value the value of the attribute
      * @param XSLAttribute true if the added attribute is coming from an xsl:attribute element
-     * @throws SAXException
+     * @throws StreamException
      */
     public void addAttribute(
         String uri,
@@ -63,14 +63,14 @@ public interface ExtendedContentHandler
         String type,
         String value,
         boolean XSLAttribute)
-        throws SAXException;
+        throws StreamException;
     /**
      * Add attributes to the current element
      * @param atts the attributes to add.
-     * @throws SAXException
+     * @throws StreamException
      */
     public void addAttributes(org.xml.sax.Attributes atts)
-        throws org.xml.sax.SAXException;
+        throws StreamException;
     /**
      * Add an attribute to the current element. The namespace URI of the
      * attribute will be calculated from the prefix of qName. The local name
@@ -84,17 +84,17 @@ public interface ExtendedContentHandler
      * This method is used to notify of a character event, but passing the data
      * as a character String rather than the standard character array.
      * @param chars the character data
-     * @throws SAXException
+     * @throws StreamException
      */
-    public void characters(String chars) throws SAXException;
+    public void characters(String chars) throws StreamException;
     
     /**
      * This method is used to notify of a character event, but passing the data
      * as a DOM Node rather than the standard character array.
      * @param node a DOM Node containing text.
-     * @throws SAXException
+     * @throws StreamException
      */    
-    public void characters(org.w3c.dom.Node node) throws org.xml.sax.SAXException;
+    public void characters(org.w3c.dom.Node node) throws StreamException;
     /**
      * This method is used to notify that an element has ended. Unlike the
      * standard SAX method
@@ -105,9 +105,9 @@ public interface ExtendedContentHandler
      * the localName from the qualified name and derive the namespaceURI from
      * its implementation.
      * @param elemName the fully qualified element name.
-     * @throws SAXException
+     * @throws StreamException
      */
-    public void endElement(String elemName) throws SAXException;
+    public void endElement(String elemName) throws StreamException;
 
     /**
      * This method is used to notify that an element is starting.
@@ -120,17 +120,17 @@ public interface ExtendedContentHandler
      * @param localName the local name (without prefix) of the element
      * @param qName the qualified name of the element
      * 
-     * @throws SAXException
+     * @throws StreamException
      */
     public void startElement(String uri, String localName, String qName)
-        throws org.xml.sax.SAXException;
+        throws StreamException;
 
     /**
      * This method is used to notify of the start of an element
      * @param qName the fully qualified name of the element
-     * @throws SAXException
+     * @throws StreamException
      */
-    public void startElement(String qName) throws SAXException;
+    public void startElement(String qName) throws StreamException;
     /**
      * This method is used to notify that a prefix mapping is to start, but
      * after an element is started. The SAX method call
@@ -147,10 +147,10 @@ public interface ExtendedContentHandler
      * 
      * @param uri the namespace URI being declared
      * @param prefix the prefix that maps to the given namespace
-     * @throws SAXException
+     * @throws StreamException
      */
     public void namespaceAfterStartElement(String uri, String prefix)
-        throws SAXException;
+        throws StreamException;
 
     /**
      * This method is used to notify that a prefix maping is to start, which can
@@ -163,19 +163,19 @@ public interface ExtendedContentHandler
      * @return boolean false if the prefix mapping was already in effect (in
      * other words we are just re-declaring), true if this is a new, never
      * before seen mapping for the element.
-     * @throws SAXException
+     * @throws StreamException
      */
     public boolean startPrefixMapping(
         String prefix,
         String uri,
         boolean shouldFlush)
-        throws SAXException;
+        throws StreamException;
     /**
      * Notify of an entity reference.
      * @param entityName the name of the entity
-     * @throws SAXException
+     * @throws StreamException
      */
-    public void entityReference(String entityName) throws SAXException;
+    public void entityReference(String entityName) throws StreamException;
 
     /**
      * This method returns an object that has the current namespace mappings in
@@ -241,7 +241,7 @@ public interface ExtendedContentHandler
      * @param flags a bitwise flag
      */
     public void addUniqueAttribute(String qName, String value, int flags)
-        throws SAXException;
+        throws StreamException;
     
     /**
      * Add an attribute from an xsl:attribute element.
@@ -259,7 +259,7 @@ public interface ExtendedContentHandler
      * @param rawName the qualified name of the attribute
      * @param type the attribute type typically character data (CDATA)
      * @param value the value of the attribute
-     * @throws SAXException
+     * @throws StreamException
      */
     public void addAttribute(
         String uri,
@@ -267,8 +267,8 @@ public interface ExtendedContentHandler
         String rawName,
         String type,
         String value)
-        throws SAXException;
+        throws StreamException;
 
     public void characters(char chars[], int start, int length)
-            throws org.xml.sax.SAXException;
+            throws StreamException;
 }

Modified: webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/stream/serializer/ExtendedLexicalHandler.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/stream/serializer/ExtendedLexicalHandler.java?rev=1742687&r1=1742686&r2=1742687&view=diff
==============================================================================
--- webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/stream/serializer/ExtendedLexicalHandler.java (original)
+++ webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/stream/serializer/ExtendedLexicalHandler.java Sat May  7 06:56:10 2016
@@ -20,7 +20,7 @@
  */
 package org.apache.axiom.core.stream.serializer;
 
-import org.xml.sax.SAXException;
+import org.apache.axiom.core.stream.StreamException;
 
 /**
  * This interface has extensions to the standard SAX LexicalHandler interface.
@@ -35,9 +35,9 @@ public interface ExtendedLexicalHandler
      * method takes a String rather than a character array.
      * @throws SAXException
      */
-    public void comment(String comment) throws SAXException;
+    public void comment(String comment) throws StreamException;
 
-    public void comment(char ch[], int start, int length) throws SAXException;
+    public void comment(char ch[], int start, int length) throws StreamException;
 
-    public void startEntity(String name) throws SAXException;
+    public void startEntity(String name) throws StreamException;
 }

Modified: webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/stream/serializer/SerializationHandler.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/stream/serializer/SerializationHandler.java?rev=1742687&r1=1742686&r2=1742687&view=diff
==============================================================================
--- webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/stream/serializer/SerializationHandler.java (original)
+++ webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/stream/serializer/SerializationHandler.java Sat May  7 06:56:10 2016
@@ -24,7 +24,7 @@ import java.io.IOException;
 
 import javax.xml.transform.Transformer;
 
-import org.xml.sax.SAXException;
+import org.apache.axiom.core.stream.StreamException;
 
 /**
  * This interface is the one that a serializer implements. It is a group of
@@ -54,7 +54,7 @@ public interface SerializationHandler
      * 
      * @param escape true if escaping is to be set on.
      */
-    public boolean setEscaping(boolean escape) throws SAXException;
+    public boolean setEscaping(boolean escape) throws StreamException;
 
     /**
      * Set the number of spaces to indent for each indentation level.
@@ -107,7 +107,7 @@ public interface SerializationHandler
      * For performance reasons this method should not be called
      * very often. 
      */
-    public void flushPending() throws SAXException;
+    public void flushPending() throws StreamException;
     
     /**
      * Default behavior is to expand DTD entities,

Modified: webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/stream/serializer/SerializerBase.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/stream/serializer/SerializerBase.java?rev=1742687&r1=1742686&r2=1742687&view=diff
==============================================================================
--- webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/stream/serializer/SerializerBase.java (original)
+++ webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/stream/serializer/SerializerBase.java Sat May  7 06:56:10 2016
@@ -28,11 +28,11 @@ import javax.xml.transform.OutputKeys;
 import javax.xml.transform.SourceLocator;
 import javax.xml.transform.Transformer;
 
+import org.apache.axiom.core.stream.StreamException;
 import org.apache.axiom.core.stream.serializer.utils.MsgKey;
 import org.apache.axiom.core.stream.serializer.utils.Utils;
 import org.xml.sax.Attributes;
 import org.xml.sax.Locator;
-import org.xml.sax.SAXException;
 
 /**
  * This class acts as a base class for the XML "serializers"
@@ -212,7 +212,7 @@ public abstract class SerializerBase
      * 
      * @see ExtendedLexicalHandler#comment(String)
      */
-    public void comment(String data) throws SAXException
+    public void comment(String data) throws StreamException
     {
         m_docIsEmpty = false;
         
@@ -328,7 +328,7 @@ public abstract class SerializerBase
         String type,
         String value,
         boolean XSLAttribute)
-        throws SAXException
+        throws StreamException
     {
         if (m_elemContext.m_startTagOpen)
         {
@@ -439,7 +439,7 @@ public abstract class SerializerBase
      * is currently open.
      * @param atts List of attributes to add to this list
      */
-    public void addAttributes(Attributes atts) throws SAXException
+    public void addAttributes(Attributes atts) throws StreamException
     {
 
         int nAtts = atts.getLength();
@@ -466,10 +466,10 @@ public abstract class SerializerBase
      * Report the end of an entity.
      *
      * @param name The name of the entity that is ending.
-     * @throws org.xml.sax.SAXException The application may raise an exception.
+     * @throws StreamException The application may raise an exception.
      * @see #startEntity
      */
-    public void endEntity(String name) throws org.xml.sax.SAXException
+    public void endEntity(String name) throws StreamException
     {
         if (name.equals("[dtd]"))
             m_inExternalDTD = false;
@@ -718,7 +718,7 @@ public abstract class SerializerBase
      * @see ExtendedContentHandler#namespaceAfterStartElement(String, String)
      */
     public void namespaceAfterStartElement(String uri, String prefix)
-        throws SAXException
+        throws StreamException
     {
         // default behavior is to do nothing
     }
@@ -825,9 +825,9 @@ public abstract class SerializerBase
      *
      * @param name Name of entity
      *
-     * @throws org.xml.sax.SAXException
+     * @throws StreamException
      */
-    public void entityReference(String name) throws org.xml.sax.SAXException
+    public void entityReference(String name) throws StreamException
     {
 
         flushPending();
@@ -859,10 +859,10 @@ public abstract class SerializerBase
      * This method gets the nodes value as a String and uses that String as if
      * it were an input character notification.
      * @param node the Node to serialize
-     * @throws org.xml.sax.SAXException
+     * @throws StreamException
      */
     public void characters(org.w3c.dom.Node node)
-        throws org.xml.sax.SAXException
+        throws StreamException
     {
         flushPending();
         String data = node.getNodeValue();
@@ -886,7 +886,7 @@ public abstract class SerializerBase
      * @param length  number of characters to output
      */
 //    protected void fireCharEvent(char[] chars, int start, int length)
-//        throws org.xml.sax.SAXException
+//        throws StreamException
 //    {
 //        if (m_tracer != null)
 //            m_tracer.fireGenerateEvent(SerializerTrace.EVENTTYPE_CHARACTERS, chars, start,length);     	        	    	
@@ -926,12 +926,12 @@ public abstract class SerializerBase
      * other methods in this interface or in DTDHandler (except for
      * setDocumentLocator).</p>
      *
-     * @throws org.xml.sax.SAXException Any SAX exception, possibly
+     * @throws StreamException Any SAX exception, possibly
      *            wrapping another exception.
      *
-     * @throws org.xml.sax.SAXException
+     * @throws StreamException
      */
-    public void startDocument() throws org.xml.sax.SAXException
+    public void startDocument() throws StreamException
     {
 
         // if we do get called with startDocument(), handle it right away       
@@ -954,9 +954,9 @@ public abstract class SerializerBase
      * called from an external caller, which in principle is just a matter of
      * style.
      * 
-     * @throws SAXException
+     * @throws StreamException
      */
-    protected void startDocumentInternal() throws org.xml.sax.SAXException
+    protected void startDocumentInternal() throws StreamException
     {
     } 
     /**
@@ -1046,7 +1046,7 @@ public abstract class SerializerBase
      * but should not be used for an xsl:attribute child.
      * @see ExtendedContentHandler#addAttribute(java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String)
      */
-    public void addAttribute(String uri, String localName, String rawName, String type, String value) throws SAXException 
+    public void addAttribute(String uri, String localName, String rawName, String type, String value) throws StreamException 
     {
         if (m_elemContext.m_startTagOpen)
         {
@@ -1058,7 +1058,7 @@ public abstract class SerializerBase
      * @see org.xml.sax.DTDHandler#notationDecl(java.lang.String, java.lang.String, java.lang.String)
      */
     public void notationDecl(String arg0, String arg1, String arg2)
-        throws SAXException {
+        throws StreamException {
         // This method just provides a definition to satisfy the interface
         // A particular sub-class of SerializerBase provides the implementation (if desired)        
     }
@@ -1071,7 +1071,7 @@ public abstract class SerializerBase
         String arg1,
         String arg2,
         String arg3)
-        throws SAXException {
+        throws StreamException {
         // This method just provides a definition to satisfy the interface
         // A particular sub-class of SerializerBase provides the implementation (if desired)        
     }

Modified: webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/stream/serializer/SerializerWriter.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/stream/serializer/SerializerWriter.java?rev=1742687&r1=1742686&r2=1742687&view=diff
==============================================================================
--- webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/stream/serializer/SerializerWriter.java (original)
+++ webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/stream/serializer/SerializerWriter.java Sat May  7 06:56:10 2016
@@ -21,7 +21,7 @@ package org.apache.axiom.core.stream.ser
 import java.io.IOException;
 import java.io.Writer;
 
-import org.xml.sax.SAXException;
+import org.apache.axiom.core.stream.StreamException;
 
 /**
  * {@link Writer} that writes character data as {@link ToXMLStream#characters(char[], int, int)}
@@ -37,7 +37,7 @@ final class SerializerWriter extends Wri
     public void write(char[] cbuf, int off, int len) throws IOException {
         try {
             serializer.characters(cbuf, off, len);
-        } catch (SAXException ex) {
+        } catch (StreamException ex) {
             IOException ioException = new IOException();
             ioException.initCause(ex);
             throw ioException;

Modified: webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/stream/serializer/SerializerXmlHandler.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/stream/serializer/SerializerXmlHandler.java?rev=1742687&r1=1742686&r2=1742687&view=diff
==============================================================================
--- webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/stream/serializer/SerializerXmlHandler.java (original)
+++ webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/stream/serializer/SerializerXmlHandler.java Sat May  7 06:56:10 2016
@@ -25,7 +25,6 @@ import org.apache.axiom.core.CharacterDa
 import org.apache.axiom.core.stream.StreamException;
 import org.apache.axiom.core.stream.XmlHandler;
 import org.apache.axiom.core.stream.util.CharacterDataAccumulator;
-import org.xml.sax.SAXException;
 import org.xml.sax.helpers.AttributesImpl;
 
 public class SerializerXmlHandler implements XmlHandler {
@@ -62,29 +61,17 @@ public class SerializerXmlHandler implem
     @Override
     public void startDocument(String inputEncoding, String xmlVersion, String xmlEncoding,
             boolean standalone) throws StreamException {
-        try {
-            serializer.startDocument();
-        } catch (SAXException ex) {
-            throw new StreamException(ex);
-        }
+        serializer.startDocument();
     }
     
     @Override
     public void startFragment() throws StreamException {
-        try {
-            serializer.startDocument();
-        } catch (SAXException ex) {
-            throw new StreamException(ex);
-        }
+        serializer.startDocument();
     }
 
     public void processDocumentTypeDeclaration(String rootName, String publicId, String systemId, String internalSubset) throws StreamException {
-        try {
-            serializer.startDTD(rootName, publicId, systemId);
-            serializer.endDTD();
-        } catch (SAXException ex) {
-            throw new StreamException(ex);
-        }
+        serializer.startDTD(rootName, publicId, systemId);
+        serializer.endDTD();
     }
 
     public void startElement(String namespaceURI, String localName, String prefix) throws StreamException {
@@ -106,11 +93,7 @@ public class SerializerXmlHandler implem
             prefixStack = newPrefixStack;
         }
         prefixStack[bindings++] = prefix;
-        try {
-            serializer.startPrefixMapping(prefix, namespaceURI);
-        } catch (SAXException ex) {
-            throw new StreamException(ex);
-        }
+        serializer.startPrefixMapping(prefix, namespaceURI);
         // TODO: depending on the http://xml.org/sax/features/xmlns-uris feature, we also need to add an attribute
     }
 
@@ -119,33 +102,25 @@ public class SerializerXmlHandler implem
     }
 
     public void attributesCompleted() throws StreamException {
-        try {
-            serializer.startElement(elementURI, elementLocalName, elementQName, attributes);
-            elementNameStack.push(elementURI);
-            elementNameStack.push(elementLocalName);
-            elementNameStack.push(elementQName);
-            elementURI = null;
-            elementLocalName = null;
-            elementQName = null;
-            attributes.clear();
-        } catch (SAXException ex) {
-            throw new StreamException(ex);
-        }
+        serializer.startElement(elementURI, elementLocalName, elementQName, attributes);
+        elementNameStack.push(elementURI);
+        elementNameStack.push(elementLocalName);
+        elementNameStack.push(elementQName);
+        elementURI = null;
+        elementLocalName = null;
+        elementQName = null;
+        attributes.clear();
     }
 
     public void endElement() throws StreamException {
-        try {
-            String elementQName = elementNameStack.pop();
-            String elementLocalName = elementNameStack.pop();
-            String elementURI = elementNameStack.pop();
-            serializer.endElement(elementURI, elementLocalName, elementQName);
-            for (int i=bindings-1; i>=scopeStack[depth-1]; i--) {
-                serializer.endPrefixMapping(prefixStack[i]);
-            }
-            bindings = scopeStack[--depth];
-        } catch (SAXException ex) {
-            throw new StreamException(ex);
+        String elementQName = elementNameStack.pop();
+        String elementLocalName = elementNameStack.pop();
+        String elementURI = elementNameStack.pop();
+        serializer.endElement(elementURI, elementLocalName, elementQName);
+        for (int i=bindings-1; i>=scopeStack[depth-1]; i--) {
+            serializer.endPrefixMapping(prefixStack[i]);
         }
+        bindings = scopeStack[--depth];
     }
 
     private void writeToBuffer(String data) {
@@ -164,61 +139,47 @@ public class SerializerXmlHandler implem
     }
 
     public void processCharacterData(Object data, boolean ignorable) throws StreamException {
-        try {
-            switch (characterDataMode) {
-                case PASS_THROUGH:
-                    if (ignorable) {
-                        writeToBuffer(data.toString());
-                        serializer.ignorableWhitespace(buffer, 0, bufferPos);
-                        bufferPos = 0;
-                    } else if (data instanceof CharacterData) {
-                        try {
-                            ((CharacterData)data).writeTo(new SerializerWriter(serializer));
-                        } catch (IOException ex) {
-                            Throwable cause = ex.getCause();
-                            SAXException saxException;
-                            if (cause instanceof SAXException) {
-                                saxException = (SAXException)cause;
-                            } else {
-                                saxException = new SAXException(ex);
-                            }
-                            throw new StreamException(saxException);
+        switch (characterDataMode) {
+            case PASS_THROUGH:
+                if (ignorable) {
+                    writeToBuffer(data.toString());
+                    serializer.ignorableWhitespace(buffer, 0, bufferPos);
+                    bufferPos = 0;
+                } else if (data instanceof CharacterData) {
+                    try {
+                        ((CharacterData)data).writeTo(new SerializerWriter(serializer));
+                    } catch (IOException ex) {
+                        Throwable cause = ex.getCause();
+                        if (cause instanceof StreamException) {
+                            throw (StreamException)cause;
+                        } else {
+                            throw new StreamException(ex);
                         }
-                    } else {
-                        writeToBuffer(data.toString());
-                        serializer.characters(buffer, 0, bufferPos);
-                        bufferPos = 0;
                     }
-                    break;
-                case BUFFER:
+                } else {
                     writeToBuffer(data.toString());
-                    break;
-                case ACCUMULATE:
-                    accumulator.append(data);
-                    break;
-                case SKIP:
-            }
-        } catch (SAXException ex) {
-            throw new StreamException(ex);
+                    serializer.characters(buffer, 0, bufferPos);
+                    bufferPos = 0;
+                }
+                break;
+            case BUFFER:
+                writeToBuffer(data.toString());
+                break;
+            case ACCUMULATE:
+                accumulator.append(data);
+                break;
+            case SKIP:
         }
     }
     
     @Override
     public void startCDATASection() throws StreamException {
-        try {
-            serializer.startCDATA();
-        } catch (SAXException ex) {
-            throw new StreamException(ex);
-        }
+        serializer.startCDATA();
     }
 
     @Override
     public void endCDATASection() throws StreamException {
-        try {
-            serializer.endCDATA();
-        } catch (SAXException ex) {
-            throw new StreamException(ex);
-        }
+        serializer.endCDATA();
     }
 
     @Override
@@ -228,12 +189,8 @@ public class SerializerXmlHandler implem
 
     @Override
     public void endComment() throws StreamException {
-        try {
-            serializer.comment(buffer, 0, bufferPos);
-            bufferPos = 0;
-        } catch (SAXException ex) {
-            throw new StreamException(ex);
-        }
+        serializer.comment(buffer, 0, bufferPos);
+        bufferPos = 0;
         characterDataMode = CharacterDataMode.PASS_THROUGH;
     }
 
@@ -248,29 +205,17 @@ public class SerializerXmlHandler implem
 
     @Override
     public void endProcessingInstruction() throws StreamException {
-        try {
-            serializer.processingInstruction(piTarget, accumulator.toString());
-            accumulator.clear();
-            piTarget = null;
-            characterDataMode = CharacterDataMode.PASS_THROUGH;
-        } catch (SAXException ex) {
-            throw new StreamException(ex);
-        }
+        serializer.processingInstruction(piTarget, accumulator.toString());
+        accumulator.clear();
+        piTarget = null;
+        characterDataMode = CharacterDataMode.PASS_THROUGH;
     }
 
     public void processEntityReference(String name, String replacementText) throws StreamException {
-        try {
-            serializer.skippedEntity(name);
-        } catch (SAXException ex) {
-            throw new StreamException(ex);
-        }
+        serializer.skippedEntity(name);
     }
 
     public void completed() throws StreamException {
-        try {
-            serializer.endDocument();
-        } catch (SAXException ex) {
-            throw new StreamException(ex);
-        }
+        serializer.endDocument();
     }
 }

Modified: webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/stream/serializer/ToStream.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/stream/serializer/ToStream.java?rev=1742687&r1=1742686&r2=1742687&view=diff
==============================================================================
--- webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/stream/serializer/ToStream.java (original)
+++ webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/stream/serializer/ToStream.java Sat May  7 06:56:10 2016
@@ -36,10 +36,10 @@ import javax.xml.transform.OutputKeys;
 import javax.xml.transform.Transformer;
 import javax.xml.transform.TransformerException;
 
+import org.apache.axiom.core.stream.StreamException;
 import org.apache.axiom.core.stream.serializer.utils.MsgKey;
 import org.apache.axiom.core.stream.serializer.utils.Utils;
 import org.xml.sax.Attributes;
-import org.xml.sax.SAXException;
 
 /**
  * This abstract class is a base class for other stream 
@@ -181,9 +181,9 @@ abstract public class ToStream extends S
     /**
      * This helper method to writes out "]]>" when closing a CDATA section.
      *
-     * @throws org.xml.sax.SAXException
+     * @throws StreamException
      */
-    protected void closeCDATA() throws org.xml.sax.SAXException
+    protected void closeCDATA() throws StreamException
     {
         try
         {
@@ -193,7 +193,7 @@ abstract public class ToStream extends S
         }
         catch (IOException e)
         {
-            throw new SAXException(e);
+            throw new StreamException(e);
         }
     }
 
@@ -205,9 +205,9 @@ abstract public class ToStream extends S
     /**
      * Flush the formatter's result stream.
      *
-     * @throws org.xml.sax.SAXException
+     * @throws StreamException
      */
-    protected final void flushWriter() throws org.xml.sax.SAXException
+    protected final void flushWriter() throws StreamException
     {
         final java.io.Writer writer = m_writer;
         if (null != writer)
@@ -236,7 +236,7 @@ abstract public class ToStream extends S
             }
             catch (IOException ioe)
             {
-                throw new org.xml.sax.SAXException(ioe);
+                throw new StreamException(ioe);
             }
         }
     }
@@ -266,9 +266,9 @@ abstract public class ToStream extends S
      *  
      *   @param name The element type name.
      *   @param model The content model as a normalized string.
-     *   @exception SAXException The application may raise an exception.
+     *   @exception StreamException The application may raise an exception.
      */
-    public void elementDecl(String name, String model) throws SAXException
+    public void elementDecl(String name, String model) throws StreamException
     {
         // Do not inline external DTD
         if (m_inExternalDTD)
@@ -287,7 +287,7 @@ abstract public class ToStream extends S
         }
         catch (IOException e)
         {
-            throw new SAXException(e);
+            throw new StreamException(e);
         }
 
     }
@@ -301,12 +301,12 @@ abstract public class ToStream extends S
      * @param name The name of the entity.  If it is a parameter
      *        entity, the name will begin with '%'.
      * @param value The replacement text of the entity.
-     * @exception SAXException The application may raise an exception.
+     * @exception StreamException The application may raise an exception.
      * @see #externalEntityDecl
      * @see org.xml.sax.DTDHandler#unparsedEntityDecl
      */
     public void internalEntityDecl(String name, String value)
-        throws SAXException
+        throws StreamException
     {
         // Do not inline external DTD
         if (m_inExternalDTD)
@@ -318,7 +318,7 @@ abstract public class ToStream extends S
         }
         catch (IOException e)
         {
-            throw new SAXException(e);
+            throw new StreamException(e);
         }
 
     }
@@ -329,7 +329,7 @@ abstract public class ToStream extends S
      * @param name non-null reference to document type name.
      * NEEDSDOC @param value
      *
-     * @throws org.xml.sax.SAXException
+     * @throws StreamException
      */
     void outputEntityDecl(String name, String value) throws IOException
     {
@@ -345,7 +345,7 @@ abstract public class ToStream extends S
     /**
      * Output a system-dependent line break.
      *
-     * @throws org.xml.sax.SAXException
+     * @throws StreamException
      */
     protected final void outputLineSep() throws IOException
     {
@@ -728,7 +728,7 @@ abstract public class ToStream extends S
      * 
      * @param depth the indentation depth (element nesting depth)
      *
-     * @throws org.xml.sax.SAXException if an error occurs during writing.
+     * @throws StreamException if an error occurs during writing.
      */
     protected void indent(int depth) throws IOException
     {
@@ -756,7 +756,7 @@ abstract public class ToStream extends S
      * Prints <var>n</var> spaces.
      * @param n         Number of spaces to print.
      *
-     * @throws org.xml.sax.SAXException if an error occurs when writing.
+     * @throws StreamException if an error occurs when writing.
      */
     private void printSpace(int n) throws IOException
     {
@@ -785,7 +785,7 @@ abstract public class ToStream extends S
      *        none of these applies.
      * @param value A string representing the attribute's default value,
      *        or null if there is none.
-     * @exception SAXException The application may raise an exception.
+     * @exception StreamException The application may raise an exception.
      */
     public void attributeDecl(
         String eName,
@@ -793,7 +793,7 @@ abstract public class ToStream extends S
         String type,
         String valueDefault,
         String value)
-        throws SAXException
+        throws StreamException
     {
         // Do not inline external DTD
         if (m_inExternalDTD)
@@ -823,7 +823,7 @@ abstract public class ToStream extends S
         }
         catch (IOException e)
         {
-            throw new SAXException(e);
+            throw new StreamException(e);
         }
     }
 
@@ -848,7 +848,7 @@ abstract public class ToStream extends S
      * @param publicId The declared public identifier of the entity, or
      *        null if none was declared.
      * @param systemId The declared system identifier of the entity.
-     * @exception SAXException The application may raise an exception.
+     * @exception StreamException The application may raise an exception.
      * @see #internalEntityDecl
      * @see org.xml.sax.DTDHandler#unparsedEntityDecl
      */
@@ -856,7 +856,7 @@ abstract public class ToStream extends S
         String name,
         String publicId,
         String systemId)
-        throws SAXException
+        throws StreamException
     {
         try {
             DTDprolog();
@@ -925,7 +925,7 @@ abstract public class ToStream extends S
      * was written out. 
      * 
      * @throws IOException
-     * @throws org.xml.sax.SAXException if invalid UTF-16 surrogate detected.
+     * @throws StreamException if invalid UTF-16 surrogate detected.
      */
     protected int writeUTF16Surrogate(char c, char ch[], int i, int end)
         throws IOException
@@ -1049,7 +1049,7 @@ abstract public class ToStream extends S
      * end-of-line separator should be output rather than a new-line character.
      *
      * @throws IOException
-     * @throws org.xml.sax.SAXException
+     * @throws StreamException
      */
     void writeNormalizedChars(
         char ch[],
@@ -1057,7 +1057,7 @@ abstract public class ToStream extends S
         int length,
         boolean isCData,
         boolean useSystemLineSeparator)
-        throws IOException, org.xml.sax.SAXException
+        throws IOException, StreamException
     {
         final java.io.Writer writer = m_writer;
         int end = start + length;
@@ -1151,9 +1151,9 @@ abstract public class ToStream extends S
      *
      * @see #startNonEscaping
      *
-     * @throws org.xml.sax.SAXException
+     * @throws StreamException
      */
-    public void endNonEscaping() throws org.xml.sax.SAXException
+    public void endNonEscaping() throws StreamException
     {
         m_disableOutputEscapingStates.pop();
     }
@@ -1166,9 +1166,9 @@ abstract public class ToStream extends S
      * <p> The contents of the un-escaping section will be delivered through the
      * regular <tt>characters</tt> event.
      *
-     * @throws org.xml.sax.SAXException
+     * @throws StreamException
      */
-    public void startNonEscaping() throws org.xml.sax.SAXException
+    public void startNonEscaping() throws StreamException
     {
         m_disableOutputEscapingStates.push(true);
     }
@@ -1193,15 +1193,15 @@ abstract public class ToStream extends S
      * @param ch The characters from the XML document.
      * @param start The start position in the array.
      * @param length The number of characters to read from the array.
-     * @throws org.xml.sax.SAXException Any SAX exception, possibly
+     * @throws StreamException Any SAX exception, possibly
      *            wrapping another exception.
      * @see #ignorableWhitespace
      * @see org.xml.sax.Locator
      *
-     * @throws org.xml.sax.SAXException
+     * @throws StreamException
      */
     protected void cdata(char ch[], int start, final int length)
-        throws org.xml.sax.SAXException
+        throws StreamException
     {
 
         try
@@ -1255,7 +1255,7 @@ abstract public class ToStream extends S
         }
         catch (IOException ioe)
         {
-            throw new org.xml.sax.SAXException(
+            throw new StreamException(
                 Utils.messages.createMessage(
                     MsgKey.ER_OIERROR,
                     null),
@@ -1282,10 +1282,10 @@ abstract public class ToStream extends S
      * @param start The start position in the array.
      * @param length The number of characters to read from the array.
      *
-     * @throws org.xml.sax.SAXException
+     * @throws StreamException
      */
     protected void charactersRaw(char ch[], int start, int length)
-        throws org.xml.sax.SAXException
+        throws StreamException
     {
 
         if (m_inEntityRef)
@@ -1304,7 +1304,7 @@ abstract public class ToStream extends S
         }
         catch (IOException e)
         {
-            throw new SAXException(e);
+            throw new StreamException(e);
         }
 
     }
@@ -1329,15 +1329,15 @@ abstract public class ToStream extends S
      * @param chars The characters from the XML document.
      * @param start The start position in the array.
      * @param length The number of characters to read from the array.
-     * @throws org.xml.sax.SAXException Any SAX exception, possibly
+     * @throws StreamException Any SAX exception, possibly
      *            wrapping another exception.
      * @see #ignorableWhitespace
      * @see org.xml.sax.Locator
      *
-     * @throws org.xml.sax.SAXException
+     * @throws StreamException
      */
     public void characters(final char chars[], final int start, final int length)
-        throws org.xml.sax.SAXException
+        throws StreamException
     {
         // It does not make sense to continue with rest of the method if the number of 
         // characters to read from array is 0.
@@ -1567,7 +1567,7 @@ abstract public class ToStream extends S
         }
         catch (IOException e)
         {
-            throw new SAXException(e);
+            throw new StreamException(e);
         }
     }
 
@@ -1682,9 +1682,9 @@ abstract public class ToStream extends S
      *
      * @param s The string of characters to process.
      *
-     * @throws org.xml.sax.SAXException
+     * @throws StreamException
      */
-    public void characters(String s) throws org.xml.sax.SAXException
+    public void characters(String s) throws StreamException
     {
         if (m_inEntityRef && !m_expandDTDEntities)
             return;
@@ -1712,7 +1712,7 @@ abstract public class ToStream extends S
      * @return i+1 if a character was written, i+2 if two characters
      * were written out, else return i.
      *
-     * @throws org.xml.sax.SAXException
+     * @throws StreamException
      */
     private int accumDefaultEscape(
         Writer writer,
@@ -1818,18 +1818,18 @@ abstract public class ToStream extends S
      *        performed.
      * @param name The element type name.
      * @param atts The attributes attached to the element, if any.
-     * @throws org.xml.sax.SAXException Any SAX exception, possibly
+     * @throws StreamException Any SAX exception, possibly
      *            wrapping another exception.
      * @see org.xml.sax.AttributeList
      *
-     * @throws org.xml.sax.SAXException
+     * @throws StreamException
      */
     public void startElement(
         String namespaceURI,
         String localName,
         String name,
         Attributes atts)
-        throws org.xml.sax.SAXException
+        throws StreamException
     {
         if (m_inEntityRef)
             return;
@@ -1878,7 +1878,7 @@ abstract public class ToStream extends S
         }
         catch (IOException e)
         {
-            throw new SAXException(e);
+            throw new StreamException(e);
         }
 
         // process the attributes now, because after this SAX call they might be gone
@@ -1902,22 +1902,22 @@ abstract public class ToStream extends S
       *        empty string if Namespace processing is not being
       *        performed.
       * @param elementName The element type name.
-      * @throws org.xml.sax.SAXException Any SAX exception, possibly
+      * @throws StreamException Any SAX exception, possibly
       *            wrapping another exception.
       * @see org.xml.sax.AttributeList
       *
-      * @throws org.xml.sax.SAXException
+      * @throws StreamException
       */
     public void startElement(
         String elementNamespaceURI,
         String elementLocalName,
         String elementName)
-        throws SAXException
+        throws StreamException
     {
         startElement(elementNamespaceURI, elementLocalName, elementName, null);
     }
 
-    public void startElement(String elementName) throws SAXException
+    public void startElement(String elementName) throws StreamException
     {
         startElement(null, null, elementName, null);
     }
@@ -1930,7 +1930,7 @@ abstract public class ToStream extends S
      *
      * @throws java.io.IOException
      */
-    void outputDocTypeDecl(String name, boolean closeDecl) throws SAXException
+    void outputDocTypeDecl(String name, boolean closeDecl) throws StreamException
     {
         if (m_cdataTagOpen)
             closeCDATA();
@@ -1970,7 +1970,7 @@ abstract public class ToStream extends S
         }
         catch (IOException e)
         {
-            throw new SAXException(e);
+            throw new StreamException(e);
         }
     }
 
@@ -1984,9 +1984,9 @@ abstract public class ToStream extends S
      * to be processed
      *
      * @throws java.io.IOException
-     * @throws org.xml.sax.SAXException
+     * @throws StreamException
      */
-    public void processAttributes(java.io.Writer writer, int nAttrs) throws IOException, SAXException
+    public void processAttributes(java.io.Writer writer, int nAttrs) throws IOException, StreamException
     {
             /* real SAX attributes are not passed in, so process the 
              * attributes that were collected after the startElement call.
@@ -2123,13 +2123,13 @@ abstract public class ToStream extends S
      *        empty string if Namespace processing is not being
      *        performed.
      * @param name The element type name
-     * @throws org.xml.sax.SAXException Any SAX exception, possibly
+     * @throws StreamException Any SAX exception, possibly
      *            wrapping another exception.
      *
-     * @throws org.xml.sax.SAXException
+     * @throws StreamException
      */
     public void endElement(String namespaceURI, String localName, String name)
-        throws org.xml.sax.SAXException
+        throws StreamException
     {
         if (m_inEntityRef)
             return;
@@ -2175,7 +2175,7 @@ abstract public class ToStream extends S
         }
         catch (IOException e)
         {
-            throw new SAXException(e);
+            throw new StreamException(e);
         }
 
         if (!m_elemContext.m_startTagOpen && m_doIndent)
@@ -2190,10 +2190,10 @@ abstract public class ToStream extends S
     /**
      * Receive notification of the end of an element.
      * @param name The element type name
-     * @throws org.xml.sax.SAXException Any SAX exception, possibly
+     * @throws StreamException Any SAX exception, possibly
      *     wrapping another exception.
      */
-    public void endElement(String name) throws org.xml.sax.SAXException
+    public void endElement(String name) throws StreamException
     {
         endElement(null, null, name);
     }
@@ -2207,12 +2207,12 @@ abstract public class ToStream extends S
      * @param prefix The Namespace prefix being declared.
      * @param uri The Namespace URI the prefix is mapped to.
      * 
-     * @throws org.xml.sax.SAXException The client may throw
+     * @throws StreamException The client may throw
      *            an exception during processing.
      * 
      */
     public void startPrefixMapping(String prefix, String uri)
-        throws org.xml.sax.SAXException
+        throws StreamException
     {
         // the "true" causes the flush of any open tags
         startPrefixMapping(prefix, uri, true);
@@ -2234,7 +2234,7 @@ abstract public class ToStream extends S
      * namespace information, false if it did not change anything, e.g. if the
      * prefix/namespace mapping was already in scope from before.
      * 
-     * @throws org.xml.sax.SAXException The client may throw
+     * @throws StreamException The client may throw
      *            an exception during processing.
      *
      *
@@ -2243,7 +2243,7 @@ abstract public class ToStream extends S
         String prefix,
         String uri,
         boolean shouldFlush)
-        throws org.xml.sax.SAXException
+        throws StreamException
     {
 
         /* Remember the mapping, and at what depth it was declared
@@ -2305,10 +2305,10 @@ abstract public class ToStream extends S
      * @param ch An array holding the characters in the comment.
      * @param start The starting position in the array.
      * @param length The number of characters to use from the array.
-     * @throws org.xml.sax.SAXException The application may raise an exception.
+     * @throws StreamException The application may raise an exception.
      */
     public void comment(char ch[], int start, int length)
-        throws org.xml.sax.SAXException
+        throws StreamException
     {
 
         int start_old = start;
@@ -2364,7 +2364,7 @@ abstract public class ToStream extends S
         }
         catch (IOException e)
         {
-            throw new SAXException(e);
+            throw new StreamException(e);
         }
 
         /*
@@ -2381,11 +2381,11 @@ abstract public class ToStream extends S
 
     /**
      * Report the end of a CDATA section.
-     * @throws org.xml.sax.SAXException The application may raise an exception.
+     * @throws StreamException The application may raise an exception.
      *
      *  @see  #startCDATA
      */
-    public void endCDATA() throws org.xml.sax.SAXException
+    public void endCDATA() throws StreamException
     {
         if (m_cdataTagOpen)
             closeCDATA();
@@ -2394,10 +2394,10 @@ abstract public class ToStream extends S
 
     /**
      * Report the end of DTD declarations.
-     * @throws org.xml.sax.SAXException The application may raise an exception.
+     * @throws StreamException The application may raise an exception.
      * @see #startDTD
      */
-    public void endDTD() throws org.xml.sax.SAXException
+    public void endDTD() throws StreamException
     {
         try
         {
@@ -2418,7 +2418,7 @@ abstract public class ToStream extends S
         }
         catch (IOException e)
         {
-            throw new SAXException(e);
+            throw new StreamException(e);
         }
 
     }
@@ -2427,10 +2427,10 @@ abstract public class ToStream extends S
      * End the scope of a prefix-URI Namespace mapping.
      * 
      * @param prefix The prefix that was being mapping.
-     * @throws org.xml.sax.SAXException The client may throw
+     * @throws StreamException The client may throw
      *            an exception during processing.
      */
-    public void endPrefixMapping(String prefix) throws org.xml.sax.SAXException
+    public void endPrefixMapping(String prefix) throws StreamException
     { // do nothing
     }
 
@@ -2442,14 +2442,14 @@ abstract public class ToStream extends S
      * @param ch The characters from the XML document.
      * @param start The start position in the array.
      * @param length The number of characters to read from the array.
-     * @throws org.xml.sax.SAXException Any SAX exception, possibly
+     * @throws StreamException Any SAX exception, possibly
      *            wrapping another exception.
      * @see #characters
      * 
-     * @throws org.xml.sax.SAXException
+     * @throws StreamException
      */
     public void ignorableWhitespace(char ch[], int start, int length)
-        throws org.xml.sax.SAXException
+        throws StreamException
     {
 
         if (0 == length)
@@ -2464,20 +2464,20 @@ abstract public class ToStream extends S
      *       parameter                   entity, the name will begin with '%',
      * and if it is the external DTD subset, it will be the string
      * "[dtd]".
-     * @throws org.xml.sax.SAXException Any SAX exception, possibly wrapping
+     * @throws StreamException Any SAX exception, possibly wrapping
      * another exception.
      */
-    public void skippedEntity(String name) throws org.xml.sax.SAXException
+    public void skippedEntity(String name) throws StreamException
     { // TODO: Should handle
     }
 
     /**
      * Report the start of a CDATA section.
      * 
-     * @throws org.xml.sax.SAXException The application may raise an exception.
+     * @throws StreamException The application may raise an exception.
      * @see #endCDATA
      */
-    public void startCDATA() throws org.xml.sax.SAXException
+    public void startCDATA() throws StreamException
     {
         m_cdataStartCalled = true;
     }
@@ -2492,12 +2492,12 @@ abstract public class ToStream extends S
      * 
      * @param name The name of the entity.  If it is a parameter
      *        entity, the name will begin with '%'.
-     * @throws org.xml.sax.SAXException The application may raise an exception.
+     * @throws StreamException The application may raise an exception.
      * @see #endEntity
      * @see org.xml.sax.ext.DeclHandler#internalEntityDecl
      * @see org.xml.sax.ext.DeclHandler#externalEntityDecl
      */
-    public void startEntity(String name) throws org.xml.sax.SAXException
+    public void startEntity(String name) throws StreamException
     {
         if (name.equals("[dtd]"))
             m_inExternalDTD = true;
@@ -2519,9 +2519,9 @@ abstract public class ToStream extends S
      * For the enclosing elements starting tag write out
      * out any attributes followed by ">"
      *
-     * @throws org.xml.sax.SAXException
+     * @throws StreamException
      */
-    protected void closeStartTag() throws SAXException
+    protected void closeStartTag() throws StreamException
     {
 
         if (m_elemContext.m_startTagOpen)
@@ -2540,7 +2540,7 @@ abstract public class ToStream extends S
             }
             catch (IOException e)
             {
-                throw new SAXException(e);
+                throw new StreamException(e);
             }
 
             if (m_doIndent)
@@ -2563,13 +2563,13 @@ abstract public class ToStream extends S
      *        external DTD subset, or null if none was declared.
      * @param systemId The declared system identifier for the
      *        external DTD subset, or null if none was declared.
-     * @throws org.xml.sax.SAXException The application may raise an
+     * @throws StreamException The application may raise an
      *            exception.
      * @see #endDTD
      * @see #startEntity
      */
     public void startDTD(String name, String publicId, String systemId)
-        throws org.xml.sax.SAXException
+        throws StreamException
     {
         setDoctypeSystem(systemId);
         setDoctypePublic(publicId);
@@ -2615,13 +2615,13 @@ abstract public class ToStream extends S
      * @param rawName the qualified name 
      * @return returns null if no action is taken, otherwise it returns the
      * prefix used in declaring the namespace. 
-     * @throws SAXException
+     * @throws StreamException
      */
     protected String ensureAttributesNamespaceIsDeclared(
         String ns,
         String localName,
         String rawName)
-        throws org.xml.sax.SAXException
+        throws StreamException
     {
 
         if (ns != null && ns.length() > 0)
@@ -2685,7 +2685,7 @@ abstract public class ToStream extends S
     }
 
     void ensurePrefixIsDeclared(String ns, String rawName)
-        throws org.xml.sax.SAXException
+        throws StreamException
     {
 
         if (ns != null && ns.length() > 0)
@@ -2722,7 +2722,7 @@ abstract public class ToStream extends S
      * This method flushes any pending events, which can be startDocument()
      * closing the opening tag of an element, or closing an open CDATA section.
      */
-    public void flushPending() throws SAXException
+    public void flushPending() throws StreamException
     {
             if (m_needToCallStartDocument)
             {
@@ -2867,7 +2867,7 @@ abstract public class ToStream extends S
                             localName,
                             rawName);
                 }
-                catch (SAXException e)
+                catch (StreamException e)
                 {
                     // TODO Auto-generated catch block
                     e.printStackTrace();
@@ -3173,7 +3173,7 @@ abstract public class ToStream extends S
      * handles document entities. 
      * @see org.xml.sax.DTDHandler#notationDecl(java.lang.String, java.lang.String, java.lang.String)
      */
-    public void notationDecl(String name, String pubID, String sysID) throws SAXException {
+    public void notationDecl(String name, String pubID, String sysID) throws StreamException {
         // TODO Auto-generated method stub
         try {
             DTDprolog();
@@ -3203,7 +3203,7 @@ abstract public class ToStream extends S
      * handles document entities. 
      * @see org.xml.sax.DTDHandler#unparsedEntityDecl(java.lang.String, java.lang.String, java.lang.String, java.lang.String)
      */
-    public void unparsedEntityDecl(String name, String pubID, String sysID, String notationName) throws SAXException {
+    public void unparsedEntityDecl(String name, String pubID, String sysID, String notationName) throws StreamException {
         // TODO Auto-generated method stub
         try {
             DTDprolog();       
@@ -3231,10 +3231,10 @@ abstract public class ToStream extends S
     
     /**
      * A private helper method to output the 
-     * @throws SAXException
+     * @throws StreamException
      * @throws IOException
      */
-    private void DTDprolog() throws SAXException, IOException {
+    private void DTDprolog() throws StreamException, IOException {
         final java.io.Writer writer = m_writer;
         if (m_needToOutputDocTypeDecl)
         {

Modified: webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/stream/serializer/ToXMLStream.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/stream/serializer/ToXMLStream.java?rev=1742687&r1=1742686&r2=1742687&view=diff
==============================================================================
--- webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/stream/serializer/ToXMLStream.java (original)
+++ webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/stream/serializer/ToXMLStream.java Sat May  7 06:56:10 2016
@@ -27,9 +27,9 @@ import javax.xml.transform.Result;
 import javax.xml.transform.Transformer;
 import javax.xml.transform.TransformerException;
 
+import org.apache.axiom.core.stream.StreamException;
 import org.apache.axiom.core.stream.serializer.utils.MsgKey;
 import org.apache.axiom.core.stream.serializer.utils.Utils;
-import org.xml.sax.SAXException;
 
 /**
  * This class converts SAX or SAX-like calls to a 
@@ -100,12 +100,12 @@ public class ToXMLStream extends ToStrea
     /**
      * Receive notification of the beginning of a document.
      *
-     * @throws org.xml.sax.SAXException Any SAX exception, possibly
+     * @throws StreamException Any SAX exception, possibly
      *            wrapping another exception.
      *
-     * @throws org.xml.sax.SAXException
+     * @throws StreamException
      */
-    public void startDocumentInternal() throws org.xml.sax.SAXException
+    public void startDocumentInternal() throws StreamException
     {
 
         if (m_needToCallStartDocument)
@@ -166,7 +166,7 @@ public class ToXMLStream extends ToStrea
                 } 
                 catch(IOException e)
                 {
-                    throw new SAXException(e);
+                    throw new StreamException(e);
                 }
 
             }
@@ -176,12 +176,12 @@ public class ToXMLStream extends ToStrea
     /**
      * Receive notification of the end of a document.
      *
-     * @throws org.xml.sax.SAXException Any SAX exception, possibly
+     * @throws StreamException Any SAX exception, possibly
      *            wrapping another exception.
      *
-     * @throws org.xml.sax.SAXException
+     * @throws StreamException
      */
-    public void endDocument() throws org.xml.sax.SAXException
+    public void endDocument() throws StreamException
     {
         flushPending();
         if (m_doIndent && !m_isprevtext)
@@ -192,7 +192,7 @@ public class ToXMLStream extends ToStrea
             }
             catch(IOException e)
             {
-                throw new SAXException(e);
+                throw new StreamException(e);
             }
         }
 
@@ -209,9 +209,9 @@ public class ToXMLStream extends ToStrea
      * The contents of the whitespace preserving section will be delivered
      * through the regular <tt>characters</tt> event.
      *
-     * @throws org.xml.sax.SAXException
+     * @throws StreamException
      */
-    public void startPreserving() throws org.xml.sax.SAXException
+    public void startPreserving() throws StreamException
     {
 
         // Not sure this is really what we want.  -sb
@@ -225,9 +225,9 @@ public class ToXMLStream extends ToStrea
      *
      * @see #startPreserving
      *
-     * @throws org.xml.sax.SAXException
+     * @throws StreamException
      */
-    public void endPreserving() throws org.xml.sax.SAXException
+    public void endPreserving() throws StreamException
     {
 
         // Not sure this is really what we want.  -sb
@@ -240,13 +240,13 @@ public class ToXMLStream extends ToStrea
      * @param target The processing instruction target.
      * @param data The processing instruction data, or null if
      *        none was supplied.
-     * @throws org.xml.sax.SAXException Any SAX exception, possibly
+     * @throws StreamException Any SAX exception, possibly
      *            wrapping another exception.
      *
-     * @throws org.xml.sax.SAXException
+     * @throws StreamException
      */
     public void processingInstruction(String target, String data)
-        throws org.xml.sax.SAXException
+        throws StreamException
     {
         if (m_inEntityRef)
             return;
@@ -323,7 +323,7 @@ public class ToXMLStream extends ToStrea
             }
             catch(IOException e)
             {
-                throw new SAXException(e);
+                throw new StreamException(e);
             }
         }
     }
@@ -333,9 +333,9 @@ public class ToXMLStream extends ToStrea
      *
      * @param name The name of the entity.
      *
-     * @throws org.xml.sax.SAXException
+     * @throws StreamException
      */
-    public void entityReference(String name) throws org.xml.sax.SAXException
+    public void entityReference(String name) throws StreamException
     {
         if (m_elemContext.m_startTagOpen)
         {
@@ -355,7 +355,7 @@ public class ToXMLStream extends ToStrea
         }
         catch(IOException e)
         {
-            throw new SAXException(e);
+            throw new StreamException(e);
         }
     }
 
@@ -370,7 +370,7 @@ public class ToXMLStream extends ToStrea
      * @param flags the bit values of this integer give optimization information.
      */
     public void addUniqueAttribute(String name, String value, int flags)
-        throws SAXException
+        throws StreamException
     {
         if (m_elemContext.m_startTagOpen)
         {
@@ -402,7 +402,7 @@ public class ToXMLStream extends ToStrea
                     writer.write('"');
                 }
             } catch (IOException e) {
-                throw new SAXException(e);
+                throw new StreamException(e);
             }
         }
     }
@@ -416,7 +416,7 @@ public class ToXMLStream extends ToStrea
      * @param value the value of the attribute
      * @param xslAttribute true if this attribute is from an xsl:attribute,
      * false if declared within the elements opening tag.
-     * @throws SAXException
+     * @throws StreamException
      */
     public void addAttribute(
         String uri,
@@ -425,7 +425,7 @@ public class ToXMLStream extends ToStrea
         String type,
         String value,
         boolean xslAttribute)
-        throws SAXException
+        throws StreamException
     {
         if (m_elemContext.m_startTagOpen)
         {
@@ -492,10 +492,10 @@ public class ToXMLStream extends ToStrea
             catch (TransformerException e){
                 // A user defined error handler, errHandler, may throw
                 // a TransformerException if it chooses to, and if it does
-                // we will wrap it with a SAXException and re-throw.
+                // we will wrap it with a StreamException and re-throw.
                 // Of course if the handler throws another type of
                 // exception, like a RuntimeException, then that is OK too.
-                SAXException se = new SAXException(e);
+                StreamException se = new StreamException(e);
                 throw se;                
             }             
         }
@@ -504,7 +504,7 @@ public class ToXMLStream extends ToStrea
     /**
      * @see ExtendedContentHandler#endElement(String)
      */
-    public void endElement(String elemName) throws SAXException
+    public void endElement(String elemName) throws StreamException
     {
         endElement(null, null, elemName);
     }
@@ -519,7 +519,7 @@ public class ToXMLStream extends ToStrea
     public void namespaceAfterStartElement(
         final String prefix,
         final String uri)
-        throws SAXException
+        throws StreamException
     {
 
         // hack for XSLTC with finding URI for default namespace
@@ -556,7 +556,7 @@ public class ToXMLStream extends ToStrea
                 return true;
             }
         }
-        catch (SAXException e)
+        catch (StreamException e)
         {
             // falls through
         }