JDK-6989903 : (process) test/java/lang/ProcessBuilder/Basic.java failing with "Bad file number" (sol)
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.lang
  • Affected Version: 7
  • Priority: P4
  • Status: Closed
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2010-10-06
  • Updated: 2011-05-18
  • Resolved: 2011-05-18
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 7
7 b116Fixed
Related Reports
Relates :  
Description
The changes for 6981138 added a new test that closes the process output stream asynchronously, causing any threads reading from that stream to fail with an IOException.

The test expects the exception message to be "Bad file descriptor" but it should be "Bad file number".

Here's a sample failure on solaris-sparc:

$ java Basic
This appears to be a Unix system.
Testing ASCII environment values
Testing directory .
Testing directory ..
Testing directory /
Testing directory /bin
java.io.IOException: Bad file number
        at java.io.FileInputStream.readBytes(Native Method)
        at java.io.FileInputStream.read(FileInputStream.java:241)
        at java.lang.UNIXProcess$DeferredCloseInputStream.read(UNIXProcess.java:271)
        at java.io.BufferedInputStream.fill(BufferedInputStream.java:235)
        at java.io.BufferedInputStream.read(BufferedInputStream.java:254)
        at Basic$65.run(Basic.java:1844)

Passed = 9539, failed = 1

Exception in thread "main" java.lang.AssertionError: Some tests failed
        at Basic.main(Basic.java:2148)

Comments
EVALUATION The updated test doesn't appear to have been run on Solaris before it was pushed.
07-10-2010

SUGGESTED FIX diff -r b468b20a98a8 test/java/lang/ProcessBuilder/Basic.java --- a/test/java/lang/ProcessBuilder/Basic.java Tue Oct 05 15:07:40 2010 +0100 +++ b/test/java/lang/ProcessBuilder/Basic.java Wed Oct 06 12:25:25 2010 +0100 @@ -1845,7 +1845,7 @@ public class Basic { catch (IOException e) { // e.printStackTrace(); if (EnglishUnix.is() && - ! (e.getMessage().matches(".*Bad file descriptor.*"))) + ! (e.getMessage().matches(".*Bad file.*"))) unexpected(e); } catch (Throwable t) { unexpected(t); }}};
06-10-2010