You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by di...@apache.org on 2008/07/08 23:29:01 UTC
svn commit: r674962 - in
/webservices/axis2/trunk/java/modules/adb/src/org/apache/axis2/databinding:
typemapping/SimpleTypeMapper.java types/Time.java utils/ConverterUtil.java
Author: dims
Date: Tue Jul 8 14:29:01 2008
New Revision: 674962
URL: http://svn.apache.org/viewvc?rev=674962&view=rev
Log:
Revert svn commits 674447 and 674525 as this causes a integration test case failure in the IBM JDK5/6
-------------------------------------------------------------------------------
Test set: org.apache.axis2.rpc.complex.ComplexDataTypesComplexDataTypesSOAP11Test
-------------------------------------------------------------------------------
Tests run: 37, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 81.149 sec <<< FAILURE!
testretDateTime(org.apache.axis2.rpc.complex.ComplexDataTypesComplexDataTypesSOAP11Test) Time elapsed: 2.034 sec <<< FAILURE!
junit.framework.ComparisonFailure: null expected:<2008-07-08T1[4]:31:44.551Z> but was:<2008-07-08T1[5]:31:44.551Z>
at junit.framework.Assert.assertEquals(Assert.java:81)
at junit.framework.Assert.assertEquals(Assert.java:87)
at
org.apache.axis2.rpc.complex.ComplexDataTypesComplexDataTypesSOAP11Test.testretDateTime(ComplexDataTypesComplexDataTypesSOAP11Test.java:359)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:45)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:599)
674447 - there are instances where when we format the date it gives the wrong date, this commit is to fix the issue
674525 - it is enough to set the DST_TIME to zero
Amila, Deepal,
Can you please submit a JIRA / test case then we can work on making sure the issue is fixed across all JDK's.
thanks,
dims
Modified:
webservices/axis2/trunk/java/modules/adb/src/org/apache/axis2/databinding/typemapping/SimpleTypeMapper.java
webservices/axis2/trunk/java/modules/adb/src/org/apache/axis2/databinding/types/Time.java
webservices/axis2/trunk/java/modules/adb/src/org/apache/axis2/databinding/utils/ConverterUtil.java
Modified: webservices/axis2/trunk/java/modules/adb/src/org/apache/axis2/databinding/typemapping/SimpleTypeMapper.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/adb/src/org/apache/axis2/databinding/typemapping/SimpleTypeMapper.java?rev=674962&r1=674961&r2=674962&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/adb/src/org/apache/axis2/databinding/typemapping/SimpleTypeMapper.java (original)
+++ webservices/axis2/trunk/java/modules/adb/src/org/apache/axis2/databinding/typemapping/SimpleTypeMapper.java Tue Jul 8 14:29:01 2008
@@ -288,19 +288,9 @@
zulu.setTimeZone(TimeZone.getTimeZone("GMT"));
return zulu.format(((Calendar)obj).getTime());
} else if (obj instanceof Date) {
- Calendar calendar = Calendar.getInstance();
- calendar.clear();
- calendar.setTime((Date)obj);
- if (!calendar.isSet(Calendar.ZONE_OFFSET)){
- calendar.setTimeZone(TimeZone.getDefault());
- }
- StringBuffer dateString = new StringBuffer(16);
- ConverterUtil.appendDate(dateString, calendar);
- ConverterUtil.appendTimeZone(calendar, dateString);
- return dateString.toString();
-// SimpleDateFormat zulu = new SimpleDateFormat("yyyy-MM-dd");
+ SimpleDateFormat zulu = new SimpleDateFormat("yyyy-MM-dd");
// zulu.setTimeZone(TimeZone.getTimeZone("GMT"));
-// return zulu.format(obj);
+ return zulu.format(obj);
}
return obj.toString();
}
Modified: webservices/axis2/trunk/java/modules/adb/src/org/apache/axis2/databinding/types/Time.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/adb/src/org/apache/axis2/databinding/types/Time.java?rev=674962&r1=674961&r2=674962&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/adb/src/org/apache/axis2/databinding/types/Time.java (original)
+++ webservices/axis2/trunk/java/modules/adb/src/org/apache/axis2/databinding/types/Time.java Tue Jul 8 14:29:01 2008
@@ -99,6 +99,7 @@
source = source.trim();
Calendar calendar = Calendar.getInstance();
+ int dsTimeOffset = calendar.get(Calendar.DST_OFFSET);
calendar.clear();
int hour = 0;
int minite = 0;
@@ -196,8 +197,8 @@
}
calendar.set(Calendar.MILLISECOND, miliSecond);
- calendar.set(Calendar.ZONE_OFFSET, timeZoneOffSet);
- calendar.set(Calendar.DST_OFFSET, 0);
+ calendar.set(Calendar.ZONE_OFFSET, timeZoneOffSet - dsTimeOffset);
+ calendar.set(Calendar.DST_OFFSET, dsTimeOffset);
return calendar;
}
Modified: webservices/axis2/trunk/java/modules/adb/src/org/apache/axis2/databinding/utils/ConverterUtil.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/adb/src/org/apache/axis2/databinding/utils/ConverterUtil.java?rev=674962&r1=674961&r2=674962&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/adb/src/org/apache/axis2/databinding/utils/ConverterUtil.java (original)
+++ webservices/axis2/trunk/java/modules/adb/src/org/apache/axis2/databinding/utils/ConverterUtil.java Tue Jul 8 14:29:01 2008
@@ -608,13 +608,14 @@
}
Calendar calendar = Calendar.getInstance();
+ int dsTimeOffset = calendar.get(Calendar.DST_OFFSET);
calendar.clear();
calendar.set(Calendar.YEAR, year);
//xml month stars from the 1 and calendar month is starts with 0
calendar.set(Calendar.MONTH, month - 1);
calendar.set(Calendar.DAY_OF_MONTH, day);
- calendar.set(Calendar.ZONE_OFFSET, timeZoneOffSet);
- calendar.set(Calendar.DST_OFFSET, 0);
+ calendar.set(Calendar.ZONE_OFFSET, timeZoneOffSet - dsTimeOffset);
+ calendar.set(Calendar.DST_OFFSET, dsTimeOffset);
calendar.getTimeInMillis();
if (bc){
calendar.set(Calendar.ERA, GregorianCalendar.BC);
@@ -867,6 +868,7 @@
// '-'? yyyy '-' mm '-' dd 'T' hh ':' mm ':' ss ('.' s+)? (zzzzzz)?
Date date = null;
Calendar calendar = Calendar.getInstance();
+ int dsTimeOffset = calendar.get(Calendar.DST_OFFSET);
calendar.clear();
@@ -982,7 +984,10 @@
}
}
calendar.set(Calendar.MILLISECOND, miliSecond);
- calendar.set(Calendar.DST_OFFSET, 0);
+ calendar.set(Calendar.ZONE_OFFSET, timeZoneOffSet - dsTimeOffset);
+ calendar.set(Calendar.DST_OFFSET, dsTimeOffset);
+
+
} else {
throw new NumberFormatException("date string can not be less than 19 charactors");