You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@servicemix.apache.org by "Alex Vigdor (JIRA)" <ji...@apache.org> on 2007/12/28 00:58:26 UTC

[jira] Created: (SM-1186) NormalizedMessageImpl.getAttachment() returns DataHandler when it should return null

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


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.


[jira] Updated: (SM-1186) NormalizedMessageImpl.getAttachment() returns DataHandler when it should return null

Posted by "Jamie Goodyear (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/activemq/browse/SM-1186?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jamie Goodyear updated SM-1186:
-------------------------------

    Attachment: SM1186_patch.txt

 Created patch for the issue described in SM-1186 based upon Alex Vigdor's suggested solution. The relevant JBI spec indicates a null return if attachment with specified identifier is not found [1]. 

 File Modified:
 /x2/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/messaging/NormalizedMessageImpl.java

Tested on Mac OSX 10.5.2
Java: 1.5.0_13

 [1] http://java.sun.com/integration/1.0/docs/sdk/api/javax/jbi/messaging/NormalizedMessage.html#getAttachment(java.lang.String)

> 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
>             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.


[jira] Updated: (SM-1186) NormalizedMessageImpl.getAttachment() returns DataHandler when it should return null

Posted by "Guillaume Nodet (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/activemq/browse/SM-1186?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Guillaume Nodet updated SM-1186:
--------------------------------

    Fix Version/s: 3.3
                   3.2.2
                   3.1.3

> 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
>             Fix For: 3.1.3, 3.2.2, 3.3
>
>
> 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.


[jira] Commented: (SM-1186) NormalizedMessageImpl.getAttachment() returns DataHandler when it should return null

Posted by "Lars Heinemann (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/SM-1186?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=41430#action_41430 ] 

Lars Heinemann commented on SM-1186:
------------------------------------

The API documentation linked in Jamie Goodyear's comment states that in case of a non-existing attachment with the given id the method should return null. 

> 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.


[jira] Assigned: (SM-1186) NormalizedMessageImpl.getAttachment() returns DataHandler when it should return null

Posted by "Lars Heinemann (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/activemq/browse/SM-1186?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Lars Heinemann reassigned SM-1186:
----------------------------------

    Assignee: Lars Heinemann

> 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.


[jira] Resolved: (SM-1186) NormalizedMessageImpl.getAttachment() returns DataHandler when it should return null

Posted by "Lars Heinemann (JIRA)" <ji...@apache.org>.
     [ 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.


[jira] Work started: (SM-1186) NormalizedMessageImpl.getAttachment() returns DataHandler when it should return null

Posted by "Lars Heinemann (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/activemq/browse/SM-1186?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Work on SM-1186 started by Lars Heinemann.

> 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.


[jira] Updated: (SM-1186) NormalizedMessageImpl.getAttachment() returns DataHandler when it should return null

Posted by "Guillaume Nodet (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/activemq/browse/SM-1186?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Guillaume Nodet updated SM-1186:
--------------------------------

    Patch Info: [Patch Available]

> 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
>             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.