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: [email protected]
For additional commands, e-mail: [email protected]