From fc6694ef9d6f65c56ac773dfc3350191394171db Mon Sep 17 00:00:00 2001 From: Bernhard Messer Date: Tue, 16 Nov 2004 22:27:54 +0000 Subject: [PATCH] change from cal.setTimeInMillis(long l) to cal.setTime(Date d) because cal.setTimeInMillis(...) was protected in JDK's prior to 1.4 git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@150645 13f79535-47bb-0310-9956-ffa450edef68 --- src/java/org/apache/lucene/document/DateTools.java | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/java/org/apache/lucene/document/DateTools.java b/src/java/org/apache/lucene/document/DateTools.java index da1ae669ed9..d1095ed1837 100644 --- a/src/java/org/apache/lucene/document/DateTools.java +++ b/src/java/org/apache/lucene/document/DateTools.java @@ -63,7 +63,11 @@ public class DateTools { */ public static String timeToString(long time, Resolution resolution) { Calendar cal = Calendar.getInstance(); - cal.setTimeInMillis(round(time, resolution)); + + //protected in JDK's prior to 1.4 + //cal.setTimeInMillis(round(time, resolution)); + + cal.setTime(new Date(round(time, resolution))); SimpleDateFormat sdf = new SimpleDateFormat(); String pattern = null; @@ -160,7 +164,12 @@ public class DateTools { */ public static long round(long time, Resolution resolution) { Calendar cal = Calendar.getInstance(); - cal.setTimeInMillis(time); + + // protected in JDK's prior to 1.4 + //cal.setTimeInMillis(time); + + cal.setTime(new Date(time)); + if (resolution == Resolution.YEAR) { cal.set(Calendar.MONTH, 0); cal.set(Calendar.DAY_OF_MONTH, 1);