ws-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From veit...@apache.org
Subject svn commit: r1728851 - in /webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common: builder/AbstractBuilder.java builder/PushOMBuilder.java builder/StAXOMBuilder.java factory/SAXOMBuilder.java
Date Sat, 06 Feb 2016 15:31:31 GMT
Author: veithen
Date: Sat Feb  6 15:31:30 2016
New Revision: 1728851

URL: http://svn.apache.org/viewvc?rev=1728851&view=rev
Log:
Unify the OMXMLParserWrapper#getDocument() implementation.

Modified:
    webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/builder/AbstractBuilder.java
    webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/builder/PushOMBuilder.java
    webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/builder/StAXOMBuilder.java
    webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/factory/SAXOMBuilder.java

Modified: webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/builder/AbstractBuilder.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/builder/AbstractBuilder.java?rev=1728851&r1=1728850&r2=1728851&view=diff
==============================================================================
--- webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/builder/AbstractBuilder.java
(original)
+++ webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/builder/AbstractBuilder.java
Sat Feb  6 15:31:30 2016
@@ -19,7 +19,9 @@
 package org.apache.axiom.om.impl.common.builder;
 
 import org.apache.axiom.core.NodeFactory;
+import org.apache.axiom.om.OMDocument;
 import org.apache.axiom.om.OMXMLParserWrapper;
+import org.apache.axiom.om.impl.intf.AxiomDocument;
 import org.apache.axiom.om.impl.intf.AxiomSourcedElement;
 
 public abstract class AbstractBuilder implements OMXMLParserWrapper {
@@ -32,4 +34,12 @@ public abstract class AbstractBuilder im
     public final void addNodePostProcessor(NodePostProcessor nodePostProcessor) {
         handler.addNodePostProcessor(nodePostProcessor);
     }
+
+    public final OMDocument getDocument() {
+        AxiomDocument document;
+        while ((document = handler.getDocument()) == null) {
+            next();
+        }
+        return document;
+    }
 }

Modified: webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/builder/PushOMBuilder.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/builder/PushOMBuilder.java?rev=1728851&r1=1728850&r2=1728851&view=diff
==============================================================================
--- webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/builder/PushOMBuilder.java
(original)
+++ webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/builder/PushOMBuilder.java
Sat Feb  6 15:31:30 2016
@@ -22,7 +22,6 @@ import javax.xml.stream.XMLStreamExcepti
 
 import org.apache.axiom.om.DeferredParsingException;
 import org.apache.axiom.om.OMDataSource;
-import org.apache.axiom.om.OMDocument;
 import org.apache.axiom.om.impl.intf.AxiomSourcedElement;
 
 public final class PushOMBuilder extends AbstractPushBuilder {
@@ -43,9 +42,4 @@ public final class PushOMBuilder extends
         }
         return -1;
     }
-
-    @Override
-    public OMDocument getDocument() {
-        throw new UnsupportedOperationException();
-    }
 }

Modified: webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/builder/StAXOMBuilder.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/builder/StAXOMBuilder.java?rev=1728851&r1=1728850&r2=1728851&view=diff
==============================================================================
--- webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/builder/StAXOMBuilder.java
(original)
+++ webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/builder/StAXOMBuilder.java
Sat Feb  6 15:31:30 2016
@@ -26,7 +26,6 @@ import org.apache.axiom.ext.stax.datahan
 import org.apache.axiom.om.DeferredParsingException;
 import org.apache.axiom.om.OMAttribute;
 import org.apache.axiom.om.OMContainer;
-import org.apache.axiom.om.OMDocument;
 import org.apache.axiom.om.OMElement;
 import org.apache.axiom.om.OMException;
 import org.apache.axiom.om.OMFactory;
@@ -37,7 +36,6 @@ import org.apache.axiom.om.impl.builder.
 import org.apache.axiom.om.impl.builder.CustomBuilderSupport;
 import org.apache.axiom.om.impl.builder.Detachable;
 import org.apache.axiom.om.impl.intf.AxiomContainer;
-import org.apache.axiom.om.impl.intf.AxiomDocument;
 import org.apache.axiom.om.impl.intf.AxiomElement;
 import org.apache.axiom.om.impl.intf.AxiomSourcedElement;
 import org.apache.axiom.om.impl.intf.TextContent;
@@ -468,14 +466,6 @@ public class StAXOMBuilder extends Abstr
         return old;
     }
     
-    public final OMDocument getDocument() {
-        AxiomDocument document;
-        while ((document = handler.getDocument()) == null) {
-            next();
-        }
-        return document;
-    }
-
     public final String getCharsetEncoding() {
         return handler.document.getCharsetEncoding();
     }

Modified: webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/factory/SAXOMBuilder.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/factory/SAXOMBuilder.java?rev=1728851&r1=1728850&r2=1728851&view=diff
==============================================================================
--- webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/factory/SAXOMBuilder.java
(original)
+++ webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/factory/SAXOMBuilder.java
Sat Feb  6 15:31:30 2016
@@ -20,7 +20,6 @@
 package org.apache.axiom.om.impl.common.factory;
 
 import org.apache.axiom.core.NodeFactory;
-import org.apache.axiom.om.OMDocument;
 import org.apache.axiom.om.OMElement;
 import org.apache.axiom.om.OMException;
 import org.apache.axiom.om.impl.common.Handler;
@@ -60,35 +59,29 @@ public final class SAXOMBuilder extends
         ((AxiomContainer)handler.document).setComplete(true);
     }
 
-    public OMDocument getDocument() {
-        if (handler.document == null && source != null) {
-            XMLReader reader = source.getXMLReader();
-            OMContentHandler contentHandler = new OMContentHandler(this, expandEntityReferences);
-            reader.setContentHandler(contentHandler);
-            reader.setDTDHandler(contentHandler);
-            try {
-                reader.setProperty("http://xml.org/sax/properties/lexical-handler", contentHandler);
-            } catch (SAXException ex) {
-                // Ignore
-            }
-            try {
-                reader.setProperty("http://xml.org/sax/properties/declaration-handler", contentHandler);
-            } catch (SAXException ex) {
-                // Ignore
-            }
-            try {
-                reader.parse(source.getInputSource());
-            } catch (IOException ex) {
-                throw new OMException(ex);
-            } catch (SAXException ex) {
-                throw new OMException(ex);
-            }
-        }
-        if (handler.document != null && handler.document.isComplete()) {
-            return handler.document;
-        } else {
-            throw new OMException("Tree not complete");
+    public int next() {
+        XMLReader reader = source.getXMLReader();
+        OMContentHandler contentHandler = new OMContentHandler(this, expandEntityReferences);
+        reader.setContentHandler(contentHandler);
+        reader.setDTDHandler(contentHandler);
+        try {
+            reader.setProperty("http://xml.org/sax/properties/lexical-handler", contentHandler);
+        } catch (SAXException ex) {
+            // Ignore
         }
+        try {
+            reader.setProperty("http://xml.org/sax/properties/declaration-handler", contentHandler);
+        } catch (SAXException ex) {
+            // Ignore
+        }
+        try {
+            reader.parse(source.getInputSource());
+        } catch (IOException ex) {
+            throw new OMException(ex);
+        } catch (SAXException ex) {
+            throw new OMException(ex);
+        }
+        return -1;
     }
 
     public void createOMDocType(String rootName, String publicId,
@@ -139,8 +132,4 @@ public final class SAXOMBuilder extends
     public void createOMEntityReference(String name, String replacementText) {
         handler.createEntityReference(name, replacementText);
     }
-
-    public int next() throws OMException {
-        throw new UnsupportedOperationException();
-    }
 }



Mime
View raw message