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