Uploaded image for project: 'ServiceMix'
  1. ServiceMix
  2. SM-1186

NormalizedMessageImpl.getAttachment() returns DataHandler when it should return null

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 3.2.1
    • 3.2.2, 3.3
    • servicemix-core
    • None
    • any

    • Patch Available

    Description

      The current implementation of getAttachment() in NormalizedMessageImpl always returns a DataHandler if the message has any attachments, even if it does not have an attachment with the given ID:

      public DataHandler getAttachment(String id) {
      if (attachments != null)

      { return new DataHandler((DataSource) attachments.get(id)); }

      return null;
      }

      According to the JBI javadocs, getAttachment should return "DataHandler representing attachment content, or null if an attachment with the specified identifier is not found".

      Thus, the implementation should add an additional check

      if(attachments !=null && attachments.get(id) != null){
      return new DataHandler((DataSource) attachments.get(id));
      }

      Attachments

        1. SM1186_patch.txt
          0.6 kB
          Jamie Mark Goodyear

        Activity

          People

            lhe Lars Heinemann
            alexvigdor Alex Vigdor
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: