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
Please add this to your list of issues.
Thanks!
Rich 'Shirley' Scheuerle
IBM WebSphere & Axis Web Services Development
512-838-5115 (IBM TL 678-5115)
--0__=0ABBE161DFE9D9F28f9e8a93df938690918c0ABBE161DFE9D9F2
Content-type: text/html; charset=US-ASCII
Content-Disposition: inline
<html><body>Lance,<br>
<br>
Axis is failing 3 of the jaxrpc.ee.w2j.rpc.encoded.parametermodetest tests due
to a Calendar comparison.<br>
<br>
Here is the comparison method (in the JAXRPC_Datat class) that is used by the
TCK to compare Calendars:<br>
<br>
<font face="Courier New CYR"> public static boolean
compareCalendars(Calendar cal1, Calendar cal2) {</font><br>
<font face="Courier New CYR"> SimpleDateFormat df = new
SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS z");</font><br>
<font face="Courier New CYR"> TimeZone tmpzone =
cal1.getTimeZone();</font><br>
<font face="Courier New CYR">
tmpzone.setID("Custom");</font><br>
<font face="Courier New CYR"> df.setTimeZone(tmpzone);</font><br>
<font face="Courier New CYR"> String str1 =
df.format(cal1.getTime());</font><br>
<font face="Courier New CYR"> tmpzone = cal2.getTimeZone();</font><br>
<font face="Courier New CYR">
tmpzone.setID("Custom");</font><br>
<font face="Courier New CYR"> df.setTimeZone(tmpzone);</font><br>
<font face="Courier New CYR"> String str2 =
df.format(cal2.getTime());</font><br>
<font face="Courier New CYR"> System.out.println("str1=" +
str1); // Debug added by me</font><br>
<font face="Courier New CYR"> System.out.println("str2=" +
str2); // Debug added by me</font><br>
<font face="Courier New CYR"> return str1.equals(str2);</font><br>
<font face="Courier New CYR"> }</font><br>
<br>
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.<br>
<br>
From Austin, Texas the above debug output is:<br>
<br>
<font face="Courier New CYR">str1=0096-06-01T00:00:00.000 GMT-05:00</font><br>
<font face="Courier New CYR">str2=0096-06-01T05:00:00.000 GMT+00:00</font><br>
<br>
which causes the function (and the test) to fail. Note that these two times
are actually the same!<br>
<br>
So the compareCalendars method must properly normallize the calendars before
doing the comparison. For example,<br>
<br>
<font face="Courier New CYR"> public static boolean
compareCalendars(Calendar cal1, Calendar cal2) {</font><br>
<font face="Courier New CYR"> SimpleDateFormat df = new
SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS z");</font><br>
<font face="Courier New CYR">
df.setTimeZone(TimeZone.getTimeZone("GMT")); // Added</font><br>
<font face="Courier New CYR"> //TimeZone tmpzone =
cal1.getTimeZone();</font><br>
<font face="Courier New CYR">
//tmpzone.setID("Custom");</font><br>
<font face="Courier New CYR"> //df.setTimeZone(tmpzone);</font><br>
<font face="Courier New CYR"> String str1 =
df.format(cal1.getTime());</font><br>
<font face="Courier New CYR"> //tmpzone = cal2.getTimeZone();</font><br>
<font face="Courier New CYR">
//tmpzone.setID("Custom");</font><br>
<font face="Courier New CYR"> //df.setTimeZone(tmpzone);</font><br>
<font face="Courier New CYR"> String str2 =
df.format(cal2.getTime());</font><br>
<font face="Courier New CYR"> System.out.println("str1=" +
str1); // Debug</font><br>
<font face="Courier New CYR"> System.out.println("str2=" +
str2); // Debug</font><br>
<font face="Courier New CYR"> return str1.equals(str2);</font><br>
<font face="Courier New CYR"> }</font><br>
<br>
This results in the following debug information and a successfull
comparison:<br>
<br>
<font face="Courier New CYR">str1=0096-06-01T05:00:00.000 GMT</font><br>
<font face="Courier New CYR">str2=0096-06-01T05:00:00.000 GMT</font><br>
<br>
Please add this to your list of issues.<br>
<br>
Thanks!<br>
<br>
<br>
Rich 'Shirley' Scheuerle<br>
IBM WebSphere & Axis Web Services Development<br>
512-838-5115 (IBM TL 678-5115)</body></html>
--0__=0ABBE161DFE9D9F28f9e8a93df938690918c0ABBE161DFE9D9F2--