JDK-8211266 : (zipfs) [TESTBUG] ZipFSTester.java failed intermittently in ZipFSTester.checkRead(): bound must be positive
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.nio
  • Affected Version: 11,12
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2018-09-28
  • Updated: 2021-11-19
  • Resolved: 2018-11-22
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 11 JDK 12
11.0.4Fixed 12 b22Fixed
Related Reports
Relates :  
Description
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)
	at ZipFSTester.main(ZipFSTester.java:98)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at com.sun.javatest.regtest.agent.MainActionHelper$AgentVMRunnable.run(MainActionHelper.java:246)
	at java.base/java.lang.Thread.run(Thread.java:835)

JavaTest Message: Test threw exception: java.lang.IllegalArgumentException
JavaTest Message: shutting down test

result: Failed. Execution failed: `main' threw exception: java.lang.IllegalArgumentException: bound must be positive

Comments
Fix Request This stabilizes the test from JDK-8034802 that is already backported. Patch applies cleanly to 11u. jdk/nio/zipfs tests pass.
10-04-2019

URL: http://hg.openjdk.java.net/jdk/jdk/rev/148124c951fd User: amlu Date: 2018-11-22 02:31:35 +0000
22-11-2018

RFR: http://mail.openjdk.java.net/pipermail/core-libs-dev/2018-November/056567.html
12-11-2018

This is a test bug in testcase testStreamChannel from method checkRead: 504 static void testStreamChannel() throws Exception { ... 536 checkRead(path, bytes); //// =====>>>>>> When the given "bytes" length=0 } the expected.length=0, and in such case, also sbc.size=0, and this causing IAE from below calls: 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)); 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) And since the test data (the given "bytes" byte[]) is generated by: new byte[rdm.nextInt(8192)] It is possible that the length is 0. ZipFSTester::checkRead need to take this into account.
12-11-2018