Found a memory leak that was left over from new method for reading large files.


Project: http://git-wip-us.apache.org/repos/asf/vxquery/repo
Commit: http://git-wip-us.apache.org/repos/asf/vxquery/commit/304c61ee
Tree: http://git-wip-us.apache.org/repos/asf/vxquery/tree/304c61ee
Diff: http://git-wip-us.apache.org/repos/asf/vxquery/diff/304c61ee

Branch: refs/heads/site
Commit: 304c61eedd33506699d3071834db72c289595e2b
Parents: 811d723
Author: Preston Carman <[email protected]>
Authored: Thu May 29 16:57:07 2014 -0700
Committer: Preston Carman <[email protected]>
Committed: Thu May 29 16:57:07 2014 -0700

----------------------------------------------------------------------
 .../org/apache/vxquery/xmlparser/SAXContentHandler.java | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/vxquery/blob/304c61ee/vxquery-core/src/main/java/org/apache/vxquery/xmlparser/SAXContentHandler.java
----------------------------------------------------------------------
diff --git 
a/vxquery-core/src/main/java/org/apache/vxquery/xmlparser/SAXContentHandler.java
 
b/vxquery-core/src/main/java/org/apache/vxquery/xmlparser/SAXContentHandler.java
index bd1a354..53e0cda 100644
--- 
a/vxquery-core/src/main/java/org/apache/vxquery/xmlparser/SAXContentHandler.java
+++ 
b/vxquery-core/src/main/java/org/apache/vxquery/xmlparser/SAXContentHandler.java
@@ -181,7 +181,7 @@ public class SAXContentHandler implements ContentHandler, 
LexicalHandler {
                 flushText();
                 ElementNodeBuilder enb = enbStack.remove(enbStack.size() - 1);
                 enb.endChildrenChunk();
-                endChildInParent(enb);
+                endChildInParent(enb, foundFirstNonSkippedElement());
                 freeENB(enb);
                 endElementChildPathStep();
             } catch (IOException e) {
@@ -496,7 +496,13 @@ public class SAXContentHandler implements ContentHandler, 
LexicalHandler {
     }
 
     private void endChildInParent(AbstractNodeBuilder anb) throws IOException {
-        if (enbStack.isEmpty()) {
+        endChildInParent(anb, false);
+    }
+
+    private void endChildInParent(AbstractNodeBuilder anb, boolean 
endNewElement) throws IOException {
+        if (endNewElement) {
+            anb.finish();
+        } else if (enbStack.isEmpty()) {
             docb.endChild(anb);
         } else {
             peekENBStackTop().endChild(anb);
@@ -509,7 +515,7 @@ public class SAXContentHandler implements ContentHandler, 
LexicalHandler {
             FrameUtils.flushFrame(frame, writer);
             appender.reset(frame, true);
             if (!addNodeToTupleAppender(result, t)) {
-                throw new HyracksDataException("Could not write frame 
(SAXContentHandler.addNodeToTuple).");
+                throw new HyracksDataException("Could not write frame.");
             }
         }
     }

Reply via email to