test/hotspot/jtreg/serviceability/jdwp/JdwpReply.java
changeset 49328 6a86f0deb479
parent 47216 71c04702a3d5
equal deleted inserted replaced
49327:8f63fb7788bb 49328:6a86f0deb479
     1 /*
     1 /*
     2  * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.
     7  * published by the Free Software Foundation.
    45         ds.read(errCode, 0, 2);
    45         ds.read(errCode, 0, 2);
    46 
    46 
    47         int dataLength = length - HEADER_LEN;
    47         int dataLength = length - HEADER_LEN;
    48         if (dataLength > 0) {
    48         if (dataLength > 0) {
    49             data = new byte[dataLength];
    49             data = new byte[dataLength];
    50             ds.read(data, 0, dataLength);
    50             int bytesRead = ds.read(data, 0, dataLength);
       
    51             // For large data JDWP agent sends two packets: 1011 bytes in
       
    52             // the first packet (1000 + HEADER_LEN) and the rest in the
       
    53             // second packet.
       
    54             if (bytesRead > 0 && bytesRead < dataLength) {
       
    55                 System.out.println("[" + getClass().getName() + "] Only " +
       
    56                         bytesRead + " bytes of " + dataLength + " were " +
       
    57                         "read in the first packet. Reading the rest...");
       
    58                 ds.read(data, bytesRead, dataLength - bytesRead);
       
    59             }
       
    60 
    51             parseData(new DataInputStream(new ByteArrayInputStream(data)));
    61             parseData(new DataInputStream(new ByteArrayInputStream(data)));
    52         }
    62         }
    53     }
    63     }
    54 
    64 
    55     protected void parseData(DataInputStream ds) throws IOException {
    65     protected void parseData(DataInputStream ds) throws IOException {