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 "Robert Klaus (JIRA)" <ji...@apache.org> on 2010/09/14 18:44:33 UTC

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

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


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.


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

Posted by "Andreas Veithen (JIRA)" <ji...@apache.org>.
     [ 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.


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

Posted by "Robert Klaus (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WSCOMMONS-561?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12909643#action_12909643 ] 

Robert Klaus commented on WSCOMMONS-561:
----------------------------------------

You are right. Our code did not take care about the event type at that point. Sorry for the annoyance.

> 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.


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

Posted by "Robert Klaus (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WSCOMMONS-561?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Robert Klaus updated WSCOMMONS-561:
-----------------------------------

    Attachment: EmptyTags.zip

Attached a project containing two unit tests illustrating the behavior (it is a maven build).

I tried to simulate the Spring-WS environment as good as possible so the setup may look a bit clumsy ...

> 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.