[dna-issues] [JBoss JIRA] Updated: (DNA-526) IllegalStateException calling TokenStream.canConsume(String str) after consuming all tokens via canConsume(String[])

Barry LaFond (JIRA) jira-events at lists.jboss.org
Wed Sep 23 12:42:49 EDT 2009


     [ https://jira.jboss.org/jira/browse/DNA-526?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Barry LaFond updated DNA-526:
-----------------------------

    Attachment: dna-common_DNA_526.patch


Patch to ToekenStream.canConsume( <MULTIPLE> ) methods and added test cases to TokenStreamTest.java

> IllegalStateException calling TokenStream.canConsume(String str) after consuming all tokens via canConsume(String[])
> --------------------------------------------------------------------------------------------------------------------
>
>                 Key: DNA-526
>                 URL: https://jira.jboss.org/jira/browse/DNA-526
>             Project: DNA
>          Issue Type: Bug
>          Components: Common
>            Reporter: Barry LaFond
>         Attachments: dna-common_DNA_526.patch
>
>
> While parsing, I wished to call canConsume() for multiple "optional" properties.  Some are "multi-string" using canConsume("xxxx", "xxxx", ....)
> If a previous canConsume() had finished parsing the tokens (i.e. currentToken == NULL), then a subsequent canConsume("xxxx") would result in the following exception:
> java.lang.IllegalStateException: The 'start()' method must be called before tokens can be consumed or matched
> 	at org.jboss.dna.common.text.TokenStream.currentToken(TokenStream.java:1160)
> 	at org.jboss.dna.common.text.TokenStream.matches(TokenStream.java:866)
> 	at org.jboss.dna.common.text.TokenStream.canConsume(TokenStream.java:609)
> 	at ....
> It appears that the canConsume( <MULTIPLE> ) methods do NOT call moveToNextToken() which is currently the only method that sets this.completed = TRUE.
> Fix would be to add:  this.completed = this.currentToken == NULL before returning on the canConsume( <MULTIPLE> ) methods.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the dna-issues mailing list