Author: ajith
Date: Thu Apr 27 05:34:08 2006
New Revision: 397531
URL: http://svn.apache.org/viewcvs?rev=397531&view=rev
Log:
1.Fixed a minor (but very important) issue in the OMStAXWrapper.java. If the
parser is resting just before the end element then the generated set of events
become invalid
2.Updated the test case
Modified:
webservices/commons/trunk/modules/axiom/src/org/apache/axiom/om/impl/llom/OMStAXWrapper.java
webservices/commons/trunk/modules/axiom/test/org/apache/axiom/om/OMWrapperTest.java
Modified:
webservices/commons/trunk/modules/axiom/src/org/apache/axiom/om/impl/llom/OMStAXWrapper.java
URL:
http://svn.apache.org/viewcvs/webservices/commons/trunk/modules/axiom/src/org/apache/axiom/om/impl/llom/OMStAXWrapper.java?rev=397531&r1=397530&r2=397531&view=diff
==============================================================================
---
webservices/commons/trunk/modules/axiom/src/org/apache/axiom/om/impl/llom/OMStAXWrapper.java
(original)
+++
webservices/commons/trunk/modules/axiom/src/org/apache/axiom/om/impl/llom/OMStAXWrapper.java
Thu Apr 27 05:34:08 2006
@@ -859,7 +859,6 @@
}
// We should throw an END_DOCUMENT
- needToThrowEndDocument = true;
if ((currentEvent == START_DOCUMENT) &&
(currentEvent == parser.getEventType())) {
currentEvent = parser.next();
@@ -867,11 +866,6 @@
currentEvent = parser.getEventType();
}
- if(currentEvent == START_ELEMENT) {
- depth = 0;
- } else if(currentEvent == END_ELEMENT) {
- depth ++;
- }
updateCompleteStatus();
break;
case NAVIGABLE:
@@ -937,11 +931,17 @@
nextNode = navigator.next();
}
} else {
-
+ //at this point check whether the navigator is done
+ //if the navigator is done then we are fine and can directly
+ // jump to the complete state ?
+ if (navigator.isCompleted()) {
+ nextNode = null;
+ }else{
// reset caching (the default is ON so it was not needed in the
// earlier case!
builder.setCache(false);
state = SWITCH_AT_NEXT;
+ }
}
}
}
Modified:
webservices/commons/trunk/modules/axiom/test/org/apache/axiom/om/OMWrapperTest.java
URL:
http://svn.apache.org/viewcvs/webservices/commons/trunk/modules/axiom/test/org/apache/axiom/om/OMWrapperTest.java?rev=397531&r1=397530&r2=397531&view=diff
==============================================================================
---
webservices/commons/trunk/modules/axiom/test/org/apache/axiom/om/OMWrapperTest.java
(original)
+++
webservices/commons/trunk/modules/axiom/test/org/apache/axiom/om/OMWrapperTest.java
Thu Apr 27 05:34:08 2006
@@ -55,52 +55,19 @@
XMLStreamReader reader =
wrap2Element.getXMLStreamReaderWithoutCaching();
-// XMLStreamReader reader = wrap2Element.getXMLStreamReader();
+ int count = 0;
while(reader.hasNext()){
- System.out.println(getEventString(reader.next()));
- System.out.println(reader.hasName()?reader.getLocalName():"");
+ reader.next();
+ count ++;
}
+
+ assertEquals(3,count);
} catch (XMLStreamException e) {
- e.printStackTrace(); //To change body of catch statement use File
| Settings | File Templates.
+ fail(e.getMessage());
}
}
- private static String getEventString(int eventCode) {
- String event = "";
- switch (eventCode) {
- case 1 :
- event = "START_ELEMENT";
- break;
- case 2 :
- event = "END_ELEMENT";
- break;
- case 3 :
- event = "PROCESSING_INSTRUCTION";
- break;
- case 4 :
- event = "CHARACTERS";
- break;
- case 5 :
- event = "COMMENT";
- break;
- case 6 :
- event = "SPACE";
- break;
- case 7 :
- event = "START_DOCUMENT";
- break;
- case 8 :
- event = "END_DOCUMENT";
- break;
- case 9 :
- event = "ENTITY_REFERENCE";
- break;
- default:
- break;
- }
- return event;
- }
}