HolderOutInterceptor messes up Holder
-------------------------------------
Key: CXF-2504
URL: https://issues.apache.org/jira/browse/CXF-2504
Project: CXF
Issue Type: Bug
Components: JAX-WS Runtime
Environment: System:
2.6.28-15-generic #52-Ubuntu SMP Wed Sep 9 10:48:52 UTC 2009 x86_64 GNU/Linux
Java:
java version "1.6.0_16"
Java(TM) SE Runtime Environment (build 1.6.0_16-b01)
Java HotSpot(TM) 64-Bit Server VM (build 14.2-b01, mixed mode)
Apache CXF 2.2.3 (not in version list)
Reporter: Christian Connert
Hi,
The HolderOutInterceptor causes that the holder object is lost, when the
response is send back to the client.
It's caused by the following code block (line 72 - 79:
if (inObjects != null) {
for (int x = 0; x < inObjects.size(); x++) {
Object o = inObjects.get(x);
if (o instanceof Holder) {
outObjects.set(x + 1, o);
}
}
}
inObjects contains (in this order!) the request and the older object, out
objects the response. Thus the older which is at index 1 will be appended to
the out objects at index 2, leaving index 1 empty, but only the first two
objects are send back to the client. From my point of view it can be fixed by
using a separate index variable for the outObjects and initialize it with
outObjects.getSize(). Which would result in some code like this:
if (inObjects != null) {
int index = outObjects.size();
for (int x = 0; x < inObjects.size(); x++) {
Object o = inObjects.get(x);
if (o instanceof Holder) {
outObjects.set(index++, o);
}
}
}
Cheers
Christian
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.