Hi, On Sun, Apr 15, 2012 at 8:56 PM, Andreas Veithen <[email protected]>wrote:
> The addChild method also removes the node from its original parent. > Therefore there should be a call to Iterator#remove between the call > to Iterator#next and the invocation of addChild. > > Thanks. That fixes the issue. Sadeep Andreas > > On Sun, Apr 15, 2012 at 10:48, Sadeep Jayasumana <[email protected]> > wrote: > > Hi, > > > > I'm able to reproduce the exception mentioned by Hiranya with a fresh > online > > build from the trunk (see [1] for the stack-trace). Culprit code snippet > is > > as follows: > > > > PayloadFactoryMediator.java > > 69. SOAPBody soapBody = synCtx.getEnvelope().getBody(); > > ..... > > 84. for (Iterator itr = soapBody.getChildElements(); itr.hasNext();) { > > 85. OMElement child = (OMElement) itr.next(); > > 86. child.detach(); > > 87. } > > 88. > > 89. for (Iterator itr = resultElement.getChildElements(); > itr.hasNext();) > > { > > 90. OMElement child = (OMElement) itr.next(); > > 91. soapBody.addChild(child); > > 92. } > > > > I'm able to get rid of the exception at line 84 by replacing line 86 with > > itr.remove(), but then the same exception occurs at line 89. > > > > Is this a wrong usage of Axiom API? Note that the same code snippet > exists > > within XSLTMediator.java. However, I'm unable to test the functionality > of > > that mediator because it's apparently broken due to some other issue (a > > separate mail was fired on that). > > > > [1] > > java.util.ConcurrentModificationException: The current node has been > removed > > using a method other than Iterator#remove() > > at > > > org.apache.axiom.om.impl.traverse.OMAbstractIterator.hasNext(OMAbstractIterator.java:67) > > at > > > org.apache.axiom.om.impl.traverse.OMFilterIterator.hasNext(OMFilterIterator.java:54) > > at > > > org.apache.synapse.mediators.transform.PayloadFactoryMediator.mediate(PayloadFactoryMediator.java:84) > > at > > > org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:60) > > > > > > Thanks, > > Sadeep > > > > On Sun, Apr 15, 2012 at 4:58 PM, Sadeep Jayasumana < > [email protected]> > > wrote: > >> > >> Hi, > >> > >> I will add some unit tests for PayloadFactory mediator. > >> > >> Thanks, > >> Sadeep > >> > >> > >> On Sat, Apr 14, 2012 at 9:08 PM, Andreas Veithen > >> <[email protected]> wrote: > >>> > >>> That makes wonder if it is now considered standard practice in the > >>> Synapse project to add new features without providing unit tests. > >>> There is not a single unit test for PayloadFactoryMediator, although > >>> it is really not hard to write such a unit test (there are lots of > >>> examples in the code that show how to do that). > >>> > >>> Andreas > >>> > >>> On Wed, Apr 11, 2012 at 08:26, Hiranya Jayathilaka < > [email protected]> > >>> wrote: > >>> > It looks like the PayloadFactory mediator is broken in latest trunk. > >>> > I'm > >>> > getting a concurrent modification exception. Possibly due to some > >>> > change in > >>> > Axiom side. Sadeep, will you have some time to look into this? > >>> > > >>> > Thanks > >>> > -- > >>> > Hiranya Jayathilaka > >>> > Associate Technical Lead; > >>> > WSO2 Inc.; http://wso2.org > >>> > E-mail: [email protected]; Mobile: +94 77 633 3491 > >>> > Blog: http://techfeast-hiranya.blogspot.com > >>> > >>> --------------------------------------------------------------------- > >>> To unsubscribe, e-mail: [email protected] > >>> For additional commands, e-mail: [email protected] > >>> > >> > >> > >> > >> -- > >> > >> Sadeep Jayasumana > >> > >> Email: [email protected] > >> > >> Mobile: +61 4 1468 8521 > >> > >> > > > > > > > > -- > > > > Sadeep Jayasumana > > > > Email: [email protected] > > > > Mobile: +61 4 1468 8521 > > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > > -- Sadeep Jayasumana ** Email: [email protected]**** Mobile: +61 4 1468 8521
