[12] RFR JDK-8211266: [TESTBUG] jdk/nio/zipfs/ZipFSTester.java failed intermittently in ZipFSTester.checkRead()

Lance Andersen lance.andersen at oracle.com
Wed Nov 21 18:34:11 UTC 2018


Hi Amy,

The changes seem reasonable.

Best
Lance
> On Nov 20, 2018, at 3:37 AM, Amy Lu <amy.lu at 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/
>> 
>> 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.Andersen at oracle.com <mailto:Lance.Andersen at oracle.com>





More information about the core-libs-dev mailing list