--- a/jdk/src/share/classes/java/lang/NumberFormatException.java Thu Jul 17 11:08:50 2014 -0700
+++ b/jdk/src/share/classes/java/lang/NumberFormatException.java Sat Jul 12 01:36:25 2014 +0200
@@ -56,7 +56,7 @@
}
/**
- * Factory method for making a <code>NumberFormatException</code>
+ * Factory method for making a {@code NumberFormatException}
* given the specified input which caused the error.
*
* @param s the input causing the error
@@ -64,4 +64,20 @@
static NumberFormatException forInputString(String s) {
return new NumberFormatException("For input string: \"" + s + "\"");
}
+
+ /**
+ * Factory method for making a {@code NumberFormatException}
+ * given the specified input which caused the error.
+ *
+ * @param s the input causing the error
+ * @param beginIndex the beginning index, inclusive.
+ * @param endIndex the ending index, exclusive.
+ * @param errorIndex the index of the first error in s
+ */
+ static NumberFormatException forCharSequence(CharSequence s,
+ int beginIndex, int endIndex, int errorIndex) {
+ return new NumberFormatException("Error at index "
+ + (errorIndex - beginIndex) + " in: \""
+ + s.subSequence(beginIndex, endIndex) + "\"");
+ }
}