You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ws.apache.org by ve...@apache.org on 2011/01/02 13:23:32 UTC

svn commit: r1054392 - in /webservices/commons/trunk/modules/axiom/modules: axiom-api/src/main/java/org/apache/axiom/om/impl/ axiom-testsuite/src/main/java/org/apache/axiom/ts/ axiom-testsuite/src/main/java/org/apache/axiom/ts/om/document/

Author: veithen
Date: Sun Jan  2 12:23:32 2011
New Revision: 1054392

URL: http://svn.apache.org/viewvc?rev=1054392&view=rev
Log:
Fixed two issues in SwitchingWrapper, one related to AXIOM-346 and one related to processing instructions in non caching mode.

Modified:
    webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/SwitchingWrapper.java
    webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/AxiomTestSuiteBuilder.java
    webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/document/TestGetXMLStreamReader.java

Modified: webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/SwitchingWrapper.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/SwitchingWrapper.java?rev=1054392&r1=1054391&r2=1054392&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/SwitchingWrapper.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/SwitchingWrapper.java Sun Jan  2 12:23:32 2011
@@ -1156,7 +1156,7 @@ class SwitchingWrapper extends AbstractX
                 }
             }
         } else {
-            if (state == SWITCHED) {
+            if (state == SWITCHED && rootNode instanceof OMElement) {
                 //this is a potential place for bugs
                 //we have to test if the root node of this parser
                 //has the same name for this test
@@ -1254,7 +1254,7 @@ class SwitchingWrapper extends AbstractX
      */
     public String getPITarget() {
         if (parser != null) {
-            return parser.getPIData();
+            return parser.getPITarget();
         } else {
             if (currentEvent == PROCESSING_INSTRUCTION) {
                 return ((OMProcessingInstruction)lastNode).getTarget();

Modified: webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/AxiomTestSuiteBuilder.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/AxiomTestSuiteBuilder.java?rev=1054392&r1=1054391&r2=1054392&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/AxiomTestSuiteBuilder.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/AxiomTestSuiteBuilder.java Sun Jan  2 12:23:32 2011
@@ -47,7 +47,8 @@ public class AxiomTestSuiteBuilder {
         addTest(new org.apache.axiom.ts.om.builder.TestGetDocumentElementWithDiscardDocument(metaFactory));
         addTest(new org.apache.axiom.ts.om.document.TestSerializeAndConsumeWithIncompleteDescendant(metaFactory));
         for (int i=0; i<conformanceFiles.length; i++) {
-            addTest(new org.apache.axiom.ts.om.document.TestGetXMLStreamReader(metaFactory, conformanceFiles[i]));
+            addTest(new org.apache.axiom.ts.om.document.TestGetXMLStreamReader(metaFactory, conformanceFiles[i], true));
+            addTest(new org.apache.axiom.ts.om.document.TestGetXMLStreamReader(metaFactory, conformanceFiles[i], false));
         }
         addTest(new org.apache.axiom.ts.om.element.TestAddAttributeWithExistingNamespaceDeclarationInScope(metaFactory));
         addTest(new org.apache.axiom.ts.om.element.TestAddAttributeWithExistingNamespaceDeclarationOnSameElement(metaFactory));

Modified: webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/document/TestGetXMLStreamReader.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/document/TestGetXMLStreamReader.java?rev=1054392&r1=1054391&r2=1054392&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/document/TestGetXMLStreamReader.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/document/TestGetXMLStreamReader.java Sun Jan  2 12:23:32 2011
@@ -34,8 +34,12 @@ import org.apache.axiom.ts.ConformanceTe
  * Test comparing the output of {@link OMStAXWrapper} with that of a native StAX parser.
  */
 public class TestGetXMLStreamReader extends ConformanceTestCase {
-    public TestGetXMLStreamReader(OMMetaFactory metaFactory, String file) {
+    private final boolean cache;
+    
+    public TestGetXMLStreamReader(OMMetaFactory metaFactory, String file, boolean cache) {
         super(metaFactory, file);
+        this.cache = cache;
+        setName(getName() + " [cache=" + cache + "]");
     }
     
     protected void runTest() throws Throwable {
@@ -47,7 +51,7 @@ public class TestGetXMLStreamReader exte
                 StAXOMBuilder builder = new StAXOMBuilder(metaFactory.getOMFactory(),
                         StAXUtils.createXMLStreamReader(in2));
                 try {
-                    XMLStreamReader actual = builder.getDocument().getXMLStreamReader();
+                    XMLStreamReader actual = builder.getDocument().getXMLStreamReader(cache);
                     new XMLStreamReaderComparator(new RootWhitespaceFilter(expected),
                             new RootWhitespaceFilter(actual)).compare();
                 } finally {