synapse-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sadeep Jayasumana <gayansad...@gmail.com>
Subject Re: PayloadFactory Mediator Broken in the Trunk
Date Sun, 15 Apr 2012 08:48:47 GMT
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 <gayansadeep@gmail.com>wrote:

> Hi,
>
> I will add some unit tests for PayloadFactory mediator.
>
> Thanks,
> Sadeep
>
>
> On Sat, Apr 14, 2012 at 9:08 PM, Andreas Veithen <
> andreas.veithen@gmail.com> 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 <hiranya911@gmail.com>
>> 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: hiranya@wso2.com;  Mobile: +94 77 633 3491
>> > Blog: http://techfeast-hiranya.blogspot.com
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe@synapse.apache.org
>> For additional commands, e-mail: dev-help@synapse.apache.org
>>
>>
>
>
> --
>
> Sadeep Jayasumana
>
> **
>
> Email: gayansadeep@gmail.com****
>
> Mobile: +61 4 1468 8521
>
>
>


-- 

Sadeep Jayasumana

**

Email: gayansadeep@gmail.com****

Mobile: +61 4 1468 8521

Mime
View raw message