-
Notifications
You must be signed in to change notification settings - Fork 831
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
计算公式中,一个是数据,一个是 字符串,计算会抛异常 #45
Comments
你好,能否将问题具体一些?或者给一段可以重现的代码。 |
Expression compiledExp = AviatorEvaluator.compile("standardValue == compareValue");
|
我修改源码 AviatorNumber: |
这个错误是符合预期的,你传入的是数字和字符串,两者比较就是要报错的。 具体比较规则参见文档 https://github.com/killme2008/aviator/wiki#%E5%85%B3%E7%B3%BB%E8%BF%90%E7%AE%97%E7%AC%A6 |
针对这个问题,你有几个解决办法:
|
谢谢 |
"8161 == PCV3-8" ,运行时,发现8161是数据,会走数字类型,但是比较值是字符串时报错。
问题点:
if (otherValue instanceof Number) {
return this.innerCompare(AviatorNumber.valueOf(otherValue));
} else {
throw new ExpressionRuntimeException("Could not compare " + this + " with " + other);
}
The text was updated successfully, but these errors were encountered: