butek 2002/06/21 06:00:30
Modified: java TODO.txt
java/src/org/apache/axis/encoding
DefaultTypeMappingImpl.java
java/src/org/apache/axis/encoding/ser
CalendarDeserializer.java CalendarSerializer.java
java/src/org/apache/axis/utils JavaUtils.java
java/test/wsdl/roundtrip RoundtripPortType.java
RoundtripTestServiceTestCase.java
RoundtripTestSoapBindingImpl.java
Log:
TCK/JAX-RPC: according to the spec, both Date and Calendar should map
to xsd:dateTime.
This also fixes http://nagoya.apache.org/bugzilla/show_bug.cgi?id=9767.
Revision Changes Path
1.61 +2 -2 xml-axis/java/TODO.txt
Index: TODO.txt
===================================================================
RCS file: /home/cvs/xml-axis/java/TODO.txt,v
retrieving revision 1.60
retrieving revision 1.61
diff -u -r1.60 -r1.61
--- TODO.txt 19 Jun 2002 20:13:55 -0000 1.60
+++ TODO.txt 21 Jun 2002 13:00:30 -0000 1.61
@@ -31,12 +31,12 @@
M 9405 - must - Tom
_ 9452 - post
_ 9473 - post
-_ 9642 - nice - Russell
+* 9642 - nice - Russell
_ 9659 - pend - Glen
_ 9665 - nice - Rich
_ 9667 - dup of 9665
M 9717 - must - Tom
-M 9767 - must - Russell
+* 9767 - must - Russell
_ 9773 - post
M 9780 - must - Rick
_ 9815 - nice - ?
1.33 +6 -0
xml-axis/java/src/org/apache/axis/encoding/DefaultTypeMappingImpl.java
Index: DefaultTypeMappingImpl.java
===================================================================
RCS file:
/home/cvs/xml-axis/java/src/org/apache/axis/encoding/DefaultTypeMappingImpl.java,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -r1.32 -r1.33
--- DefaultTypeMappingImpl.java 19 Jun 2002 16:13:17 -0000 1.32
+++ DefaultTypeMappingImpl.java 21 Jun 2002 13:00:30 -0000 1.33
@@ -280,6 +280,12 @@
new DateDeserializerFactory(java.util.Date.class,
Constants.XSD_DATE1),
true);
+ myRegister(Constants.XSD_DATE, java.util.Date.class,
+ new CalendarSerializerFactory(java.util.Date.class,
+ Constants.XSD_DATE),
+ new CalendarDeserializerFactory(java.util.Date.class,
+ Constants.XSD_DATE),
+ true);
myRegister(Constants.XSD_DATE, java.util.Calendar.class,
new CalendarSerializerFactory(java.util.Calendar.class,
Constants.XSD_DATE),
1.3 +7 -2
xml-axis/java/src/org/apache/axis/encoding/ser/CalendarDeserializer.java
Index: CalendarDeserializer.java
===================================================================
RCS file:
/home/cvs/xml-axis/java/src/org/apache/axis/encoding/ser/CalendarDeserializer.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- CalendarDeserializer.java 11 Jun 2002 14:53:55 -0000 1.2
+++ CalendarDeserializer.java 21 Jun 2002 13:00:30 -0000 1.3
@@ -196,7 +196,12 @@
if (bc) {
calendar.set(Calendar.ERA, GregorianCalendar.BC);
}
-
- return calendar;
+
+ if (super.javaType == Date.class) {
+ return date;
+ }
+ else {
+ return calendar;
+ }
}
}
1.5 +2 -2
xml-axis/java/src/org/apache/axis/encoding/ser/CalendarSerializer.java
Index: CalendarSerializer.java
===================================================================
RCS file:
/home/cvs/xml-axis/java/src/org/apache/axis/encoding/ser/CalendarSerializer.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- CalendarSerializer.java 19 Jun 2002 15:39:20 -0000 1.4
+++ CalendarSerializer.java 21 Jun 2002 13:00:30 -0000 1.5
@@ -97,8 +97,8 @@
{
context.startElement(name, attributes);
- Calendar calendar = (Calendar) value;
- Date date = calendar.getTime();
+ Date date = value instanceof Date ? (Date) value : ((Calendar)
value).getTime();
+
// Sun JDK bug
http://developer.java.sun.com/developer/bugParade/bugs/4229798.html
String format = null;
synchronized (zulu) {
1.50 +7 -0 xml-axis/java/src/org/apache/axis/utils/JavaUtils.java
Index: JavaUtils.java
===================================================================
RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/utils/JavaUtils.java,v
retrieving revision 1.49
retrieving revision 1.50
diff -u -r1.49 -r1.50
--- JavaUtils.java 19 Jun 2002 16:13:18 -0000 1.49
+++ JavaUtils.java 21 Jun 2002 13:00:30 -0000 1.50
@@ -64,6 +64,8 @@
import java.text.Collator;
import java.text.MessageFormat;
import java.util.Arrays;
+import java.util.Calendar;
+import java.util.Date;
import java.util.Locale;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
@@ -216,6 +218,11 @@
} else if (arg instanceof byte[] &&
destClass == Hex.class) {
return new Hex((byte[]) arg);
+ }
+
+ // Convert between Calendar and Date
+ if (arg instanceof Calendar && destClass == Date.class) {
+ return ((Calendar) arg).getTime();
}
1.7 +3 -0 xml-axis/java/test/wsdl/roundtrip/RoundtripPortType.java
Index: RoundtripPortType.java
===================================================================
RCS file: /home/cvs/xml-axis/java/test/wsdl/roundtrip/RoundtripPortType.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- RoundtripPortType.java 18 Jun 2002 15:33:21 -0000 1.6
+++ RoundtripPortType.java 21 Jun 2002 13:00:30 -0000 1.7
@@ -95,12 +95,15 @@
throws java.rmi.RemoteException;
public java.util.Calendar methodDateTime(java.util.Calendar inDateTime)
throws java.rmi.RemoteException;
+ public java.util.Date methodDate(java.util.Date inDateTime)
+ throws java.rmi.RemoteException;
public byte[] methodByteArray(byte[] inByteArray)
throws java.rmi.RemoteException;
public void methodAllTypesIn(java.lang.String string,
java.math.BigInteger integer,
java.math.BigDecimal decimal,
java.util.Calendar dateTime,
+ java.util.Date date,
boolean _boolean,
byte _byte,
short _short,
1.13 +28 -0
xml-axis/java/test/wsdl/roundtrip/RoundtripTestServiceTestCase.java
Index: RoundtripTestServiceTestCase.java
===================================================================
RCS file:
/home/cvs/xml-axis/java/test/wsdl/roundtrip/RoundtripTestServiceTestCase.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- RoundtripTestServiceTestCase.java 18 Jun 2002 15:33:21 -0000 1.12
+++ RoundtripTestServiceTestCase.java 21 Jun 2002 13:00:30 -0000 1.13
@@ -756,6 +756,7 @@
new BigInteger("545"),
new BigDecimal("546.545"),
dateTime,
+ dateTime,
true,
(byte) 2,
(short) 14,
@@ -823,6 +824,33 @@
}
} // testMethodDateTime
+
+ /**
+ * Just do the same thing that testMethodDateTime does. The REAL
+ * test here is a compile test. Both Calendar and Date map to
+ * xsd:dateTime. The original SEI in this roundtrip test contained
+ * method: "Date methodDate(Date)". But taking that Java -> WSDL ->
+ * Java should result in: "Calendar methodDate(Calendar)". If that
+ * didn't happen, then the compile would fail.
+ */
+ public void testMethodDate() {
+
+ try {
+ Calendar expected = Calendar.getInstance();
+ TimeZone gmt = TimeZone.getTimeZone("GMT");
+ expected.setTimeZone(gmt);
+ expected.setTime(new Date(1012937861800L));
+ Calendar parameter = Calendar.getInstance();
+ parameter.setTimeZone(gmt);
+ parameter.setTime(new Date(1012937861996L));
+ Calendar actual = binding.methodDate(parameter);
+ assertEquals("The expected and actual values did not match.",
+ expected,
+ actual);
+ } catch (RemoteException re) {
+ fail("Remote Exception caught: " + re);
+ }
+ } // testMethodDate
/**
* Test to insure that a BigDecimal matches the expected values on
1.12 +5 -0
xml-axis/java/test/wsdl/roundtrip/RoundtripTestSoapBindingImpl.java
Index: RoundtripTestSoapBindingImpl.java
===================================================================
RCS file:
/home/cvs/xml-axis/java/test/wsdl/roundtrip/RoundtripTestSoapBindingImpl.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- RoundtripTestSoapBindingImpl.java 18 Jun 2002 15:33:21 -0000 1.11
+++ RoundtripTestSoapBindingImpl.java 21 Jun 2002 13:00:30 -0000 1.12
@@ -392,6 +392,7 @@
BigInteger in1,
BigDecimal in2,
Calendar in35,
+ Calendar in36,
boolean in4,
byte in5,
short in6,
@@ -469,6 +470,10 @@
}
} // methodDateTime
+
+ public Calendar methodDate(Calendar in0) throws RemoteException {
+ return methodDateTime(in0);
+ } // methodDate
public BigDecimal methodBigDecimal(BigDecimal in0) throws RemoteException {