Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4811767

(process) Runtime.exec should throw IOException when workdir does not exist (Unix)

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 6
    • 1.3.0, 1.4.2
    • core-libs
    • b81
    • sparc
    • solaris, solaris_7, solaris_8

      Runtime.Exec() freeze when we specify non-exist directory in arg list.

      REPRODUCE:
       1. Compile the below program

      ===>
      import java.io.*;
      public class Exec {
          public static void main( String argv[] ) {
              try {
                  File path = new File("/export/home/java/nosuchdir");
                                 // Specify non-exist dir.
                  Process process = Runtime.getRuntime().exec( argv, null, path );

                  BufferedReader br = new BufferedReader(
                      new InputStreamReader(
                          process.getInputStream() ) );
                  String line;
                  while( (line = br.readLine()) != null )
                      System.out.println( line );

              }
              catch( IndexOutOfBoundsException e ) {
                  System.err.println( "Usage:java ExecTest command [args...]" );
                  System.exit(-1);
              }
              catch( Exception e ){
                  System.err.println( "Error:" + e.toString() );
                  System.exit(-1);
              }
          }
      }
      <===

       2. Launch the "java Exec ls"
          (This command line try to "ls" command under the specified directory)

        Here, no response returns.


      Note:
        - When the non-exist directory is specified, an exception should be thrown
          freeze should not occur.
        - When existing directory is specified, the "ls" command is execute
          correctly.


      CONFIGRATION:
         OS : Solaris 7, 8
         JDK: 1.4.1-b21/1.4.2-beta-b13
         

      ===========================================================================

            martin Martin Buchholz
            tbaba Tadayuki Baba (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: