Details
-
Enhancement
-
Resolution: Done
-
Major
-
None
-
None
-
None
-
2018 Week 33-35
-
1
-
NEW
-
NEW
Description
Given
final DMNModel dmnModel = runtime.getModel("<wrong>", "<wrong>"); // please notice an end-user of the API might not having checked the result of the previous call is not a null. DMNContext emptyContext = DMNFactory.newContext(); DMNResult dmnResult = runtime.evaluateAll(dmnModel, emptyContext);
This would fail with:
java.lang.NullPointerException at org.kie.dmn.core.impl.DMNRuntimeImpl.performRuntimeTypeCheck(DMNRuntimeImpl.java:622) at org.kie.dmn.core.impl.DMNRuntimeImpl.evaluateAll(DMNRuntimeImpl.java:118) at org.kie.dmn.core.DMNRuntimeTypeCheckTest.testMisleadingNPEbyAPIusage(DMNRuntimeTypeCheckTest.java:199) ...
which is not very helpful for the end-user of API to understand he inadvertently passed a null model to the DMNRuntime.evaluateAll method.
With the proposed change:
java.lang.NullPointerException: Kie DMN API parameter 'model' cannot be null. at java.util.Objects.requireNonNull(Objects.java:290) at org.kie.dmn.core.impl.DMNRuntimeImpl.evaluateAll(DMNRuntimeImpl.java:123) at org.kie.dmn.core.DMNRuntimeTypeCheckTest.testMisleadingNPEbyAPIusage(DMNRuntimeTypeCheckTest.java:199) ...