title: BufferedReader input attempt from System.in throwing exceptions
body: <p>I am trying to read a from the input using BufferedReader. It works the first time but the second time it is ran I get an exception.</p>
  
  <pre><code>john@fekete:~/devel/java/pricecalc$ java frontend.CUI 
  &gt; gsdfgd
  Invalid command!
  &gt; I/O Error getting string:  java.io.IOException: Stream closed
  I/O Error: java.io.IOException: java.io.IOException: Stream closed
  &gt; I/O Error getting string:  java.io.IOException: Stream closed
  I/O Error: java.io.IOException: java.io.IOException: Stream closed
  &gt; I/O Error getting string:  java.io.IOException: Stream closed
  </code></pre>
  
  <p>It just keeps running with that in a loop. I must have missed something.</p>
  
  <pre><code>public static void main(String args[]) {
              if (args.length == 0) {
                      while (!exit) {
                              try {
                                      exit = processLine(commandLine());
                              } catch (IOException e) {
                                      System.out.println("I/O Error: " + e);
                              }
                      }
                      System.out.println("Bye!");
              } else if (args.length == 1) {
                      String line = new String(args[0]);
                      processLine(line);
              } else {
                      String line = new String(args[0]);
                      for (String np : args) {
                              line = new String(line + " " + np); 
                      }
                      processLine(line);
              }
      }
  
      static private String commandLine() throws IOException {
              String str = new String();
              try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {
                      System.out.print("&gt; ");
                      str = new String(br.readLine());
                      str = str.trim();
              } catch (IOException e) {
                      System.out.println("I/O Error getting string: "+ str + " " + e);
                      throw new IOException(e);
              }
  
              return str;
      }
  </code></pre>
  
  <p>It really all seems to be about commandLine() not working so I've just included that and main.</p>