users@glassfish.java.net

major bug in System Application Server 9.0 (Update 2)

From: <glassfish_at_javadesktop.org>
Date: Tue, 06 Mar 2007 14:39:23 PST

Hello,

I recently upgraded the original release of System Application Server 9.0 to the latest "Update 2".
It appears that the new version introduced a major bug in the way SAS handles web service' methods with List arguments.

Consider the following web method, deployed as part of a web service class:

[code]
@WebMethod
public List<MyClass> myMethod(@WebParam(name = "arg1") List<Integer> arg1) {
   Integer num = arg1.get(0); // throws ClassCastException
   return null;
}
[/code]

This worked perfectly in the original release of SAS.
In the new version, the auto-generated wsdl (or actually, its xsd) shows the argument to be of type xsd:anytype (instead of the correct xsd:int). Also, a ClassCastException is thrown as noted inside the code.

An ugly workaround I found is to define the method like this:
[code]
@WebMethod
public List<MyClass> myMethod(@WebParam(name = "arg1") int[] arg1, @WebParam(name = "arg2") List<Integer> arg2) {
   int num = arg1[0]; // works okay
   return null;
}
[/code]

Note the introduction of the second List<Integer> argument, which will be wrongly treated as a List<Object> by SAS - it is used as a dummy.
Also note that the first argument is now int[] and not List<Integer>.

This is the only way I could make the code work - all else failed.
Code is compiled with NetBeans 5.5 and deployed as a war file.

I honestly don't understand how a major bug like this managed to slip during your upgrade.

regards,
Danny
[Message sent by forum member 'dl1' (dl1)]

http://forums.java.net/jive/thread.jspa?messageID=206551