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

Unintentional IOException in jdk.jdi module when JDWP end of stream occurs

XMLWordPrintable

    • svc
    • b15

        The block of code in com.sun.tools.jdi.TargetVM has a logic error which leads to an IOException being raised every time the JDWP stream that it is parsing reaches the end of stream:

        public void run() {
                if ((vm.traceFlags & VirtualMachine.TRACE_SENDS) != 0) {
                    vm.printTrace("Target VM interface thread running");
                }
                Packet p=null,p2;
                String idString;

                while (shouldListen) {

                    boolean done = false;
                    try {
                        byte b[] = connection.readPacket();
                        if (b.length == 0) {
                            done = true;
                        }
                        p = Packet.fromByteArray(b);
                    } catch (IOException e) {
                        done = true;
                    }

        The fix for the unintentional IOException is to add an else case if the readPacket() returns 0 length

              yeren Yagmur Eren
              shadowbug Shadow Bug
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

                Created:
                Updated:
                Resolved: