From: | Mike Fowler <mike(at)mlfowler(dot)com> |
---|---|
To: | pgsql-jdbc(at)postgresql(dot)org |
Subject: | Failing test in org.postgresql.test.jdbc2.DateTest |
Date: | 2011-02-23 16:42:18 |
Message-ID: | 4D6538EA.8080905@mlfowler.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-jdbc |
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"
So it appears that the method now implements the API largely correctly,
however as you can see above a single digit date is still accepted.
Given that the API seems unchanged for so long, I'd recommend changing
the tests to reflect the API.
I've attached a patch to do just that and it's been tested with the
following JDKs:
1.4.2_19
1.5.0_22
1.6.0_21
Regards,
--
Mike Fowler
Registered Linux user: 379787
Attachment | Content-Type | Size |
---|---|---|
dateTest.patch | text/x-diff | 2.7 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Mike Fowler | 2011-02-23 18:30:58 | Re: Failing test in org.postgresql.test.jdbc2.DateTest |
Previous Message | Maurin, Marion | 2011-02-22 13:40:02 | Re: PGXAConnection and autocommit problem |