Author: jochen
Date: Wed May 17 17:53:36 2006
New Revision: 407419

URL: http://svn.apache.org/viewvc?rev=407419&view=rev
Log:
The XML-RPC specification demands, that no timezone specification is printed.

Modified:
    
webservices/xmlrpc/trunk/common/src/main/java/org/apache/xmlrpc/parser/DateParser.java
    
webservices/xmlrpc/trunk/common/src/main/java/org/apache/xmlrpc/serializer/DateSerializer.java

Modified: 
webservices/xmlrpc/trunk/common/src/main/java/org/apache/xmlrpc/parser/DateParser.java
URL: 
http://svn.apache.org/viewvc/webservices/xmlrpc/trunk/common/src/main/java/org/apache/xmlrpc/parser/DateParser.java?rev=407419&r1=407418&r2=407419&view=diff
==============================================================================
--- 
webservices/xmlrpc/trunk/common/src/main/java/org/apache/xmlrpc/parser/DateParser.java
 (original)
+++ 
webservices/xmlrpc/trunk/common/src/main/java/org/apache/xmlrpc/parser/DateParser.java
 Wed May 17 17:53:36 2006
@@ -17,7 +17,7 @@
 
 import java.text.ParseException;
 
-import org.apache.ws.commons.util.XsDateTimeFormat;
+import org.apache.ws.commons.util.XmlRpcDateTimeFormat;
 import org.xml.sax.SAXException;
 import org.xml.sax.SAXParseException;
 
@@ -25,7 +25,7 @@
 /** Parser for integer values.
  */
 public class DateParser extends AtomicParser {
-       private static final XsDateTimeFormat f = new XsDateTimeFormat();
+       private static final XmlRpcDateTimeFormat f = new 
XmlRpcDateTimeFormat();
 
        protected void setResult(String pResult) throws SAXException {
                try {

Modified: 
webservices/xmlrpc/trunk/common/src/main/java/org/apache/xmlrpc/serializer/DateSerializer.java
URL: 
http://svn.apache.org/viewvc/webservices/xmlrpc/trunk/common/src/main/java/org/apache/xmlrpc/serializer/DateSerializer.java?rev=407419&r1=407418&r2=407419&view=diff
==============================================================================
--- 
webservices/xmlrpc/trunk/common/src/main/java/org/apache/xmlrpc/serializer/DateSerializer.java
 (original)
+++ 
webservices/xmlrpc/trunk/common/src/main/java/org/apache/xmlrpc/serializer/DateSerializer.java
 Wed May 17 17:53:36 2006
@@ -15,6 +15,9 @@
  */
 package org.apache.xmlrpc.serializer;
 
+import java.util.Calendar;
+import java.util.Date;
+
 import org.apache.ws.commons.util.XmlRpcDateTimeFormat;
 import org.xml.sax.ContentHandler;
 import org.xml.sax.SAXException;
@@ -28,6 +31,16 @@
        public static final String DATE_TAG = "dateTime.iso8601";
        private static final XmlRpcDateTimeFormat format = new 
XmlRpcDateTimeFormat();
        public void write(ContentHandler pHandler, Object pObject) throws 
SAXException {
-               write(pHandler, DATE_TAG, format.format(pObject));
+           final Calendar cal;
+        if (pObject instanceof Calendar) {
+            cal = (Calendar) pObject;
+        } else if (pObject instanceof Date) {
+            cal = Calendar.getInstance();
+            cal.setTime((Date) pObject);
+        } else {
+            throw new IllegalStateException("Expected Calendar|Date, got "
+                    + pObject.getClass().getName());
+        }
+        write(pHandler, DATE_TAG, format.format(cal));
        }
-}
\ No newline at end of file
+}


Reply via email to