You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commons-dev@ws.apache.org by na...@apache.org on 2008/01/28 08:46:53 UTC

svn commit: r615746 - /webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/DOMStAXWrapper.java

Author: nandana
Date: Sun Jan 27 23:46:38 2008
New Revision: 615746

URL: http://svn.apache.org/viewvc?rev=615746&view=rev
Log:
Fixing MTOM related issues

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

Modified: webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/DOMStAXWrapper.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/DOMStAXWrapper.java?rev=615746&r1=615745&r2=615746&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/DOMStAXWrapper.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/DOMStAXWrapper.java Sun Jan 27 23:46:38 2008
@@ -21,6 +21,7 @@
 
 import org.apache.axiom.om.OMAttribute;
 import org.apache.axiom.om.OMComment;
+import org.apache.axiom.om.OMConstants;
 import org.apache.axiom.om.OMDocument;
 import org.apache.axiom.om.OMElement;
 import org.apache.axiom.om.OMNamespace;
@@ -28,6 +29,7 @@
 import org.apache.axiom.om.OMText;
 import org.apache.axiom.om.OMXMLParserWrapper;
 import org.apache.axiom.om.impl.EmptyOMLocation;
+import org.apache.axiom.om.impl.builder.StAXBuilder;
 import org.apache.axiom.om.impl.exception.OMStreamingException;
 import org.w3c.dom.Attr;
 
@@ -851,7 +853,45 @@
      * @throws IllegalArgumentException
      */
     public Object getProperty(String s) throws IllegalArgumentException {
-        throw new IllegalArgumentException();
+        if (OMConstants.IS_DATA_HANDLERS_AWARE.equals(s)) {
+            return Boolean.TRUE;
+        }
+        if (OMConstants.IS_BINARY.equals(s)) {
+            if (lastNode instanceof OMText) {
+                OMText text = (OMText) lastNode;
+                return new Boolean(text.isBinary());
+            }
+            return Boolean.FALSE;
+        } else if (OMConstants.DATA_HANDLER.equals(s)) {
+            if (lastNode instanceof OMText) {
+                OMText text = (OMText) lastNode;    
+                if (text.isBinary())
+                    return text.getDataHandler();
+            }
+        }
+        // Per spec, throw IllegalArgumentException
+        if (s == null) {
+            throw new IllegalArgumentException();
+        }
+        if (parser != null) {
+            return parser.getProperty(s);               
+        }
+        // Delegate to the builder's parser.
+        if (builder != null && builder instanceof StAXBuilder) {
+            StAXBuilder staxBuilder = (StAXBuilder) builder;
+            if (!staxBuilder.isClosed()) {
+                // If the parser was closed by something other
+                // than the builder, an IllegalStateException is
+                // thrown.  For now, return null as this is unexpected
+                // by the caller.
+                try {
+                    return ((StAXBuilder) builder).getReaderProperty(s);
+                } catch (IllegalStateException ise) {
+                    return null;
+                }
+            }
+        }
+        return null;
     }
 
     /**



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