org.oasis_open.docs.wsn.b_2.Notify objects get silently dumped by 
DefaultMarshaller
-----------------------------------------------------------------------------------

                 Key: SM-1073
                 URL: https://issues.apache.org/activemq/browse/SM-1073
             Project: ServiceMix
          Issue Type: Bug
          Components: servicemix-core
    Affects Versions: 3.2
         Environment: Windows XP
            Reporter: Ryan Moquin


This is a bug in some form (that at the very least an exception or message 
should be logged).  I passed a jaxb object from one of my services into the 
NotificationBroker.notify() method and a org.oasis_open.docs.wsn.b_2.Notify is 
constructed with my object as the content:

public void notify(String topic, Object msg) throws JBIException {
        Notify notify = new Notify();
        NotificationMessageHolderType holder = new 
NotificationMessageHolderType();
        if (topic != null) {
            TopicExpressionType topicExp = new TopicExpressionType();
            topicExp.getContent().add(topic);
            holder.setTopic(topicExp);
        }
        holder.setMessage(new NotificationMessageHolderType.Message());
        holder.getMessage().setAny(msg);
        notify.getNotificationMessage().add(holder);
        send(notify);
    }

Eventually the following method gets executed (in DefaultMarshaller) with the 
Notify object that was created as the parameter in body, but since the Notify 
object isn't an instance of any of the 3 things it's looking for, it returns 
null (as a side note, the message variable isn't even used in this method):

protected Source asContent(NormalizedMessage message, Object body) {
        if (body instanceof Source) {
            return (Source) body;
        } else if (body instanceof String) {
            // lets assume String is the XML to send
            return new StringSource((String) body);
        } else if (body instanceof Node) {
            return new DOMSource((Node) body);
        }
        return null;
   }

This null then is put into the message variable as the content (line 56 on 
DefaultMarshaller, the marshal method), hence the Notify object gets tossed:

Source content = asContent(message, body);
            message.setContent(content);

This was all called by DefaultServicemixClient, which returns back to the 
following method, with the in variable now populated with null as the content:

protected void populateMessage(MessageExchange exchange, Map exchangeProperties,
                                   Map inMessageProperties, Object content) 
throws MessagingException {
        NormalizedMessage in = exchange.getMessage("in");
        populateExchangeProperties(exchange, exchangeProperties);
        populateMessageProperties(in, inMessageProperties);
        getMarshaler().marshal(exchange, in, content);
    }

Some sort of exception should be thrown since it doesn't like the Notify 
method, instead of silently inserting null.  More importantly though, 
Servicemix shouldn't create an object to use that it doesn't like. 

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