Uploaded image for project: 'Spring Integration'
  1. Spring Integration
  2. INT-3182

OperationInvokingMessageHandler handleRequestMessage() fails to support primitive types

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Complete
    • Affects Version/s: 2.2.5
    • Fix Version/s: 2.2.7, 3.0 RC1
    • Component/s: JMX Support
    • Labels:
    • Environment:
      java6

      Description

      It is impossible to invoke any operation with any argument type being a primitive. OperationInvokingMessageHandler.handleRequestMessage() finds the correct operation, but when matching the signature, comparing arguments, it will never match primitive types.

      if (value != null && value.getClass().getName().equals(paramInfo.getType())) {
      }
      

      You have no possibility to pass primitive types herein:
      value.getClass().getName() will return "java.lang.Boolean" not equal to paramInfo.getType() returning "boolean". The same applies to lont, int etc.

      E.g. it is impossible to call stopActiveComponents of integrationMBeanExporter

      ...

      <int:channel id="shutdownChannel" />
      <int-jmx:operation-invoking-channel-adapter id="shutdownAdapter" channel="shutdownChannel" object-name="org.springframework.integration.monitor:name=integrationMBeanExporter,type=IntegrationMBeanExporter" operation-name="stopActiveComponents"/>
      

      ...

      List<Object> arguments = new LinkedList<Object>();
      arguments.add(true);
      arguments.add(0);
      shutdownChannel.send(MessageBuilder.withPayload(arguments).build());
      

      Results in:

      Exception in thread "Thread-1" org.springframework.integration.MessagingException: failed to find JMX operation 'stopActiveComponents' on MBean [org.springframework.integration.monitor:name=integrationMBeanExporter,type=IntegrationMBeanExporter] of type [org.springframework.integration.monitor.IntegrationMBeanExporter] with 2 parameters: [p2, p1]
      	at org.springframework.integration.jmx.OperationInvokingMessageHandler.handleRequestMessage(OperationInvokingMessageHandler.java:154)
      ...
      

        Attachments

          Activity

            People

            Assignee:
            grussell Gary Russell
            Reporter:
            sibidiba sibidiba
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: