improve exception message

git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@380207 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Daniel Naber 2006-02-23 19:53:26 +00:00
parent 02033e26bb
commit c73de87a8f
1 changed files with 3 additions and 2 deletions

View File

@ -76,12 +76,13 @@ public class DateField {
*/ */
public static String timeToString(long time) { public static String timeToString(long time) {
if (time < 0) 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); String s = Long.toString(time, Character.MAX_RADIX);
if (s.length() > DATE_LEN) 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 // Pad with leading zeros
if (s.length() < DATE_LEN) { if (s.length() < DATE_LEN) {