com.sun.xml.ws.handler.LogicalMessageImpl opimizations · Issue #648 · javaee/metro-jax-ws (original) (raw)

This repository was archived by the owner on Feb 5, 2019. It is now read-only.

This repository was archived by the owner on Feb 5, 2019. It is now read-only.

@glassfishrobot

Description

@glassfishrobot

It appears that current implementation of this class is pretty inefficient at
least for processing outbound messages.
I noticed two issues which probably need attention.

1. public Source getPayload() implementation converts payloadSrc object to
DOMSource. Debugger shows that payloadSrc is already a SAXSource (more
accurately JAXBBridgeSource) object and it seems could be returned as is without
spending time and memory recreating DOM tree.

2. public Object getPayload(JAXBContext context)
Original JAXBBridgeSource object already has a field (contentObject) which
contains an object which can be returned by getPayload. Instead implementation
of this method converts this object to XML (DOM) and then uses JAXBContext to
recreate it again. Besides been grossly inefficient this procedure seems to have
a side effect in converting attachments to inline text elements.

Of course context used in getPayload could be different from the one used in
JAXBridgeSource but it seems it's important enough to handle the case when those
contexts are identical differently. Besides proposed optimization could be used
when getPayload context parameter is null.

Environment

Operating System: All
Platform: All

Affected Versions

[2.1.6]