Out of curiosity, why might an attachment have an index greater than the list size? Would that primarily be the result of a programmatic error on the part of the web service/client developer?
Thanks, Glen Am Montag, den 18.06.2007, 03:31 +0000 schrieb [EMAIL PROTECTED]: > Author: dandiep > Date: Sun Jun 17 20:31:42 2007 > New Revision: 548190 > > URL: http://svn.apache.org/viewvc?view=rev&rev=548190 > Log: > Make SwaInInterceptor a bit more robust. Any attachment that has an index > greater than the list size can simply be appended to the end of the list. > This prevents conflicts with the HolderInInterceptor. Attachments which have > an index less than the list size can be inserted. > > Modified: > > incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/SwAInInterceptor.java > > Modified: > incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/SwAInInterceptor.java > URL: > http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/SwAInInterceptor.java?view=diff&rev=548190&r1=548189&r2=548190 > ============================================================================== > --- > incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/SwAInInterceptor.java > (original) > +++ > incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/SwAInInterceptor.java > Sun Jun 17 20:31:42 2007 > @@ -75,16 +75,6 @@ > boolean found = false; > > int idx = mpi.getMessageInfo().getMessagePartIndex(mpi); > - /*while (idx >= inObjects.size()) { > - inObjects.add(null); > - }*/ > - > - //fix for testSwaWithHeaders of ClientServerSwaTest > - inObjects.add(idx, null); > - > - if (inObjects.get(idx) != null) { > - continue; > - } > > for (Attachment a : message.getAttachments()) { > if (a.getId().startsWith(start)) { > @@ -110,16 +100,24 @@ > o = dh; > } > > - inObjects.set(idx, o); > + // If the current index is greater than the # of objects, > + // just append the attachment to the end > + if (idx >= inObjects.size()) { > + inObjects.add(o); > + } else { > + inObjects.add(idx, o); > + } > found = true; > break; > } > } > > if (!found) { > - > - > - inObjects.add(idx, null); > + if (idx >= inObjects.size()) { > + inObjects.add(null); > + } else { > + inObjects.add(idx, null); > + } > } > } > } > >
