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

dataInputStream.readLine throws IOException when looking at process output

    Details

    • Subcomponent:
    • CPU:
      sparc
    • OS:
      solaris_2.5

      Description

      the file below seems to indicate a problem with datainputStream.readLine's handling of EOF conditions. Contact ###@###.### for more information.


      import java.io.*;

      public class TestExec {
         public static void main(String args[]) {
      Runtime runtime;
      Process process;
      InputStream dinputStream;
      BufferedInputStream bufferedInputStream;
      DataInputStream dataInputStream;
      String line;
      line=new String();

      runtime = Runtime.getRuntime();

      try {
      process = runtime.exec("pwd");
      }
      catch (IOException e) {
      System.out.println("IOException doing exec.");
      return;
      }

      dinputStream = process.getInputStream();
      bufferedInputStream = new BufferedInputStream(dinputStream);
      dataInputStream = new DataInputStream(bufferedInputStream);

      do {
      try {
      line = dataInputStream.readLine();
           }

      catch (IOException e) {
      System.out.println("IOException doing readLine.");
         line = null;

      }
      if (line != null) {
      System.out.println(line);
      }
      } while (line != null);
         }
      }

                      

        Attachments

          Activity

            People

            • Assignee:
              djbrown David Brown (Inactive)
              Reporter:
              bhagen Benjamin Hagen (Inactive)
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Imported:
                Indexed: