Mule
  1. Mule
  2. MULE-5034

Instructions for msg.getAttachmentNames() deprecation are wrong

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Critical Critical
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 3.0.0-RC3
    • Component/s: Core: API
    • Labels:
    • User impact:
      Medium
    • Similar Issues:
      MULE-5070Incorrect deprecation documentation
      MULE-7475Remove deprecated methods in ExpressionLanguage
      MULE-7476Remove deprecated methods in MuleEventContext
      MULE-8176Deprecate HTTP transport
      MULE-7473Remove deprecated methods on Transformer interface
      MULE-6150Deprecate Wrapper Component
      MULE-5224Generate warnings for deprecated schema elements
      MULE-7471Remove deprecated methods from MuleSession
      MULE-7474Remove deprecated methods from Expression Manager
      MULE-7779Deprecate Guice module

      Description

      org.mule.transport.email.MailMuleMessageFactoryTestCase#testAttachments()

      uses the deprecated getAttachments(). However, replacing it with getInboundAttachmentNames() as per instructions is not working (attachments end up on the outbound). See if these are doc errors or things go wrong in the Mule message factory.

        Activity

        Hide
        Andrew Perepelytsya added a comment -

        Same for e.g. LoanBrokerEsbTestCase. It outputs numerous warning about the deprecated api usage, however, replacing it with this (as per deprecation docs):

        Set<?> attachmentNames = message.getOutboundAttachmentNames();
                if (attachmentNames != null && !attachmentNames.isEmpty())
                {
                    List<DataHandler> attachments = new ArrayList<DataHandler>();
                    for (Object attachmentName : attachmentNames)
                    {
                        attachments.add(message.getInboundAttachment((String) attachmentName));
                    }
                    List<Object> temp = new ArrayList<Object>(Arrays.asList(args));
                    temp.add(attachments.toArray(new DataHandler[attachments.size()]));
                    args = temp.toArray();
                }
        

        doesn't feel right (iterating over outbound attachmen names, but getting the from the inbound?)

        Show
        Andrew Perepelytsya added a comment - Same for e.g. LoanBrokerEsbTestCase. It outputs numerous warning about the deprecated api usage, however, replacing it with this (as per deprecation docs): Set<?> attachmentNames = message.getOutboundAttachmentNames(); if (attachmentNames != null && !attachmentNames.isEmpty()) { List<DataHandler> attachments = new ArrayList<DataHandler>(); for ( Object attachmentName : attachmentNames) { attachments.add(message.getInboundAttachment(( String ) attachmentName)); } List< Object > temp = new ArrayList< Object >(Arrays.asList(args)); temp.add(attachments.toArray( new DataHandler[attachments.size()])); args = temp.toArray(); } doesn't feel right (iterating over outbound attachmen names, but getting the from the inbound?)
        Hide
        Andrew Perepelytsya added a comment -

        The above code can be found e.g. in CxfOutboundMessageProcessor

        Show
        Andrew Perepelytsya added a comment - The above code can be found e.g. in CxfOutboundMessageProcessor
        Hide
        Andrew Perepelytsya added a comment -

        Ross, were there any changes committed? Changeset?

        Show
        Andrew Perepelytsya added a comment - Ross, were there any changes committed? Changeset?
        Hide
        Ross Mason added a comment -

        AP: this is the changeset for MULE-5034,  Jira is referenced: http://fisheye.codehaus.org/changelog/mule/?cs=19337.

        I didn't tackle CXF, I guess the issue now is to remove any deprecated calls to attachment APIs

        Show
        Ross Mason added a comment - AP: this is the changeset for MULE-5034 ,  Jira is referenced: http://fisheye.codehaus.org/changelog/mule/?cs=19337 . I didn't tackle CXF, I guess the issue now is to remove any deprecated calls to attachment APIs

          People

          • Assignee:
            Ross Mason
            Reporter:
            Andrew Perepelytsya
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development