tuscany-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rf...@apache.org
Subject svn commit: r572771 - in /incubator/tuscany/java/sca/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom: AxiomHelper.java OMElement2Object.java
Date Tue, 04 Sep 2007 18:55:48 GMT
Author: rfeng
Date: Tue Sep  4 11:55:47 2007
New Revision: 572771

URL: http://svn.apache.org/viewvc?rev=572771&view=rev
Log:
Short-term fix for TUSCANY-1656

Modified:
    incubator/tuscany/java/sca/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/AxiomHelper.java
    incubator/tuscany/java/sca/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/OMElement2Object.java

Modified: incubator/tuscany/java/sca/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/AxiomHelper.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/AxiomHelper.java?rev=572771&r1=572770&r2=572771&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/AxiomHelper.java
(original)
+++ incubator/tuscany/java/sca/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/AxiomHelper.java
Tue Sep  4 11:55:47 2007
@@ -26,6 +26,8 @@
 import org.apache.axiom.om.OMElement;
 import org.apache.axiom.om.OMFactory;
 import org.apache.axiom.om.OMNamespace;
+import org.apache.axiom.om.OMXMLParserWrapper;
+import org.apache.axiom.om.impl.builder.StAXBuilder;
 import org.apache.tuscany.sca.databinding.TransformationContext;
 import org.apache.tuscany.sca.interfacedef.DataType;
 import org.apache.tuscany.sca.interfacedef.util.XMLType;
@@ -39,6 +41,45 @@
     private static final String DEFAULT_PREFIX = "_ns_";
 
     private AxiomHelper() {
+    }
+
+    /**
+     * See http://issues.apache.org/jira/browse/WSCOMMONS-240
+     * @param om
+     */
+    public static void completeAndClose(OMElement om) {
+        // Get the builder associated with the om element
+        OMXMLParserWrapper builder = om.getBuilder();
+        if (builder != null) {
+            if (builder instanceof StAXBuilder) {
+                // FIXME: Uncomment it for AXIOM 1.2.5
+                // ((StAXBuilder)builder).releaseParserOnClose(true);
+            }
+            OMElement document = builder.getDocumentElement();
+            if (document != null) {
+                document.build();
+            }
+        }
+        if (builder instanceof StAXBuilder) {
+            ((StAXBuilder)builder).close();
+        }
+    }
+
+    /**
+     * This method will close the builder immediately.  Any subsequent Axiom objects won't

+     * be built or accessible.
+     */
+    public static void closeImmediately(OMElement om) {
+        // Get the builder associated with the om element
+        OMXMLParserWrapper builder = om.getBuilder();
+        if (builder != null) {
+            if (builder instanceof StAXBuilder) {
+                // FIXME: Uncomment it for AXIOM 1.2.5
+                // ((StAXBuilder)builder).releaseParserOnClose(true);
+                ((StAXBuilder)builder).close();
+            }
+            // builder.close();
+        }
     }
 
     /**

Modified: incubator/tuscany/java/sca/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/OMElement2Object.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/OMElement2Object.java?rev=572771&r1=572770&r2=572771&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/OMElement2Object.java
(original)
+++ incubator/tuscany/java/sca/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/OMElement2Object.java
Tue Sep  4 11:55:47 2007
@@ -28,7 +28,9 @@
 
     @Override
     protected String getText(OMElement source) {
-        return source.getText();
+        String text = source.getText();
+        AxiomHelper.completeAndClose(source);
+        return text;
     }
 
     @Override



---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org


Mime
View raw message