Uploaded image for project: 'Byteman'
  1. Byteman
  2. BYTEMAN-57

potential NPE

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 1.2.0
    • 1.1.1
    • None
    • None

      I see this in two places in Submit:

      String line = in.readLine().trim();
      while (line != null & !line.equals("OK")) {

      Note that because of the use of trim() in the declaration, line will never be null. in.readLine() may return null, but the trim() call will force a NullPointerException when that happens, and the try-catch doesn't handle that.

      Solution - test the return value of in.readLine() before doing anything, such as trim().

            rhn-engineering-adinn Andrew Dinn
            jmazzitelli John Mazzitelli
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: