ws-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From veit...@apache.org
Subject svn commit: r1733725 - in /webservices/axiom/branches/stax-stream/aspects: core-aspects/src/main/java/org/apache/axiom/core/impl/ om-aspects/src/main/java/org/apache/axiom/om/impl/common/builder/ om-aspects/src/main/java/org/apache/axiom/om/impl/mixin/
Date Sat, 05 Mar 2016 15:31:56 GMT
Author: veithen
Date: Sat Mar  5 15:31:56 2016
New Revision: 1733725

URL: http://svn.apache.org/viewvc?rev=1733725&view=rev
Log:
Make more test cases pass.

Modified:
    webservices/axiom/branches/stax-stream/aspects/core-aspects/src/main/java/org/apache/axiom/core/impl/TreeWalkerImpl.java
    webservices/axiom/branches/stax-stream/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/builder/BuilderHandler.java
    webservices/axiom/branches/stax-stream/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/builder/Context.java
    webservices/axiom/branches/stax-stream/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/builder/StAXHelper.java
    webservices/axiom/branches/stax-stream/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/mixin/AxiomSourcedElementSupport.aj

Modified: webservices/axiom/branches/stax-stream/aspects/core-aspects/src/main/java/org/apache/axiom/core/impl/TreeWalkerImpl.java
URL: http://svn.apache.org/viewvc/webservices/axiom/branches/stax-stream/aspects/core-aspects/src/main/java/org/apache/axiom/core/impl/TreeWalkerImpl.java?rev=1733725&r1=1733724&r2=1733725&view=diff
==============================================================================
--- webservices/axiom/branches/stax-stream/aspects/core-aspects/src/main/java/org/apache/axiom/core/impl/TreeWalkerImpl.java
(original)
+++ webservices/axiom/branches/stax-stream/aspects/core-aspects/src/main/java/org/apache/axiom/core/impl/TreeWalkerImpl.java
Sat Mar  5 15:31:56 2016
@@ -283,5 +283,8 @@ public final class TreeWalkerImpl implem
                 parent = ((CoreChildNode)parent).coreGetParent();
             }
         }
+        if (reader != null) {
+            reader.dispose();
+        }
     }
 }

Modified: webservices/axiom/branches/stax-stream/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/builder/BuilderHandler.java
URL: http://svn.apache.org/viewvc/webservices/axiom/branches/stax-stream/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/builder/BuilderHandler.java?rev=1733725&r1=1733724&r2=1733725&view=diff
==============================================================================
--- webservices/axiom/branches/stax-stream/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/builder/BuilderHandler.java
(original)
+++ webservices/axiom/branches/stax-stream/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/builder/BuilderHandler.java
Sat Mar  5 15:31:56 2016
@@ -39,6 +39,7 @@ public final class BuilderHandler implem
     final Builder builder;
     final OMNamespaceCache nsCache = new OMNamespaceCache();
     public Context context;
+    private int activeContextCount;
     // returns the state of completion
     public boolean done;
     // keeps the state of the cache
@@ -61,6 +62,7 @@ public final class BuilderHandler implem
         this.root = root;
         this.builder = builder;
         context = new Context(this, null, 0);
+        activeContextCount = 1;
     }
 
     public void addListener(BuilderListener listener) {
@@ -93,6 +95,16 @@ public final class BuilderHandler implem
         }
     }
     
+    void incrementActiveContextCount() {
+        activeContextCount++;
+    }
+    
+    void decrementActiveContextCount() {
+        if (--activeContextCount == 0) {
+            builder.close();
+        }
+    }
+    
     public boolean isCompleted() {
         return done;
     }

Modified: webservices/axiom/branches/stax-stream/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/builder/Context.java
URL: http://svn.apache.org/viewvc/webservices/axiom/branches/stax-stream/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/builder/Context.java?rev=1733725&r1=1733724&r2=1733725&view=diff
==============================================================================
--- webservices/axiom/branches/stax-stream/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/builder/Context.java
(original)
+++ webservices/axiom/branches/stax-stream/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/builder/Context.java
Sat Mar  5 15:31:56 2016
@@ -80,12 +80,16 @@ public final class Context implements In
         }
         target.coreSetState(CoreParentNode.DISCARDED);
         this.passThroughHandler = passThroughHandler;
+        if (passThroughHandler == NullXmlHandler.INSTANCE) {
+            builderHandler.decrementActiveContextCount();
+        }
     }
     
     @Override
     public void discard() {
         target.coreSetState(CoreParentNode.DISCARDED);
         passThroughHandler = NullXmlHandler.INSTANCE;
+        builderHandler.decrementActiveContextCount();
     }
 
     private Context newContext(CoreParentNode target) {
@@ -94,6 +98,7 @@ public final class Context implements In
         }
         nestedContext.target = target;
         target.coreSetInputContext(nestedContext);
+        builderHandler.incrementActiveContextCount();
         return nestedContext;
     }
     
@@ -105,11 +110,15 @@ public final class Context implements In
             pendingCharacterData = null;
         }
         target = null;
+        builderHandler.decrementActiveContextCount();
         return parentContext;
     }
     
     private Context decrementPassThroughDepth() {
         if (passThroughDepth == 0) {
+            if (passThroughHandler != NullXmlHandler.INSTANCE) {
+                builderHandler.decrementActiveContextCount();
+            }
             target.coreSetInputContext(null);
             target.coreSetState(CoreParentNode.DISCARDED);
             passThroughHandler = null;

Modified: webservices/axiom/branches/stax-stream/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/builder/StAXHelper.java
URL: http://svn.apache.org/viewvc/webservices/axiom/branches/stax-stream/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/builder/StAXHelper.java?rev=1733725&r1=1733724&r2=1733725&view=diff
==============================================================================
--- webservices/axiom/branches/stax-stream/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/builder/StAXHelper.java
(original)
+++ webservices/axiom/branches/stax-stream/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/builder/StAXHelper.java
Sat Mar  5 15:31:56 2016
@@ -395,7 +395,6 @@ public class StAXHelper implements XmlRe
 
     @Override
     public void dispose() {
-        // TODO
-        throw new UnsupportedOperationException();
+        close();
     }
 }

Modified: webservices/axiom/branches/stax-stream/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/mixin/AxiomSourcedElementSupport.aj
URL: http://svn.apache.org/viewvc/webservices/axiom/branches/stax-stream/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/mixin/AxiomSourcedElementSupport.aj?rev=1733725&r1=1733724&r2=1733725&view=diff
==============================================================================
--- webservices/axiom/branches/stax-stream/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/mixin/AxiomSourcedElementSupport.aj
(original)
+++ webservices/axiom/branches/stax-stream/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/mixin/AxiomSourcedElementSupport.aj
Sat Mar  5 15:31:56 2016
@@ -407,9 +407,7 @@ public aspect AxiomSourcedElementSupport
         if (isExpanded() || (cache && OMDataSourceUtil.isDestructiveWrite(dataSource)))
{
             return null;
         }
-        // Note: if we can't determine the type (push/pull) of the OMDataSource, we
-        // default to push
-        if (OMDataSourceUtil.isPullDataSource(dataSource)) {
+        if (OMDataSourceUtil.isPullDataSource(dataSource) || (incremental && !OMDataSourceUtil.isPushDataSource(dataSource)))
{
             try {
                 return new StAXPullInput(dataSource.getReader());
             } catch (XMLStreamException ex) {



Mime
View raw message