You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by bm...@apache.org on 2004/11/16 23:27:54 UTC
cvs commit: jakarta-lucene/src/java/org/apache/lucene/document DateTools.java
bmesser 2004/11/16 14:27:54
Modified: src/java/org/apache/lucene/document DateTools.java
Log:
change from cal.setTimeInMillis(long l) to cal.setTime(Date d) because cal.setTimeInMillis(...) was protected in JDK's prior to 1.4
Revision Changes Path
1.2 +11 -2 jakarta-lucene/src/java/org/apache/lucene/document/DateTools.java
Index: DateTools.java
===================================================================
RCS file: /home/cvs/jakarta-lucene/src/java/org/apache/lucene/document/DateTools.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- DateTools.java 5 Sep 2004 21:27:29 -0000 1.1
+++ DateTools.java 16 Nov 2004 22:27:54 -0000 1.2
@@ -63,7 +63,11 @@
*/
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 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);
---------------------------------------------------------------------
To unsubscribe, e-mail: lucene-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: lucene-dev-help@jakarta.apache.org