thedivxboy
16 years agoOccasional Contributor
ClassCastException - getProperty() used with array
Hello,
In a groovy script step I have this code:
And in a listener (java code complied to a jar) I want to access each element of my array. But I don't know the correct syntax.
I tried this without success:
This code causes the following error in the testcase log:
The solution is probably easy but I'm not familiar with SoapUI casting and I've not found any specific method for array properties in the API.
Thanks in advance,
Arnaud
In a groovy script step I have this code:
def sides = ["value1", "value2"];
context.setProperty("sides", sides);
And in a listener (java code complied to a jar) I want to access each element of my array. But I don't know the correct syntax.
I tried this without success:
String[] sides = (String[]) runContext.getProperty("sides");
This code causes the following error in the testcase log:
TestCase failed [java.lang.ClassCastException: java.util.ArrayList:java.lang.ClassCastException: java.util.ArraytList], time taken = 28387
The solution is probably easy but I'm not familiar with SoapUI casting and I've not found any specific method for array properties in the API.
Thanks in advance,
Arnaud
- Hi,
I've found the problem .. It was a very strange problem ...
I've simply inversed the two following lines:List sides = (List) runContext.getProperty("sides");
String senderSideStatus, receiverSideStatus;
I suppose it's a bug in SoapUI or Java because it's not very logic I think
Bye,
Arnaud.