Skip to content

Apache Lucene open-source search software

improve exception message

Daniel Naberc73de87a8f52
diff --git a/src/java/org/apache/lucene/document/DateField.java b/src/java/org/apache/lucene/document/DateField.java
index 02a2c1bf7e6..c1132adf55f 100644
--- a/src/java/org/apache/lucene/document/DateField.java
+++ b/src/java/org/apache/lucene/document/DateField.java
@@ -76,12 +76,13 @@ public class DateField {
*/
public static String timeToString(long time) {
if (time < 0)
- throw new RuntimeException("time too early");
+ throw new RuntimeException("time '" + time + "' is too early, must be >= 0");
String s = Long.toString(time, Character.MAX_RADIX);
if (s.length() > DATE_LEN)
- throw new RuntimeException("time too late");
+ throw new RuntimeException("time '" + time + "' is too late, length of string " +
+ "representation must be <= " + DATE_LEN);
// Pad with leading zeros
if (s.length() < DATE_LEN) {