Project: mule
Issue MULE-8303: ClassCastException when setting a MEL expression in the config-ref of a Connector's call
When a MEL expression is set in the config-ref of a Salesforce Connector call and the object-store has no OAuthState stored for a user, the operation fails for that user with a ClassCastException with the following message. ******************************************************************************** Message : Failed to invoke describeSObject. Message payload is of type: CaseInsensitiveHashMap Code : MULE_ERROR--2 -------------------------------------------------------------------------------- Exception stack is: 1. java.lang.String cannot be cast to org.mule.security.oauth.OnNoTokenPolicyAware (java.lang.ClassCastException) org.mule.devkit.processor.DevkitBasedMessageProcessor:97 (null) 2. Failed to invoke describeSObject. Message payload is of type: CaseInsensitiveHashMap (org.mule.api.MessagingException) org.mule.devkit.processor.DevkitBasedMessageProcessor:128 (http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/api/MessagingException.html) -------------------------------------------------------------------------------- Root Exception stack trace: java.lang.ClassCastException: java.lang.String cannot be cast to org.mule.security.oauth.OnNoTokenPolicyAware at org.mule.devkit.processor.DevkitBasedMessageProcessor.process(DevkitBasedMessageProcessor.java:97) at org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor.execute(ExceptionToMessagingExceptionExecutionInterceptor.java:24) at org.mule.execution.MessageProcessorNotificationExecutionInterceptor.execute(MessageProcessorNotificationExecutionInterceptor.java:58) + 3 more (set debug level logging or '-Dmule.verbose.exceptions=true' for everything) ******************************************************************************** I believe the issue can be found in the following method: org.mule.devkit.processor.DevkitBasedMessageProcessor.process(MuleEvent) line 97. moduleObject is cast to OnNoTokenPolicyAware without verifying if it is a String. The method findOrCreate does verify that in line 174.
Story points: 5