Uploaded image for project: 'Code Tools'
  1. Code Tools
  2. CODETOOLS-6746050

Bug in AgentWriter.write(int) can cause TCK failures

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • jt5.0
    • jt3.2.1
    • tools
    • fcs
    • b36
    • other
    • other
    • Verified

      CDC-HI bug #6414216 is a result of a bug in javatest. The CDC TCK exceptions03103.java test intentionally is recursive until a StackOverflowError is reached. On each recursive call, it does a out.println, with data like the following:

      ...
      Test at depth 3216
      Test at depth 3217
      Test at depth 3218
      Test at depth 3219
      Test at depth 3220
      Test at depth 3221
      Test at depth 3222
      Test at depth 3223
      ...

      The out.println call eventually ends up in AgentWriter.write(int ch), which does the following:

          public synchronized void write(int ch) throws IOException {
      buf[count++] = (char)ch;
      if (count == buf.length) {
      parent.sendChars(type, buf, 0, count);
      count = 0;
      }
          }

      Because the TCK test is trying to force a StackOverflowError, there is a very good chance that one can happen during the call to parent.sendChars. If it does, then count is never reset to 0, so the next time write(int ch) is called you get an ArrayIndexOutOfBoundsException. count should be reset to 0 before the sendChars() call.

            afedorch Alexey Fedorchenko (Inactive)
            cjplummer Chris Plummer
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: