eq throws NPE from ConstantImpl

Bug #720078 reported by Vesa Marttila on 2011-02-16
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Querydsl
Fix Released
Undecided
Unassigned

Bug Description

With an expression such as id.eq(null) the following exception is thrown:

java.lang.NullPointerException
        at com.mysema.query.types.ConstantImpl.<init>(ConstantImpl.java:124)
        at com.mysema.query.types.expr.SimpleExpression.eq(SimpleExpression.java:130)

This is due to this constructor:

public ConstantImpl(T constant){
    this((Class)constant.getClass(), constant);
}

The problem occurs at least in the Lucene module.

Ok, we need a more descriptive Exception for this.

id.eq(null) is not allowed, for "id is null" you need to use id.isNull()

The Exception is now : throw new IllegalArgumentException("eq(null) is not allowed. Use isNull() instead");

Changed in querydsl:
status: New → Fix Committed

Released in 2.1.2

Changed in querydsl:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers