Skip to content

Commit 1476811

Browse files
committed
add some null checks
to avoid bad error message from Criteria API
1 parent 54f5844 commit 1476811

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

hibernate-core/src/main/java/org/hibernate/query/sqm/tree/predicate/SqmComparisonPredicate.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
import org.hibernate.query.sqm.tree.expression.SqmExpression;
1515

1616

17+
18+
import static java.util.Objects.requireNonNull;
1719
import static org.hibernate.query.sqm.internal.TypecheckUtil.assertComparable;
1820

1921
/**
@@ -39,6 +41,12 @@ private SqmComparisonPredicate(
3941
boolean negated,
4042
NodeBuilder nodeBuilder) {
4143
super( negated, nodeBuilder );
44+
45+
// CriteriaBuilder does not check its arguments, so check these here instead
46+
requireNonNull( operator, "Operator must not be null" );
47+
requireNonNull( leftHandExpression, "Left expression must not be null" );
48+
requireNonNull( rightHandExpression, "Right expression must not be null" );
49+
4250
this.leftHandExpression = leftHandExpression;
4351
this.rightHandExpression = rightHandExpression;
4452
this.operator = operator;

0 commit comments

Comments
 (0)