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 2012/07/20 10:55:33 UTC
svn commit: r1363684 - in /webservices/axiom/branches/AXIOM-435: ./
modules/axiom-common-impl/src/main/java/org/apache/axiom/om/impl/common/
modules/axiom-testutils/src/main/java/org/apache/axiom/testutils/stax/
Author: veithen
Date: Fri Jul 20 08:55:33 2012
New Revision: 1363684
URL: http://svn.apache.org/viewvc?rev=1363684&view=rev
Log:
Merged latest changes from trunk.
Modified:
webservices/axiom/branches/AXIOM-435/ (props changed)
webservices/axiom/branches/AXIOM-435/modules/axiom-common-impl/src/main/java/org/apache/axiom/om/impl/common/SwitchingWrapper.java
webservices/axiom/branches/AXIOM-435/modules/axiom-testutils/src/main/java/org/apache/axiom/testutils/stax/XMLStreamReaderComparator.java
Propchange: webservices/axiom/branches/AXIOM-435/
------------------------------------------------------------------------------
Merged /webservices/commons/trunk/modules/axiom:r1362694-1363683
Modified: webservices/axiom/branches/AXIOM-435/modules/axiom-common-impl/src/main/java/org/apache/axiom/om/impl/common/SwitchingWrapper.java
URL: http://svn.apache.org/viewvc/webservices/axiom/branches/AXIOM-435/modules/axiom-common-impl/src/main/java/org/apache/axiom/om/impl/common/SwitchingWrapper.java?rev=1363684&r1=1363683&r2=1363684&view=diff
==============================================================================
--- webservices/axiom/branches/AXIOM-435/modules/axiom-common-impl/src/main/java/org/apache/axiom/om/impl/common/SwitchingWrapper.java (original)
+++ webservices/axiom/branches/AXIOM-435/modules/axiom-common-impl/src/main/java/org/apache/axiom/om/impl/common/SwitchingWrapper.java Fri Jul 20 08:55:33 2012
@@ -313,9 +313,6 @@ class SwitchingWrapper extends AbstractX
public int getTextLength() {
if (parser != null) {
return parser.getTextLength();
- } else if (currentEvent == DTD) {
- // Not sure if that conforms to the StAX spec, but it is what Woodstox does
- throw new IllegalStateException();
} else {
return getTextFromNode().length();
}
@@ -360,15 +357,10 @@ class SwitchingWrapper extends AbstractX
throw new OMStreamingException(e);
}
} else {
- if (currentEvent == DTD) {
- // Not sure if that conforms to the StAX spec, but it is what Woodstox does
- throw new IllegalStateException();
- } else {
- String text = getTextFromNode();
- int copied = Math.min(length, text.length()-sourceStart);
- text.getChars(sourceStart, sourceStart + copied, target, targetStart);
- return copied;
- }
+ String text = getTextFromNode();
+ int copied = Math.min(length, text.length()-sourceStart);
+ text.getChars(sourceStart, sourceStart + copied, target, targetStart);
+ return copied;
}
}
@@ -379,9 +371,6 @@ class SwitchingWrapper extends AbstractX
public char[] getTextCharacters() {
if (parser != null) {
return parser.getTextCharacters();
- } else if (currentEvent == DTD) {
- // Not sure if that conforms to the StAX spec, but it is what Woodstox does
- throw new IllegalStateException();
} else {
return getTextFromNode().toCharArray();
}
@@ -395,10 +384,23 @@ class SwitchingWrapper extends AbstractX
if (parser != null) {
return parser.getText();
} else {
- return getTextFromNode();
+ if (currentEvent == DTD) {
+ // For a DTD event, only getText is allowed, but not getTextCharacters etc.
+ // (see the table in the Javadoc of XMLStreamReader)
+ return ((OMDocType)lastNode).getValue();
+ } else {
+ return getTextFromNode();
+ }
}
}
+ /**
+ * Get the text for the current node. This methods applies to events for which all
+ * <code>getText</code> methods are valid. This excludes {@link XMLStreamConstants#DTD} events
+ * for which only {@link #getText()} is valid.
+ *
+ * @return the text for the current node
+ */
private String getTextFromNode() {
switch (currentEvent) {
case CHARACTERS:
@@ -407,8 +409,6 @@ class SwitchingWrapper extends AbstractX
return ((OMText)lastNode).getText();
case COMMENT:
return ((OMComment)lastNode).getValue();
- case DTD:
- return ((OMDocType)lastNode).getValue();
case ENTITY_REFERENCE:
return ((OMEntityReference)lastNode).getReplacementText();
default:
Modified: webservices/axiom/branches/AXIOM-435/modules/axiom-testutils/src/main/java/org/apache/axiom/testutils/stax/XMLStreamReaderComparator.java
URL: http://svn.apache.org/viewvc/webservices/axiom/branches/AXIOM-435/modules/axiom-testutils/src/main/java/org/apache/axiom/testutils/stax/XMLStreamReaderComparator.java?rev=1363684&r1=1363683&r2=1363684&view=diff
==============================================================================
--- webservices/axiom/branches/AXIOM-435/modules/axiom-testutils/src/main/java/org/apache/axiom/testutils/stax/XMLStreamReaderComparator.java (original)
+++ webservices/axiom/branches/AXIOM-435/modules/axiom-testutils/src/main/java/org/apache/axiom/testutils/stax/XMLStreamReaderComparator.java Fri Jul 20 08:55:33 2012
@@ -115,7 +115,7 @@ public class XMLStreamReaderComparator e
if (actualException == null) {
fail("Expected " + methodName + " to throw " +
expectedException.getClass().getName() +
- ", but the method retuned normally (" + getLocation() + ")");
+ ", but the method returned normally (" + getLocation() + ")");
} else {
assertEquals(expectedException.getClass(), actualException.getClass());
}