问题
I'm migrating my mule project from version 3.6 to 3.7. In version 3.6 I was able to use invoker calling a method passing payload as an argument.
Now in version 3.7 if I do that I get NullPointerException
, when payload is null
, in class InvokerMessageProcessor
, line 272, when the following test is executed:
if (!(type.isAssignableFrom(arg.getClass())))
Because when payload is null
arg
is null
.
Is this a bug?
回答1:
In fact, there was a change in the way Mule treats emptiness and null
values from Mule 3.6+ to 3.7+, This is the way the validations used to be in Mule 3.6.x for different kind of processors and components:
- MEL (Mule Expression Language):
Payload == null
: false - MEL:
Payload is NullPayload
: true - MEL:
Payload is org.mule.transport.NullPayload
: true - Groovy:
Payload instanceof org.mule.transport.NullPayload
: true Groovy:
Payload == null
: falseNow, in Mule 3.7.x:
MEL:
Payload == null
: true- MEL:
Payload is NullPayload
: false - MEL:
Payload is org.mule.transport.NullPayload
: false - Groovy:
Payload instanceof org.mule.transport.NullPayload
: true - Groovy:
Payload == null
: false
来源:https://stackoverflow.com/questions/35850469/migrating-mule-3-6-to-mule-3-7-nullpointerexception-calling-method-with-null-pay