pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Lew <noone@lewscanon.com>
To: pgsql-jdbc@postgresql.org
Subject: Re: Failing test in org.postgresql.test.jdbc2.DateTest
Date: Mon, 28 Feb 2011 07:56:08 -0500
Message-ID: <ikg611$he7$1@news.albasani.net> (raw)
In-Reply-To: <4D6538EA.8080905@mlfowler.com>
References: <4D6538EA.8080905@mlfowler.com>

On 02/23/2011 11:42 AM, Mike Fowler wrote:
> Hi all,
>
> I have just pulled out the source from CVS and run the build and test and
> found a failure in the class noted in the subject. Specifically the test that
> fails is:
>
> 79 public void testSetDate() throws SQLException
> 80 {
> ...
> 111 ps.setObject(1, "1969-04-3", java.sql.Types.DATE);
> 112 assertEquals(1, ps.executeUpdate());
> ...
> 120 ps.setObject(1, java.sql.Date.valueOf("1912-5-1"), java.sql.Types.DATE);
> 121 assertEquals(1, ps.executeUpdate());
> ...
>
> This only fails in my JDK 1.6 - it passes in 1.5. Looking at the java.sql.Date
> in the two source jars I have it's easy to see that the valueOf method has
> been completely rewritten in 1.6 (well, at least 1.6.0_21 possibly earlier).
> Having looked at the API documentation has remained unchanged in 1.3, 1.4, 1.5
> and 1.6 (1.2 I couldn't find by guessing) and reads:
>
> * @param s a <code>String</code> object representing a date in
> * in the format "yyyy-mm-dd"

The Java 7 docs say:
"s - a String object representing a date in in the format "yyyy-[m]m-[d]d". 
The leading zero for mm and dd may also be omitted."
http://download.oracle.com/javase/7/docs/api/java/sql/Date.html

So the java.sql.Date does accept single-digit month and day, at least for Java 7.

All the work you did to reject single-digit month and day are not correct, if 
that's what you did.

-- 
Lew
Honi soit qui mal y pense.



view thread (6+ messages)  latest in thread

Message-ID: <ikg611$he7$1@news.albasani.net>
Permalink:  ../ikg611$he7$1@news.albasani.net/
Also on:    postgresql.org/message-id/ikg611$he7$1@news.albasani.net

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-jdbc@postgresql.org
  Cc: noone@lewscanon.com
  Subject: Re: Failing test in org.postgresql.test.jdbc2.DateTest
  In-Reply-To: <ikg611$he7$1@news.albasani.net>
  References: <4D6538EA.8080905@mlfowler.com> <ikg611$he7$1@news.albasani.net>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox