Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-5641

JmsBinding Does Not Handle BigInteger and BigDecimal Properly

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 2.9.3, 2.10.1
    • 2.9.4, 2.10.2, 2.11.0
    • camel-jms
    • java version "1.6.0_35"
      Java(TM) SE Runtime Environment (build 1.6.0_35-b10-428-11M3811)
      Java HotSpot(TM) 64-Bit Server VM (build 20.10-b01-428, mixed mode)

    • Patch Available
    • Novice

    Description

      According to the documentation:

      "The values must be primitives or their counter objects (such as
      Integer, Long, Character). The types, String, CharSequence, Date,
      BigDecimal and BigInteger are all converted to their toString()
      representation. All other types are dropped."

      So, it would seem that BigInteger should be toString()ed. However, in
      the JmsBinding class, we see the following code:

      protected Object getValidJMSHeaderValue(String headerName, Object headerValue) {
              if (headerValue instanceof String) {
                  return headerValue;
              } else if (headerValue instanceof Number) {
                  return headerValue;
              } else if (headerValue instanceof Character) {
                  return headerValue;
              } else if (headerValue instanceof CharSequence) {
                  return headerValue.toString();
              } else if (headerValue instanceof Boolean) {
                  return headerValue;
              } else if (headerValue instanceof Date) {
                  return headerValue.toString();
              }
              return null;
          }
      

      Since BigInteger extends Number, it will merely return the instance
      itself.

      Attachments

        1. CAMEL-5641.patch
          3 kB
          James Carman

        Activity

          People

            muellerc Christian Müller
            jwcarman James Carman
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: