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 "Andreas Veithen (JIRA)" <ji...@apache.org> on 2010/09/14 20:53:32 UTC

[jira] Resolved: (WSCOMMONS-561) IllegalStateException SwitchingWrapper.getTextFromNode on empty Tag

     [ https://issues.apache.org/jira/browse/WSCOMMONS-561?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Andreas Veithen resolved WSCOMMONS-561.
---------------------------------------

    Resolution: Invalid

According to the StAX specs [1] getText() is actually _required_ to throw an IllegalStateException if the current event "is not a valid text state". The events for which getText() may be called are CHARACTERS, CDATA, COMMENT, SPACE, ENTITY_REFERENCE and DTD. Since none of these events is generated for an empty tag, it is the expected behavior to throw IllegalStateException. Axiom 1.2.8 was indeed more lenient about this, but this was in violation of the specs. You should therefore fix your code so that it makes correct usage of the StAX API, i.e. to call getText() only when allowed (or better, to use getElementText).

[1] http://download.oracle.com/javase/6/docs/api/javax/xml/stream/XMLStreamReader.html#getText()

> IllegalStateException SwitchingWrapper.getTextFromNode on empty Tag
> -------------------------------------------------------------------
>
>                 Key: WSCOMMONS-561
>                 URL: https://issues.apache.org/jira/browse/WSCOMMONS-561
>             Project: WS-Commons
>          Issue Type: Bug
>          Components: AXIOM
>    Affects Versions: Axiom 1.2.9
>            Reporter: Robert Klaus
>         Attachments: EmptyTags.zip
>
>
> I'm using Spring Web Services in combination with the streaming api and axiom-api and axiom-impl. I have some JUnit Testcases that parse some sample webservice requests. Using Axiom 1.2.8 these tests pass. 
> After upgrading to 1.2.9 a tests fails with an IllegalStateException in SwitchingWrapper#getTextFromNode. The xml soap body contains several empty tags.
> When debugging I saw that currentEvent had the value 2, which is not covered by the switch and thus the IllegalStateException. My guess is that it is the constant END_ELEMENT.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.