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

Redundant null check in LineNumberInputStream.read

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P5 P5
    • 19
    • None
    • core-libs
    • None
    • b10

      At start of method, parameter 'b' is compared with null and NPE is thrown in case of null.

          public int read(byte[] b, int off, int len) throws IOException {
              if (b == null) {
                  throw new NullPointerException();

      But later variable is compared is null again

                      if (b != null) {
                          b[off + i] = (byte)c;
                      }

      Redundant check could be removed.

            aturbanov Andrey Turbanov
            aturbanov Andrey Turbanov
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: