[ 
https://issues.apache.org/activemq/browse/SM-1186?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Lars Heinemann resolved SM-1186.
--------------------------------

    Resolution: Fixed

- changed the getAttachment(String id) method to behave JBI compliant (see 
SM-1186 by Alex Vidgor)
- added a testcase for this issue


> NormalizedMessageImpl.getAttachment() returns DataHandler when it should 
> return null
> ------------------------------------------------------------------------------------
>
>                 Key: SM-1186
>                 URL: https://issues.apache.org/activemq/browse/SM-1186
>             Project: ServiceMix
>          Issue Type: Bug
>          Components: servicemix-core
>    Affects Versions: 3.2.1
>         Environment: any
>            Reporter: Alex Vigdor
>            Assignee: Lars Heinemann
>             Fix For: 3.1.3, 3.2.2, 3.3
>
>         Attachments: SM1186_patch.txt
>
>
> 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));
> }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to