Skip to content
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

日期类型的比较运算行为不一致。 #175

Closed
cuiyuemin365 opened this issue Nov 14, 2019 · 2 comments
Closed

日期类型的比较运算行为不一致。 #175

cuiyuemin365 opened this issue Nov 14, 2019 · 2 comments
Assignees
Labels

Comments

@cuiyuemin365
Copy link

    public static void main(String[] args) {
        Map<String, Object> dataMap1 = new HashMap<>();
        dataMap1.put("date1", null);
        dataMap1.put("date2", new Date());
        System.out.println("null>new Date()   ===> " + AviatorEvaluator.execute("date1>date2", dataMap1));

        Map<String, Object> dataMap2 = new HashMap<>();
        dataMap2.put("date1", new Date());
        dataMap2.put("date2", null);
        System.out.println("new Date()>null   ===> " + AviatorEvaluator.execute("date1>date2", dataMap2));
    }
null>new Date()   ===> false
Exception in thread "main" com.googlecode.aviator.exception.ExpressionRuntimeException: Compare <JavaType, null, null> with <JavaType, null, null> error
	at com.googlecode.aviator.runtime.type.AviatorJavaType.compare(AviatorJavaType.java:404)
	at Script_1573697293370_1/2052915500.execute0(Unknown Source)
	at com.googlecode.aviator.ClassExpression.execute(ClassExpression.java:73)
	at com.googlecode.aviator.AviatorEvaluatorInstance.execute(AviatorEvaluatorInstance.java:950)
	at com.googlecode.aviator.AviatorEvaluator.execute(AviatorEvaluator.java:496)
	at com.googlecode.aviator.AviatorEvaluator.execute(AviatorEvaluator.java:508)
	at com.googlecode.aviator.mydemo.Test.main(Test.java:47)
Caused by: java.lang.NullPointerException
	at java.util.Date.getMillisOf(Date.java:958)
	at java.util.Date.compareTo(Date.java:978)
	at java.util.Date.compareTo(Date.java:131)
	at com.googlecode.aviator.runtime.type.AviatorJavaType.compare(AviatorJavaType.java:402)
	... 6 more

@killme2008
Copy link
Owner

这是个bug,感谢反馈

@killme2008 killme2008 self-assigned this Nov 14, 2019
@killme2008 killme2008 added the bug label Nov 14, 2019
@killme2008
Copy link
Owner

Released 4.2.6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants