Repository: cxf Updated Branches: refs/heads/master 38a1b7704 -> 1616f1910
[CXF-6653] NPE may result while generating a SequenceFault in WS-RM 1.1 Project: http://git-wip-us.apache.org/repos/asf/cxf/repo Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/1616f191 Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/1616f191 Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/1616f191 Branch: refs/heads/master Commit: 1616f19109942a38a9cd410afbb7626bf5053b02 Parents: 38a1b77 Author: Akitoshi Yoshida <[email protected]> Authored: Thu Oct 22 17:35:48 2015 +0200 Committer: Akitoshi Yoshida <[email protected]> Committed: Thu Oct 22 17:36:22 2015 +0200 ---------------------------------------------------------------------- .../java/org/apache/cxf/ws/rm/EncoderDecoder11Impl.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cxf/blob/1616f191/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/EncoderDecoder11Impl.java ---------------------------------------------------------------------- diff --git a/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/EncoderDecoder11Impl.java b/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/EncoderDecoder11Impl.java index a8acff6..5740460 100644 --- a/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/EncoderDecoder11Impl.java +++ b/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/EncoderDecoder11Impl.java @@ -41,6 +41,7 @@ import org.apache.cxf.ws.rm.v200702.AckRequestedType; import org.apache.cxf.ws.rm.v200702.CloseSequenceType; import org.apache.cxf.ws.rm.v200702.CreateSequenceResponseType; import org.apache.cxf.ws.rm.v200702.CreateSequenceType; +import org.apache.cxf.ws.rm.v200702.DetailType; import org.apache.cxf.ws.rm.v200702.Identifier; import org.apache.cxf.ws.rm.v200702.SequenceAcknowledgement; import org.apache.cxf.ws.rm.v200702.SequenceFaultType; @@ -142,16 +143,23 @@ public final class EncoderDecoder11Impl extends EncoderDecoder { } Element data = doc.getDocumentElement(); if (data != null) { - flt.getDetail().getAny().add(data); + addDetail(flt, data); } data = sf.getExtraDetail(); if (data != null) { - flt.getDetail().getAny().add(data); + addDetail(flt, data); } marshaller.marshal(new JAXBElement<SequenceFaultType>(RM11Constants.SEQUENCE_FAULT_QNAME, SequenceFaultType.class, flt), header); } + private static void addDetail(SequenceFaultType sft, Element data) { + if (!sft.isSetDetail()) { + sft.setDetail(new DetailType()); + } + sft.getDetail().getAny().add(data); + } + public Element encodeSequenceAcknowledgement(SequenceAcknowledgement ack) throws JAXBException { Document doc = DOMUtils.createDocument(); Marshaller marshaller = getContext().createMarshaller();
