[
https://issues.jboss.org/browse/DROOLS-2937?page=com.atlassian.jira.plugi...
]
Matteo Mortari updated DROOLS-2937:
-----------------------------------
Description:
Given
{code:java}
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);
{code}
This would fail with:
{code:java}
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)
...
{code}
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:
{code:java}
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)
...
{code}
was:
Given
{code:java}
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);
{code}
This would fail with:
DMNRuntime API parameter nullcheck
----------------------------------
Key: DROOLS-2937
URL:
https://issues.jboss.org/browse/DROOLS-2937
Project: Drools
Issue Type: Enhancement
Components: dmn engine
Reporter: Matteo Mortari
Assignee: Matteo Mortari
Given
{code:java}
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);
{code}
This would fail with:
{code:java}
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)
...
{code}
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:
{code:java}
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)
...
{code}
--
This message was sent by Atlassian JIRA
(v7.5.0#75005)