Serialization of array cia SimpleNotificationProducer sends only the last 
element in the array
----------------------------------------------------------------------------------------------

                 Key: MUSE-265
                 URL: https://issues.apache.org/jira/browse/MUSE-265
             Project: Muse
          Issue Type: Bug
          Components: WSN NotificationProducer
    Affects Versions: 2.2.0
            Reporter: Bogdan Solomon
            Assignee: Dan Jemiolo
            Priority: Minor


The problem is the way the NotificationMessage stores the elements.

The SimpleNotificationProducer publish array method does the following for 
arrays, where content is the array (of either XmlSerializable or Elements):

NotificationMessage message = createNotificationMessage();
       
for (int n = 0; n < content.length; ++n)
     message.addMessageContent(content[n]);

and in SimpleNotificationMessage

the addMessageContent does the following:

if (content == null)
     throw new NullPointerException(_MESSAGES.get("NullMessageContent"));

QName name = XmlUtils.getElementQName(content);
_messageContent.put(name, content);

but _messageContent is a LinkedHashMap, and from what the Java specification 
says adding multiple instances with the same key overwrites the values. So only 
the last one will be preserved. If all the Array elements have the same QName 
(which they should as they pass through the same serializer) then only the last 
is stored.

I have solved the issue for the moment by wrapping the Elements that represent 
the array in another top level element that gets published. 

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


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to