You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by ow <on...@yahoo.com> on 2003/05/30 16:03:05 UTC

java.util.Calendar - Why?

Hi,

Based on the documentation, it appears that xsd:dateTime is mapped to
java.util.Calendar. Why is that? Wouldn't java.util.Date make more sense?

Thanks




__________________________________
Do you Yahoo!?
Yahoo! Calendar - Free online calendar with sync to Outlook(TM).
http://calendar.yahoo.com

RE: java.util.Calendar - Why?

Posted by Mark Galbreath <ma...@qat.com>.
bullshit

-----Original Message-----
From: ow [mailto:oneway_111@yahoo.com] 
Sent: Friday, May 30, 2003 10:34 AM
To: axis-user@ws.apache.org
Subject: RE: java.util.Calendar - Why?


--- Mark Galbreath <ma...@qat.com> wrote:
> No.  java.util.Date has been deprecated since JDK 1.1 - take a look at 
> the API.
> 
> Mark

That is certainly not true. Contrary to some people's beliefs,
java.util.Date is alive and well in the latest JDK ;-) 






__________________________________
Do you Yahoo!?
Yahoo! Calendar - Free online calendar with sync to Outlook(TM).
http://calendar.yahoo.com



Re: sample code: using java.util.Date instead of java.util.Calendar

Posted by Dennis Sosnoski <dm...@sosnoski.com>.
 From the Schema specification, "dateTime represents a specific instant 
of time". Although a timezone-like offset from UTC is allowed in the 
representation of a dataTime value, as I understand it this is not part 
of the dateTime *value* - in other words, it's just a convenience that 
is meant to be stripped away during parsing of the value, just like 
leading zeroes on a number. This is implied by both the definition of 
dateTime and by the canonical representation, which does not allow an 
offset.

That makes the (non-deprecated) java.util.Date the closest match to a 
dateTime. The problem is that people keep trying to add timezone 
information (even though it's not supported by Schema), which is 
apparently why the JAX-RPC spec requires using Calendar instead. 
Calendar is specifically "for converting between a Date object and a set 
of integer fields such as YEAR, MONTH, DAY, HOUR, and so on", and 
requires a specific time zone and associated set of conversion rules in 
order to be meaningful. Trying to match up a Schema dateTime with a 
Calendar is ambiguous at best - for instance, what timezone do you 
attach to 2003-10-26T01:15:00-05:00 (which can be either 1:15 am CDT or 
1:15 am EST, if I got my math right).

I think this really is an error in the JAX-RPC spec, though I doubt 
they'll be willing to make a change. You know Schema better than I do, 
Stu - what do you think?

  - Dennis

Dennis M. Sosnoski
Enterprise Java, XML, and Web Services Support
http://www.sosnoski.com
Redmond, WA  425.885.7197


Stu Halloway (DevelopMentor) wrote:

>Hi,
>
>In response to "ow"s request for java.util.Date <-> xsd:dateTime
>conversion, I have written an Axis sample that uses a custom generator
>in WSDL2Java to bind dateTime to java.util.Date instead of
>java.util.Calendar. You can download the sample set at [1], the sample
>is called StaffLocator.
>
>Note: I am not endorsing (or condemning) this approach and I understand
>that this mapping is contra the JAX-RPC spec. It's just a sample. :-)
>
>Please let me know if there are better approaches or if there are other
>samples you would like to see.
>
>Stu
>
>[1] http://staff.develop.com/halloway/wsdlAndAxis/axisSamples.zip
>
>Stuart Halloway
>DevelopMentor
>Guerrilla Java Web Services June 16! 
>http://www.develop.com/courses/gjws 
>
>
>  
>


sample code: using java.util.Date instead of java.util.Calendar

Posted by "Stu Halloway (DevelopMentor)" <st...@develop.com>.
Hi,

In response to "ow"s request for java.util.Date <-> xsd:dateTime
conversion, I have written an Axis sample that uses a custom generator
in WSDL2Java to bind dateTime to java.util.Date instead of
java.util.Calendar. You can download the sample set at [1], the sample
is called StaffLocator.

Note: I am not endorsing (or condemning) this approach and I understand
that this mapping is contra the JAX-RPC spec. It's just a sample. :-)

Please let me know if there are better approaches or if there are other
samples you would like to see.

Stu

[1] http://staff.develop.com/halloway/wsdlAndAxis/axisSamples.zip

Stuart Halloway
DevelopMentor
Guerrilla Java Web Services June 16! 
http://www.develop.com/courses/gjws 



RE: java.util.Calendar - Why?

Posted by ow <on...@yahoo.com>.
--- Jess Sightler <js...@eximtechnologies.com> wrote:
> Ahem... I would complain had they not chosen to use Calendar. 
> Calendar.getTime() makes conversion to a Date object easy, and Calendar
> is much more powerful.  Date doesn't support TimeZones very well at all.

Why force people who do not need the power of Calendar to go through conversion
(say, 5000 records for every call)? People who want to use Calendar will also
have to go through conversion since you can't store Calendar in the database
and the rest of JDK expects Date all over the place, not Calendar.

Sounds like a very strange design choice to me.





__________________________________
Do you Yahoo!?
Yahoo! Calendar - Free online calendar with sync to Outlook(TM).
http://calendar.yahoo.com

RE: java.util.Calendar - Why?

Posted by Jess Sightler <js...@eximtechnologies.com>.
On Fri, 2003-05-30 at 13:58, ow wrote:
> --- Davanum Srinivas <di...@yahoo.com> wrote:
> > 
> > Apache Axis implements JAX-RPC 1.0 Spec. We cannot release a version of Axis
> > if we don't pass the
> > TCK (http://www.jcp.org/en/resources/tdk) for JAX-RPC 1.0. The specification
> > states that
> > xsd:dataTime be mapped to java.util.Calendar. If you have a problem with the
> > spec, there is a
> > JAXRPC-INTEREST mailing list at sun (http://archives.java.sun.com/).
> 
> Yes, this is bad since it means endless conversions between
> java.util.Date/java.sql.Date and the Calendar.
> 
> I'm surprised no one complained yet.

Ahem... I would complain had they not chosen to use Calendar. 
Calendar.getTime() makes conversion to a Date object easy, and Calendar
is much more powerful.  Date doesn't support TimeZones very well at all.

Of course, there's more pain involved than there would have been in
java.util.Date had been implemented RIGHT the first time, but that's a
whole different ballgame.  :-)



> 
> 
> 
> 
> 
> __________________________________
> Do you Yahoo!?
> Yahoo! Calendar - Free online calendar with sync to Outlook(TM).
> http://calendar.yahoo.com
-- 
=======================================
Jess Sightler
Senior Developer
Exim Technologies
131 Falls Street
Greenville SC 29601
Phone: 864-679-4651
=======================================




RE: java.util.Calendar - Why?

Posted by ow <on...@yahoo.com>.
--- Davanum Srinivas <di...@yahoo.com> wrote:
> 
> Apache Axis implements JAX-RPC 1.0 Spec. We cannot release a version of Axis
> if we don't pass the
> TCK (http://www.jcp.org/en/resources/tdk) for JAX-RPC 1.0. The specification
> states that
> xsd:dataTime be mapped to java.util.Calendar. If you have a problem with the
> spec, there is a
> JAXRPC-INTEREST mailing list at sun (http://archives.java.sun.com/).

Yes, this is bad since it means endless conversions between
java.util.Date/java.sql.Date and the Calendar.

I'm surprised no one complained yet.





__________________________________
Do you Yahoo!?
Yahoo! Calendar - Free online calendar with sync to Outlook(TM).
http://calendar.yahoo.com

RE: java.util.Calendar - Why?

Posted by Mark Galbreath <ma...@qat.com>.
I have no problem with the spec.  But others seem to....

-----Original Message-----
From: Davanum Srinivas [mailto:dims@yahoo.com] 
Sent: Friday, May 30, 2003 1:03 PM
To: axis-user@ws.apache.org
Subject: RE: java.util.Calendar - Why?


Mark,

Apache Axis implements JAX-RPC 1.0 Spec. We cannot release a version of Axis
if we don't pass the TCK (http://www.jcp.org/en/resources/tdk) for JAX-RPC
1.0. The specification states that xsd:dataTime be mapped to
java.util.Calendar. If you have a problem with the spec, there is a
JAXRPC-INTEREST mailing list at sun (http://archives.java.sun.com/).

Thanks,
dims

--- Mark Galbreath <ma...@qat.com> wrote:
> yeah, right.  You have one constructor and 2 methods.  Real useful, 
> dude.
> 
> -----Original Message-----
> From: Davanum Srinivas [mailto:dims@yahoo.com]
> Sent: Friday, May 30, 2003 11:53 AM
> To: axis-user@ws.apache.org
> Subject: RE: java.util.Calendar - Why?
> 
> 
> http://java.sun.com/xml/downloads/jaxrpc.html#jaxrpcspec1
> 
> --- Davanum Srinivas <di...@yahoo.com> wrote:
> > We do this because it is specified in the JAX-RPC 1.0 spec (See
> > section 4.2.1)
> > 
> > Thanks,
> > dims
> > 
> > --- ow <on...@yahoo.com> wrote:
> > > --- Mark Galbreath <ma...@qat.com> wrote:
> > > > No.  java.util.Date has been deprecated since JDK 1.1 - take a
> > > > look at the API.
> > > > 
> > > > Mark
> > > 
> > > That is certainly not true. Contrary to some people's beliefs,
> > > java.util.Date is alive and well in the latest JDK ;-)
> > > 
> > > 
> > > 
> > > 
> > > 
> > > 
> > > __________________________________
> > > Do you Yahoo!?
> > > Yahoo! Calendar - Free online calendar with sync to Outlook(TM).
> > > http://calendar.yahoo.com
> > 
> > 
> > =====
> > Davanum Srinivas - http://webservices.apache.org/~dims/
> > 
> > __________________________________
> > Do you Yahoo!?
> > Yahoo! Calendar - Free online calendar with sync to Outlook(TM).
> > http://calendar.yahoo.com
> 
> 
> =====
> Davanum Srinivas - http://webservices.apache.org/~dims/
> 
> __________________________________
> Do you Yahoo!?
> Yahoo! Calendar - Free online calendar with sync to Outlook(TM). 
> http://calendar.yahoo.com
> 
> 


=====
Davanum Srinivas - http://webservices.apache.org/~dims/

__________________________________
Do you Yahoo!?
The New Yahoo! Search - Faster. Easier. Bingo. http://search.yahoo.com



RE: java.util.Calendar - Why?

Posted by Davanum Srinivas <di...@yahoo.com>.
Mark,

Apache Axis implements JAX-RPC 1.0 Spec. We cannot release a version of Axis if we don't pass the
TCK (http://www.jcp.org/en/resources/tdk) for JAX-RPC 1.0. The specification states that
xsd:dataTime be mapped to java.util.Calendar. If you have a problem with the spec, there is a
JAXRPC-INTEREST mailing list at sun (http://archives.java.sun.com/).

Thanks,
dims

--- Mark Galbreath <ma...@qat.com> wrote:
> yeah, right.  You have one constructor and 2 methods.  Real useful, dude.
> 
> -----Original Message-----
> From: Davanum Srinivas [mailto:dims@yahoo.com] 
> Sent: Friday, May 30, 2003 11:53 AM
> To: axis-user@ws.apache.org
> Subject: RE: java.util.Calendar - Why?
> 
> 
> http://java.sun.com/xml/downloads/jaxrpc.html#jaxrpcspec1
> 
> --- Davanum Srinivas <di...@yahoo.com> wrote:
> > We do this because it is specified in the JAX-RPC 1.0 spec (See 
> > section 4.2.1)
> > 
> > Thanks,
> > dims
> > 
> > --- ow <on...@yahoo.com> wrote:
> > > --- Mark Galbreath <ma...@qat.com> wrote:
> > > > No.  java.util.Date has been deprecated since JDK 1.1 - take a 
> > > > look at the API.
> > > > 
> > > > Mark
> > > 
> > > That is certainly not true. Contrary to some people's beliefs, 
> > > java.util.Date is alive and well in the latest JDK ;-)
> > > 
> > > 
> > > 
> > > 
> > > 
> > > 
> > > __________________________________
> > > Do you Yahoo!?
> > > Yahoo! Calendar - Free online calendar with sync to Outlook(TM). 
> > > http://calendar.yahoo.com
> > 
> > 
> > =====
> > Davanum Srinivas - http://webservices.apache.org/~dims/
> > 
> > __________________________________
> > Do you Yahoo!?
> > Yahoo! Calendar - Free online calendar with sync to Outlook(TM). 
> > http://calendar.yahoo.com
> 
> 
> =====
> Davanum Srinivas - http://webservices.apache.org/~dims/
> 
> __________________________________
> Do you Yahoo!?
> Yahoo! Calendar - Free online calendar with sync to Outlook(TM).
> http://calendar.yahoo.com
> 
> 


=====
Davanum Srinivas - http://webservices.apache.org/~dims/

__________________________________
Do you Yahoo!?
The New Yahoo! Search - Faster. Easier. Bingo.
http://search.yahoo.com

RE: java.util.Calendar - Why?

Posted by Mark Galbreath <ma...@qat.com>.
yeah, right.  You have one constructor and 2 methods.  Real useful, dude.

-----Original Message-----
From: Davanum Srinivas [mailto:dims@yahoo.com] 
Sent: Friday, May 30, 2003 11:53 AM
To: axis-user@ws.apache.org
Subject: RE: java.util.Calendar - Why?


http://java.sun.com/xml/downloads/jaxrpc.html#jaxrpcspec1

--- Davanum Srinivas <di...@yahoo.com> wrote:
> We do this because it is specified in the JAX-RPC 1.0 spec (See 
> section 4.2.1)
> 
> Thanks,
> dims
> 
> --- ow <on...@yahoo.com> wrote:
> > --- Mark Galbreath <ma...@qat.com> wrote:
> > > No.  java.util.Date has been deprecated since JDK 1.1 - take a 
> > > look at the API.
> > > 
> > > Mark
> > 
> > That is certainly not true. Contrary to some people's beliefs, 
> > java.util.Date is alive and well in the latest JDK ;-)
> > 
> > 
> > 
> > 
> > 
> > 
> > __________________________________
> > Do you Yahoo!?
> > Yahoo! Calendar - Free online calendar with sync to Outlook(TM). 
> > http://calendar.yahoo.com
> 
> 
> =====
> Davanum Srinivas - http://webservices.apache.org/~dims/
> 
> __________________________________
> Do you Yahoo!?
> Yahoo! Calendar - Free online calendar with sync to Outlook(TM). 
> http://calendar.yahoo.com


=====
Davanum Srinivas - http://webservices.apache.org/~dims/

__________________________________
Do you Yahoo!?
Yahoo! Calendar - Free online calendar with sync to Outlook(TM).
http://calendar.yahoo.com



RE: java.util.Calendar - Why?

Posted by Davanum Srinivas <di...@yahoo.com>.
http://java.sun.com/xml/downloads/jaxrpc.html#jaxrpcspec1

--- Davanum Srinivas <di...@yahoo.com> wrote:
> We do this because it is specified in the JAX-RPC 1.0 spec (See section 4.2.1)
> 
> Thanks,
> dims
> 
> --- ow <on...@yahoo.com> wrote:
> > --- Mark Galbreath <ma...@qat.com> wrote:
> > > No.  java.util.Date has been deprecated since JDK 1.1 - take a look at the
> > > API.
> > > 
> > > Mark
> > 
> > That is certainly not true. Contrary to some people's beliefs, java.util.Date
> > is alive and well in the latest JDK ;-) 
> > 
> > 
> > 
> > 
> > 
> > 
> > __________________________________
> > Do you Yahoo!?
> > Yahoo! Calendar - Free online calendar with sync to Outlook(TM).
> > http://calendar.yahoo.com
> 
> 
> =====
> Davanum Srinivas - http://webservices.apache.org/~dims/
> 
> __________________________________
> Do you Yahoo!?
> Yahoo! Calendar - Free online calendar with sync to Outlook(TM).
> http://calendar.yahoo.com


=====
Davanum Srinivas - http://webservices.apache.org/~dims/

__________________________________
Do you Yahoo!?
Yahoo! Calendar - Free online calendar with sync to Outlook(TM).
http://calendar.yahoo.com

RE: java.util.Calendar - Why?

Posted by Davanum Srinivas <di...@yahoo.com>.
We do this because it is specified in the JAX-RPC 1.0 spec (See section 4.2.1)

Thanks,
dims

--- ow <on...@yahoo.com> wrote:
> --- Mark Galbreath <ma...@qat.com> wrote:
> > No.  java.util.Date has been deprecated since JDK 1.1 - take a look at the
> > API.
> > 
> > Mark
> 
> That is certainly not true. Contrary to some people's beliefs, java.util.Date
> is alive and well in the latest JDK ;-) 
> 
> 
> 
> 
> 
> 
> __________________________________
> Do you Yahoo!?
> Yahoo! Calendar - Free online calendar with sync to Outlook(TM).
> http://calendar.yahoo.com


=====
Davanum Srinivas - http://webservices.apache.org/~dims/

__________________________________
Do you Yahoo!?
Yahoo! Calendar - Free online calendar with sync to Outlook(TM).
http://calendar.yahoo.com

RE: java.util.Calendar - Why?

Posted by ow <on...@yahoo.com>.
--- Mark Galbreath <ma...@qat.com> wrote:
> No.  java.util.Date has been deprecated since JDK 1.1 - take a look at the
> API.
> 
> Mark

That is certainly not true. Contrary to some people's beliefs, java.util.Date
is alive and well in the latest JDK ;-) 






__________________________________
Do you Yahoo!?
Yahoo! Calendar - Free online calendar with sync to Outlook(TM).
http://calendar.yahoo.com

RE: java.util.Calendar - Why?

Posted by Mark Galbreath <ma...@qat.com>.
No.  java.util.Date has been deprecated since JDK 1.1 - take a look at the
API.

Mark

-----Original Message-----
From: ow [mailto:oneway_111@yahoo.com] 
Sent: Friday, May 30, 2003 10:03 AM
To: axis-user@ws.apache.org
Subject: java.util.Calendar - Why?


Hi,

Based on the documentation, it appears that xsd:dateTime is mapped to
java.util.Calendar. Why is that? Wouldn't java.util.Date make more sense?

Thanks




__________________________________
Do you Yahoo!?
Yahoo! Calendar - Free online calendar with sync to Outlook(TM).
http://calendar.yahoo.com