Hi guys,
I concur this is an issue and have logged bug 4714327.
Enjoy your weekend! lance
[EMAIL PROTECTED] wrote:
(Lance, the previous list you received from us had 1-10 items, so I've given this one #11.)
1. Licensee Name: Apache
2. TCK and version: JAX-RPC (jaxrpc-1_0-fcs-tck-06_jun_2002.zip)
3. SDK version: NA
4. Priority (low, medium, high, ): HIGH
5. Specification Reference: - Spec Name: JAX-RPC - Spec version : JAX-RPC v 1.0 - Spec date: June 2002 - Page/Section to reference: NA
6. Test Name(s): At least 3 tests fail. jaxrpc/ee/w2j/rpc/encoded/parametermodetest/Client.java#InSimpleTypesTest_from_standalone jaxrpc/ee/w2j/rpc/encoded/parametermodetest/Client.java#OutSimpleTypesTest_from_standalone jaxrpc/ee/w2j/rpc/encoded/parametermodetest/Client.java#InOutSimpleTypesTest_from_standalone
7. Problem Description:
Here is the comparison method (in the JAXRPC_Datat class) that is used by the TCK to compare Calendars:
public static boolean compareCalendars(Calendar cal1, Calendar cal2) { SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS z"); TimeZone tmpzone = cal1.getTimeZone(); tmpzone.setID("Custom"); df.setTimeZone(tmpzone); String str1 = df.format(cal1.getTime()); tmpzone = cal2.getTimeZone(); tmpzone.setID("Custom"); df.setTimeZone(tmpzone); String str2 = df.format(cal2.getTime()); System.out.println("str1=" + str1); // Debug added by me System.out.println("str2=" + str2); // Debug added by me return str1.equals(str2); }
This method is used to compare the original Calendar (GregorianCalendar(96,5,1)) and the Calendar that is received by the service. The problem is that Axis always serializes the Calendar in its canonical form; thus the Calendar received by the service will always be in the GMT timezone.
From Austin, Texas the above debug output is:
str1=0096-06-01T00:00:00.000 GMT-05:00 str2=0096-06-01T05:00:00.000 GMT+00:00
which causes the function (and the test) to fail. Note that these two times are actually the same!
So the compareCalendars method must properly normallize the calendars before doing the comparison. For example,
public static boolean compareCalendars(Calendar cal1, Calendar cal2) { SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS z"); df.setTimeZone(TimeZone.getTimeZone("GMT")); // Added //TimeZone tmpzone = cal1.getTimeZone(); //tmpzone.setID("Custom"); //df.setTimeZone(tmpzone); String str1 = df.format(cal1.getTime()); //tmpzone = cal2.getTimeZone(); //tmpzone.setID("Custom"); //df.setTimeZone(tmpzone); String str2 = df.format(cal2.getTime()); System.out.println("str1=" + str1); // Debug System.out.println("str2=" + str2); // Debug return str1.equals(str2); }
This results in the following debug information and a successfull comparison:
str1=0096-06-01T05:00:00.000 GMT str2=0096-06-01T05:00:00.000 GMT
Russell Butek [EMAIL PROTECTED]
-- Lance Andersen email: [EMAIL PROTECTED] Sun Microsystems Inc. phone: (781) 442-2037 1 Network Drive, UBUR02-301 fax : (781) 442-1610 Burlington, MA 01803
