Always true condition in sun.nio.cs.CharsetMapping#readINDEXC2B

XMLWordPrintable

    • Type: Bug
    • Resolution: Fixed
    • Priority: P5
    • 22
    • Affects Version/s: 17, 21
    • Component/s: core-libs
    • None

      In the method 'sun.nio.cs.CharsetMapping#readINDEXC2B'

          void readINDEXC2B() {
              char[] map = readCharArray();
              for (int i = map.length - 1; i >= 0; i--) {
                  if (c2b == null && map[i] != -1) {
                      c2b = new char[map[i] + 256];
                      Arrays.fill(c2b, (char)UNMAPPABLE_ENCODING);
                      break;
                  }
              }
              c2bIndex = map;
          }

      Condition 'map[i] != -1' is always true. 'char' values range [0..65535]. It can't be equal to '-1'

            Assignee:
            Naoto Sato
            Reporter:
            Andrey Turbanov
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: