6989903: (process) test/java/lang/ProcessBuilder/Basic.java failing with "Bad file number" (sol)

Chris Hegarty chris.hegarty at oracle.com
Wed Oct 6 19:20:05 UTC 2010


Alan Bateman wrote:
> 
> The fix for 6981138 a few weeks ago added another test to 
> test/java/lang/ProcessBuilder/Basic.java. That test is failing on 
> Solaris because the asynchronous close of the stream connected to the 
> child's stdout causes the reader thread to throw an IOException with an 
> exception message that the test doesn't expect. In en.* locales, it 
> assumes the exception message will be "Bad file descriptor" but it's 
> actually "Bad file number" on Solaris. It's always fragile to have tests 
> that look at the exception message and it is tempting to just remove 
> these checks. However this test does go out of its way to catch any 
> change in behavior so for now anyway, I just propose make it a bit less 
> fussy.

As you say, it's not ideal to have tests that depend on the exception 
message, but for now this change looks fine.

-Chris.

> 
> Thanks,
> 
> -Alan.
> 
> 
> 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); }}};



More information about the core-libs-dev mailing list