Author: veithen
Date: Sun Dec 12 10:29:21 2010
New Revision: 1044786

URL: http://svn.apache.org/viewvc?rev=1044786&view=rev
Log:
Make releaseParserOnClose=true the default for builders created through the 
(new) OMXMLBuilderFactory API.

Modified:
    
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/AbstractOMMetaFactory.java

Modified: 
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/AbstractOMMetaFactory.java
URL: 
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/AbstractOMMetaFactory.java?rev=1044786&r1=1044785&r2=1044786&view=diff
==============================================================================
--- 
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/AbstractOMMetaFactory.java
 (original)
+++ 
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/AbstractOMMetaFactory.java
 Sun Dec 12 10:29:21 2010
@@ -37,12 +37,18 @@ import org.apache.axiom.om.util.StAXUtil
  */
 public abstract class AbstractOMMetaFactory implements OMMetaFactory {
     public OMXMLParserWrapper createStAXOMBuilder(OMFactory omFactory, 
XMLStreamReader parser) {
-        return new StAXOMBuilder(omFactory, parser);
+        StAXOMBuilder builder = new StAXOMBuilder(omFactory, parser);
+        // StAXOMBuilder defaults to the "legacy" behavior, which is to keep a 
reference to the
+        // parser after the builder has been closed. Since releasing this 
reference is a good idea
+        // we default to releaseParserOnClose=true for builders created 
through the OMMetaFactory
+        // API.
+        builder.releaseParserOnClose(true);
+        return builder;
     }
 
     public OMXMLParserWrapper createOMBuilder(OMFactory omFactory, InputStream 
in) {
         try {
-            return new StAXOMBuilder(omFactory, 
StAXUtils.createXMLStreamReader(in));
+            return createStAXOMBuilder(omFactory, 
StAXUtils.createXMLStreamReader(in));
         } catch (XMLStreamException ex) {
             throw new OMException(ex);
         }
@@ -50,7 +56,7 @@ public abstract class AbstractOMMetaFact
 
     public OMXMLParserWrapper createOMBuilder(OMFactory omFactory, Reader in) {
         try {
-            return new StAXOMBuilder(omFactory, 
StAXUtils.createXMLStreamReader(in));
+            return createStAXOMBuilder(omFactory, 
StAXUtils.createXMLStreamReader(in));
         } catch (XMLStreamException ex) {
             throw new OMException(ex);
         }


Reply via email to