reportError() causes NullPointerException
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Tomasz_Lisowski
Posted On:   Tuesday, July 3, 2001 12:40 AM

The top-level parser grammar rule of the form: ( alt1 | alt2 | alt3 )+ EOF ; exception catch [RecognitionException ex] { reportError(ex.toString()); consumeUntil(EOF); } causes a NullPointerException when the loop exits, and something other than EOF is encountered. I was expecting a MismatchedTokenException to be caught, and properly reported, but it seems, that ex.toString() causes the error. The traceback leads to the tokenName() function, which apparently tries to use a null String in an expression. Any hints? Tomasz Lisowski    More>>

The top-level parser grammar rule of the form:


			
( alt1 | alt2 | alt3 )+
EOF
;
exception catch [RecognitionException ex] {
reportError(ex.toString());
consumeUntil(EOF);
}


causes a NullPointerException when the loop exits, and something other than EOF is encountered. I was expecting a MismatchedTokenException to be caught, and properly reported, but it seems, that ex.toString() causes the error. The traceback leads to the tokenName() function, which apparently tries to use a null String in an expression.


Any hints?


Tomasz Lisowski

   <<Less

Re: reportError() causes NullPointerException

Posted By:   Terence_Parr  
Posted On:   Monday, July 9, 2001 11:49 AM

Hmm...i guess you should try ex.getMessage() or something...ex may not properly set the message. It might just be a ""signal"" that there was a problem.
About | Sitemap | Contact