Thank you Lance!

Pushed.

Thanks,
Amy

On 2018/11/22 2:34 AM, Lance Andersen wrote:
Hi Amy,

The changes seem reasonable.

Best
Lance
On Nov 20, 2018, at 3:37 AM, Amy Lu <amy...@oracle.com <mailto:amy...@oracle.com>> wrote:

Please review.

Thanks,
Amy

On 2018/11/12 2:17 PM, Amy Lu wrote:
Please review this test fix for jdk/nio/zipfs/ZipFSTester.java

bug: https://bugs.openjdk.java.net/browse/JDK-8211266
webrev: http://cr.openjdk.java.net/~amlu/8211266/webrev.00/ <http://cr.openjdk.java.net/%7Eamlu/8211266/webrev.00/>

Testcase testStreamChannel fails when the given "bytes" length=0 (expected.length=0, and in such case, also sbc.size=0), from checkRead:

504    static void testStreamChannel() throws Exception {
...
536                 checkRead(path, bytes);
}

435    private static void checkRead(Path path, byte[] expected) throws IOException {
...
487               int pos = rdm.nextInt((int)sbc.size());
488               int len = rdm.nextInt(Math.min(buf.length, expected.length - pos));

This causing
java.lang.IllegalArgumentException: bound must be positive
at java.base/java.util.Random.nextInt(Random.java:388)
at ZipFSTester.checkRead(ZipFSTester.java:487)
at ZipFSTester.testStreamChannel(ZipFSTester.java:536)

It IS possible that (the given "bytes", byte[] expected) expected.length=0, which is generated by
    new byte[rdm.nextInt(8192)]

ZipFSTester::checkRead need to take this into account.

Thanks,
Amy




<http://oracle.com/us/design/oracle-email-sig-198324.gif>
<http://oracle.com/us/design/oracle-email-sig-198324.gif><http://oracle.com/us/design/oracle-email-sig-198324.gif>
<http://oracle.com/us/design/oracle-email-sig-198324.gif>Lance Andersen| Principal Member of Technical Staff | +1.781.442.2037
Oracle Java Engineering
1 Network Drive
Burlington, MA 01803
lance.ander...@oracle.com <mailto:lance.ander...@oracle.com>




Reply via email to