ws-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From veit...@apache.org
Subject svn commit: r1484086 - /webservices/axiom/trunk/modules/axiom-common-impl/src/main/java/org/apache/axiom/om/impl/common/serializer/pull/SwitchingWrapper.java
Date Sat, 18 May 2013 10:27:50 GMT
Author: veithen
Date: Sat May 18 10:27:50 2013
New Revision: 1484086

URL: http://svn.apache.org/r1484086
Log:
Improved control flow and avoid unnecessary method calls.

Modified:
    webservices/axiom/trunk/modules/axiom-common-impl/src/main/java/org/apache/axiom/om/impl/common/serializer/pull/SwitchingWrapper.java

Modified: webservices/axiom/trunk/modules/axiom-common-impl/src/main/java/org/apache/axiom/om/impl/common/serializer/pull/SwitchingWrapper.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/modules/axiom-common-impl/src/main/java/org/apache/axiom/om/impl/common/serializer/pull/SwitchingWrapper.java?rev=1484086&r1=1484085&r2=1484086&view=diff
==============================================================================
--- webservices/axiom/trunk/modules/axiom-common-impl/src/main/java/org/apache/axiom/om/impl/common/serializer/pull/SwitchingWrapper.java
(original)
+++ webservices/axiom/trunk/modules/axiom-common-impl/src/main/java/org/apache/axiom/om/impl/common/serializer/pull/SwitchingWrapper.java
Sat May 18 10:27:50 2013
@@ -738,37 +738,38 @@ final class SwitchingWrapper extends Pul
                     }
                 } else {
                     OMNode current = (OMNode)node;
-                    OMContainer parent = current.getParent();
                     OMNode nextSibling = getNextSibling(current);
                     if (nextSibling != null) {
                         nextNode = nextSibling;
                         visited = false;
-                    } else if (parent.isComplete() || parent.getBuilder() == null) { // TODO:
review this condition
-                        nextNode = parent;
-                        visited = true;
                     } else {
-                        nextNode = null;
-                    }
-                }
-                if (nextNode instanceof OMSourcedElement) {
-                    OMSourcedElement element = (OMSourcedElement)nextNode;
-                    if (!element.isExpanded()) {
-                        OMDataSource ds = element.getDataSource();
-                        if (ds != null && !(OMDataSourceUtil.isPushDataSource(ds)
-                                || (cache && OMDataSourceUtil.isDestructiveRead(ds))))
{
-                            XMLStreamReader reader = ds.getReader();
-                            while (reader.next() != START_ELEMENT) {
-                                // Just loop
-                            }
-                            serializer.switchState(new IncludeWrapper(serializer, this, reader));
-                            node = nextNode;
+                        OMContainer parent = current.getParent();
+                        if (parent.isComplete() || parent.getBuilder() == null) { // TODO:
review this condition
+                            nextNode = parent;
                             visited = true;
-                            return START_ELEMENT;
+                        } else {
+                            nextNode = null;
                         }
                     }
                 }
                 if (nextNode != null) {
                     node = nextNode;
+                    if (node instanceof OMSourcedElement) {
+                        OMSourcedElement element = (OMSourcedElement)node;
+                        if (!element.isExpanded()) {
+                            OMDataSource ds = element.getDataSource();
+                            if (ds != null && !(OMDataSourceUtil.isPushDataSource(ds)
+                                    || (cache && OMDataSourceUtil.isDestructiveRead(ds))))
{
+                                XMLStreamReader reader = ds.getReader();
+                                while (reader.next() != START_ELEMENT) {
+                                    // Just loop
+                                }
+                                serializer.switchState(new IncludeWrapper(serializer, this,
reader));
+                                visited = true;
+                                return START_ELEMENT;
+                            }
+                        }
+                    }
                     if (node instanceof OMContainer) {
                         OMContainer container = (OMContainer)node;
                         if (visited) {



Mime
View raw message