db-torque-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Scott Eade (JIRA)" <j...@apache.org>
Subject [jira] Commented: (TORQUE-133) DataSetException/IllegalArgumentException when saving a java.util.Date with jre1.6.0_18
Date Tue, 09 Feb 2010 10:49:28 GMT

    [ https://issues.apache.org/jira/browse/TORQUE-133?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12831407#action_12831407
] 

Scott Eade commented on TORQUE-133:
-----------------------------------

I too have encountered this with jre1.6.0_18 (it does not occur with 1.6.0_17-b04) on Linux.

According to http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6898593 this represents a
fix to a long outstanding bug, thus we should fix Village - tut tut Jon Stevens :-)

Perhaps a better fix would be to add a leading zero when necessary to the MONTH and DAY_OF_MONTH
and continue to use valueOf()

Scott

> DataSetException/IllegalArgumentException when saving a java.util.Date with jre1.6.0_18
> ---------------------------------------------------------------------------------------
>
>                 Key: TORQUE-133
>                 URL: https://issues.apache.org/jira/browse/TORQUE-133
>             Project: Torque
>          Issue Type: Bug
>          Components: Village
>    Affects Versions: 3.3
>         Environment: OS: Windows XP / Windows 7
> Java SE 6 Update 18 (1.6.0_18-b07)
> Torque 3.3, Village 3.3
> JDBC: postgresql-8.4-701.jdbc4.jar
>            Reporter: Georg Marx
>
> When I try to save a java.util.Date I get an IllegalArgumentException in class com.workingdogs.village.Value.java(1256).
> Because in jre1.6.0_18 the month/day-check in java.sql.Date.valueOf() has changed. (Version
jre1.6.0_13 is working. Update 14 to 17 I have not tested)
> In this version java.sql.Date.valueOf() checks if the month and day part of a date-string
(2010-1-25) has a charlength of 2.
> But in Value.java it generates a date-string like "1010-2-1". Correct is "2010-02-01".
> Affected code:
> cal.setTime((java.util.Date) valueObject);
> return java.sql.Date.valueOf(cal.get(Calendar.YEAR) + "-" + 
>           (cal.get(Calendar.MONTH) + 1) + "-"
>           + cal.get(Calendar.DAY_OF_MONTH));
> Patch:
> return new java.sql.Date(((java.util.Date) valueObject).getTime());
> This Patch worked for me in jre1.6.0_13 and jre1.6.0_18
> I think the lines 1248-1250, 1315-1317 and 1323-1325 are also affected.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: torque-dev-unsubscribe@db.apache.org
For additional commands, e-mail: torque-dev-help@db.apache.org


Mime
View raw message