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

We must ensure that 'priority' header can only have value of type Integer

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Complete
    • Affects Version/s: 2.1 GA
    • Fix Version/s: 2.0.6, 2.1.1, 2.2 M1
    • Component/s: Core
    • Labels:
      None

      Description

      Currently we allow 'priority' header to be set as String. We also have a leftover enumeration in XSD which is no longer valid

      <xsd:simpleType name="priorityEnumeration">
      	<xsd:restriction base="xsd:token">
      		<xsd:enumeration value="HIGHEST" />
      		<xsd:enumeration value="HIGH" />
      		<xsd:enumeration value="NORMAL" />
      		<xsd:enumeration value="LOW" />
      		<xsd:enumeration value="LOWEST" />
      	</xsd:restriction>
      </xsd:simpleType>
      

      If one of these values are used the exception is thrown. For example, the following configuration"

      <int:header-enricher input-channel="inputChannel" output-channel="priorityChannel">
      		<int:header name="priority" value="HIGHEST"/>
      	</int:header-enricher>
      	
      	<int:channel id="priorityChannel">
      		<int:priority-queue/>
      	</int:channel>
      	
      	<int:logging-channel-adapter channel="priorityChannel" level="WARN" log-full-message="true">
      		<int:poller fixed-rate="1000" max-messages-per-poll="1"/>
      	</int:logging-channel-adapter>
      

      ... results in

      Caused by: java.lang.IllegalArgumentException: Incorrect type specified for header 'priority'. Expected [class java.lang.Integer] but actual type is [class java.lang.String]
      	at org.springframework.integration.MessageHeaders.get(MessageHeaders.java:150)
      	at org.springframework.integration.MessageHeaders.getPriority(MessageHeaders.java:140)
      

        Attachments

          Activity

            People

            • Assignee:
              oleg.zhurakousky@springsource.com Oleg Zhurakousky
              Reporter:
              oleg.zhurakousky@springsource.com Oleg Zhurakousky
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: