Fix NPE on LIKE operator (SQL)
@@ -14,7 +14,9 @@ public class OLikeOperator extends SimpleNode implements OBinaryCompareOperator
super(p, id);
}
- /** Accept the visitor. **/
+ /**
+ * Accept the visitor.
+ **/
public Object jjtAccept(OrientSqlVisitor visitor, Object data) {
return visitor.visit(this, data);
}
@@ -24,6 +26,9 @@ public class OLikeOperator extends SimpleNode implements OBinaryCompareOperator
if (OMultiValue.isMultiValue(iLeft) || OMultiValue.isMultiValue(iRight))
return false;
+ if (iLeft == null || iRight == null) {
+ return false;
+ }
return OQueryHelper.like(iLeft.toString(), iRight.toString());
}
@@ -32,19 +37,23 @@ public class OLikeOperator extends SimpleNode implements OBinaryCompareOperator
return "LIKE";
}
- @Override public boolean supportsBasicCalculation() {
+ @Override
+ public boolean supportsBasicCalculation() {
return true;
}
- @Override public OLikeOperator copy() {
+ @Override
+ public OLikeOperator copy() {
return new OLikeOperator(-1);
}
- @Override public boolean equals(Object obj) {
+ @Override
+ public boolean equals(Object obj) {
return obj != null && obj.getClass().equals(this.getClass());
}
- @Override public int hashCode() {
+ @Override
+ public int hashCode() {
return getClass().hashCode();
}
}
