From: Brian C. (JIRA) <no...@at...> - 2006-07-17 20:45:56
|
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1885?page=comments#action_23649 ] Brian Cox commented on HHH-1885: -------------------------------- Further investigation shows that one way this can happen is after the TokenQueue.expand() method has been called. The new queue elements will be NULL; therefore, LT(0) will return NULL and LA(0) will throw a NullPtrExcp. > LA(0) is undefined > ------------------ > > Key: HHH-1885 > URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1885 > Project: Hibernate3 > Type: Bug > Components: query-hql > Versions: 3.1.2 > Environment: Hibernate 3.1.2 Postgres 8.1.2 > Reporter: Brian Cox > > > method weakKeywords() in org.hibernate.hql.ast.HqlParser.java has: > if (LA(0) == FROM && t != IDENT && LA(2) == DOT) { > ... > } > According to a posting on the antlr mailing list [see "LT(0) Specification" posted 1 July 2006], > LA(i) and LT(i) are defined only for i > 0. Examining the code supports this assertion. Also these > methods are documented as "lookahead" not "lookbehind". LT(0) can return NULL and then LA(0) > will throw a NullPointerException as shown: > java.lang.NullPointerException > at antlr.TokenBuffer.LA(TokenBuffer.java:81) > at antlr.LLkParser.LA(LLkParser.java:52) > at org.hibernate.hql.ast.HqlParser.weakKeywords(HqlParser.java:296) > at org.hibernate.hql.antlr.HqlBaseParser.negatedExpression(HqlBaseParser.java:2366) > at org.hibernate.hql.antlr.HqlBaseParser.logicalAndExpression(HqlBaseParser.java:2331) > at org.hibernate.hql.antlr.HqlBaseParser.logicalOrExpression(HqlBaseParser.java:2296) > at org.hibernate.hql.antlr.HqlBaseParser.expression(HqlBaseParser.java:2082) > at org.hibernate.hql.antlr.HqlBaseParser.compoundExpr(HqlBaseParser.java:2991) > at org.hibernate.hql.antlr.HqlBaseParser.inList(HqlBaseParser.java:2858) > at org.hibernate.hql.antlr.HqlBaseParser.relationalExpression(HqlBaseParser.java:2720) > at org.hibernate.hql.antlr.HqlBaseParser.equalityExpression(HqlBaseParser.java:2449) > at org.hibernate.hql.antlr.HqlBaseParser.negatedExpression(HqlBaseParser.java:2413) > at org.hibernate.hql.antlr.HqlBaseParser.logicalAndExpression(HqlBaseParser.java:2331) > at org.hibernate.hql.antlr.HqlBaseParser.logicalOrExpression(HqlBaseParser.java:2296) > at org.hibernate.hql.antlr.HqlBaseParser.expression(HqlBaseParser.java:2082) > at org.hibernate.hql.antlr.HqlBaseParser.logicalExpression(HqlBaseParser.java:1858) > at org.hibernate.hql.antlr.HqlBaseParser.whereClause(HqlBaseParser.java:454) > at org.hibernate.hql.antlr.HqlBaseParser.updateStatement(HqlBaseParser.java:224) > at org.hibernate.hql.antlr.HqlBaseParser.statement(HqlBaseParser.java:142) > at org.hibernate.hql.ast.QueryTranslatorImpl.parse(QueryTranslatorImpl.java:238) > at org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:155) > at org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:109) > at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:75) > at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:54) > at org.hibernate.engine.query.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:71) > at org.hibernate.impl.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:134) > at org.hibernate.impl.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:113) > at org.hibernate.impl.SessionImpl.createQuery(SessionImpl.java:1602) > at com.timestock.tess.util.DbUtils.saveUpdatedUsers(DbUtils.java:38) > at com.timestock.tess.services.collectors.StatsCollector$StatisticsCollector.run(StatsCollector.java:602) > at java.util.TimerThread.mainLoop(Timer.java:512) > at java.util.TimerThread.run(Timer.java:462) -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira |