You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by de...@apache.org on 2008/07/07 13:02:53 UTC

svn commit: r674447 - /webservices/axis2/trunk/java/modules/adb/src/org/apache/axis2/databinding/typemapping/SimpleTypeMapper.java

Author: deepal
Date: Mon Jul  7 04:02:52 2008
New Revision: 674447

URL: http://svn.apache.org/viewvc?rev=674447&view=rev
Log:
there are instances where when we format the date it gives the wrong date, this commit is to fix the issue 

Modified:
    webservices/axis2/trunk/java/modules/adb/src/org/apache/axis2/databinding/typemapping/SimpleTypeMapper.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=674447&r1=674446&r2=674447&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 Mon Jul  7 04:02:52 2008
@@ -288,9 +288,19 @@
             zulu.setTimeZone(TimeZone.getTimeZone("GMT"));
             return zulu.format(((Calendar)obj).getTime());
         } else if (obj instanceof Date) {
-            SimpleDateFormat zulu = new SimpleDateFormat("yyyy-MM-dd");
+            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");
 //            zulu.setTimeZone(TimeZone.getTimeZone("GMT"));
-            return zulu.format(obj);
+//            return zulu.format(obj);
         }
         return obj.toString();
     }