Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id 200FB1337B80 for ; Mon, 28 Feb 2011 09:21:53 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.251]) (amavisd-maia, port 10024) with ESMTP id 91101-03 for ; Mon, 28 Feb 2011 13:21:45 +0000 (UTC) Received: from news.hub.org (news.hub.org [200.46.204.72]) by mail.postgresql.org (Postfix) with ESMTP id 6B9941337B39 for ; Mon, 28 Feb 2011 09:21:45 -0400 (AST) Received: from news.hub.org (news.hub.org [200.46.204.72]) by news.hub.org (8.14.4/8.14.4) with ESMTP id p1SDLihf074424 for ; Mon, 28 Feb 2011 09:21:44 -0400 (AST) (envelope-from news@news.hub.org) Received: (from news@localhost) by news.hub.org (8.14.4/8.14.4/Submit) id p1SCu1Dm018406 for pgsql-jdbc@postgresql.org; Mon, 28 Feb 2011 08:56:01 -0400 (AST) (envelope-from news) From: Lew X-Newsgroups: pgsql.interfaces.jdbc Subject: Re: Failing test in org.postgresql.test.jdbc2.DateTest Date: Mon, 28 Feb 2011 07:56:08 -0500 Organization: albasani.net Lines: 39 Message-ID: References: <4D6538EA.8080905@mlfowler.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: news.albasani.net; logging-data="UbtJXeUqgD9nlrY6rut8oZuRT2PDzUum6gcgW+/3AqdZyYJl5HVf20M7kDjhJXPcQZ0fflliaqgXxzs/7sLLiZ45Bx/ZR78TpQFVI8ZMwcPkBJyJwDuf0xUKCmyv1ipl"; mail-complaints-to="abuse@albasani.net" User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.13) Gecko/20101208 Thunderbird/3.1.7 In-Reply-To: <4D6538EA.8080905@mlfowler.com> Cancel-Lock: sha1:yuypZfl6bZcvsMb6QKI0B0IBu/A= To: pgsql-jdbc@postgresql.org X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.91 tagged_above=-10 required=5 tests=BAYES_00=-1.9, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201102/156 X-Sequence-Number: 21554 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 String 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.