persistence@glassfish.java.net

EJBQL: fixing NPE in not equals expression

From: Michael Bouschen <Michael.Bouschen_at_Sun.COM>
Date: Wed, 07 Dec 2005 12:36:27 +0100

Hi Tom,

there is a bug in the EJBQL compiler causing a NullPointerException in
the code handling a not equals expression. It occurs in case the right
hand side of the not equals is a more complicated expression requiring
its own helper during parse tree creation. Here is an example:
   co.totalPrice <> ALL (Select MIN(o.totalPrice) FROM Order o)
The generate parse tree is not correct, because the NotNode is created
as a child node of the EqualsNode. So the NotNode does not have a child
node which results in the NPE.

Attached you find a fix, where I introduced a new node NotEqualsNode.
Please have a look.

Thanks!

Regards Michael