why are people slow to put context into exception messages ? Is this temporary code ?

example :
src/java.base/share/classes/jdk/internal/jimage/ImageStringsReader.java
+        if (offset < 0 || offset >= bytes.length) {
+            throw new IndexOutOfBoundsException("offset");
+        }
+
+        int limit = offset + count;
+
+        if (limit < 0 || limit > bytes.length) {
+            throw new IndexOutOfBoundsException("limit");
+        }
can we print limit and bytes.length values ?

Regards,
Sean.

On 27/05/16 16:49, Alan Bateman wrote:


On 27/05/2016 16:12, Jim Laskey (Oracle) wrote:
http://cr.openjdk.java.net/~jlaskey/8156209/webrev/index.html
https://bugs.openjdk.java.net/browse/JDK-8156209
You might want to double check the range check in ImageStringsReader.hashCode as it looks like it allows count < 0. I assume what you want is:
    if (offset < 0 || count < 0 || offset > bytes.length - count) { ...}

-Alan.

Reply via email to