SF patch [2385187] Fix for toDate method in DCDateSF

git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@3367 9c30dcfa-912a-0410-8fc2-9e0234be79fd
This commit is contained in:
Stuart Lewis
2009-01-09 20:12:18 +00:00
parent 232d477130
commit 2213eb7e73
2 changed files with 53 additions and 3 deletions

View File

@@ -244,12 +244,59 @@ public class DCDate
*/ */
public Date toDate() public Date toDate()
{ {
GregorianCalendar utcGC = new GregorianCalendar(TimeZone int tmpmonth;
.getTimeZone("UTC")); int tmpday;
int tmphours;
int tmpmin;
int tmpsec;
utcGC.set(year, month - 1, day, hours, minutes, seconds); if (month < 0) {
// Month is unknown and set to -1
// but GregorianCalendar will interpret this as a rollback
// to December of the previous year
tmpmonth = 0;
}
else {
// Month is known, but GC calendar is 0 - 11, not 1 - 12
// so we'll do subtraction here
tmpmonth = month - 1;
}
if (day < 0) {
tmpday = 1;
}
else {
tmpday = day;
}
if (hours < 0) {
tmphours = 0;
}
else {
tmphours = hours;
}
if (minutes < 0) {
tmpmin = 0;
}
else {
tmpmin = minutes;
}
if (seconds < 0) {
tmpsec = 0;
}
else {
tmpsec = seconds;
}
GregorianCalendar utcGC = new GregorianCalendar(TimeZone
.getTimeZone("UTC"));
utcGC.set(year, tmpmonth, tmpday, tmphours, tmpmin, tmpsec);
return utcGC.getTime(); return utcGC.getTime();
} }
/** /**

View File

@@ -37,6 +37,9 @@
- Fixed small bug in XMLUI's org.dspace.app.xmlui.cocoon.DSpaceMETSGenerator which caused Repository-wide METS file to fail to generate. - Fixed small bug in XMLUI's org.dspace.app.xmlui.cocoon.DSpaceMETSGenerator which caused Repository-wide METS file to fail to generate.
- [2477820] DSpace 1.5 XMLUI - Enable METS <amdSec> using crosswalks - [2477820] DSpace 1.5 XMLUI - Enable METS <amdSec> using crosswalks
(Kim Shepherd)
- [2385187] Fix for toDate method in DCDate
1.5.1 final 1.5.1 final
=========== ===========