diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OGeOperator.java b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OGeOperator.java index 520e047cd5f..a64af108984 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OGeOperator.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OGeOperator.java @@ -23,6 +23,7 @@ package com.orientechnologies.orient.core.sql.parser; +import com.orientechnologies.common.log.OLogManager; import com.orientechnologies.orient.core.metadata.schema.OType; import java.util.Map; @@ -50,7 +51,13 @@ public boolean execute(Object iLeft, Object iRight) { iLeft = couple[0]; iRight = couple[1]; } else { - iRight = OType.convert(iRight, iLeft.getClass()); + try { + iRight = OType.convert(iRight, iLeft.getClass()); + } catch (RuntimeException e) { + // Can't convert to the target value. + OLogManager.instance() + .warn(this, "Issue converting value to target type, ignoring value", e); + } } if (iRight == null) return false; return ((Comparable) iLeft).compareTo(iRight) >= 0; diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OGtOperator.java b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OGtOperator.java index ec52244c036..7457d783647 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OGtOperator.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OGtOperator.java @@ -2,6 +2,7 @@ /* JavaCCOptions:MULTI=true,NODE_USES_PARSER=false,VISITOR=true,TRACK_TOKENS=true,NODE_PREFIX=O,NODE_EXTENDS=,NODE_FACTORY=,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */ package com.orientechnologies.orient.core.sql.parser; +import com.orientechnologies.common.log.OLogManager; import com.orientechnologies.orient.core.db.record.OIdentifiable; import com.orientechnologies.orient.core.metadata.schema.OType; import java.util.Map; @@ -27,7 +28,13 @@ public boolean execute(Object iLeft, Object iRight) { iLeft = couple[0]; iRight = couple[1]; } else { - iRight = OType.convert(iRight, iLeft.getClass()); + try { + iRight = OType.convert(iRight, iLeft.getClass()); + } catch (RuntimeException e) { + // Can't convert to the target value do nothing will return false + OLogManager.instance() + .warn(this, "Issue converting value to target type, ignoring value", e); + } } if (iRight == null) return false; if (iLeft instanceof OIdentifiable && !(iRight instanceof OIdentifiable)) { diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OLeOperator.java b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OLeOperator.java index fa0cf6a820d..5bcdf095d59 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OLeOperator.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OLeOperator.java @@ -2,6 +2,7 @@ /* JavaCCOptions:MULTI=true,NODE_USES_PARSER=false,VISITOR=true,TRACK_TOKENS=true,NODE_PREFIX=O,NODE_EXTENDS=,NODE_FACTORY=,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */ package com.orientechnologies.orient.core.sql.parser; +import com.orientechnologies.common.log.OLogManager; import com.orientechnologies.orient.core.metadata.schema.OType; import java.util.Map; @@ -29,7 +30,13 @@ public boolean execute(Object iLeft, Object iRight) { iLeft = couple[0]; iRight = couple[1]; } else { - iRight = OType.convert(iRight, iLeft.getClass()); + try { + iRight = OType.convert(iRight, iLeft.getClass()); + } catch (RuntimeException e) { + // Can't convert to the target value do nothing will return false + OLogManager.instance() + .warn(this, "Issue converting value to target type, ignoring value", e); + } } if (iRight == null) return false; return ((Comparable) iLeft).compareTo(iRight) <= 0; diff --git a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OLtOperator.java b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OLtOperator.java index 17ea9c9f2ef..781ed899857 100644 --- a/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OLtOperator.java +++ b/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OLtOperator.java @@ -2,6 +2,7 @@ /* JavaCCOptions:MULTI=true,NODE_USES_PARSER=false,VISITOR=true,TRACK_TOKENS=true,NODE_PREFIX=O,NODE_EXTENDS=,NODE_FACTORY=,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */ package com.orientechnologies.orient.core.sql.parser; +import com.orientechnologies.common.log.OLogManager; import com.orientechnologies.orient.core.metadata.schema.OType; import java.util.Map; @@ -26,7 +27,13 @@ public boolean execute(Object iLeft, Object iRight) { iLeft = couple[0]; iRight = couple[1]; } else { - iRight = OType.convert(iRight, iLeft.getClass()); + try { + iRight = OType.convert(iRight, iLeft.getClass()); + } catch (RuntimeException e) { + // Can't convert to the target value do nothing will return false + OLogManager.instance() + .warn(this, "Issue converting value to target type, ignoring value", e); + } } if (iRight == null) return false; return ((Comparable) iLeft).compareTo(iRight) < 0;