Skip to content

Commit 8b04800

Browse files
committed
GH-476 RootClassLoadedCommand - read GZIP trailer ; special 7-trailer added to outsmart concatenated gzip logic in GZIPInputStream.readTrailer()
1 parent 4b21ae6 commit 8b04800

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

visualvm/libs.profiler/lib.profiler/src/org/graalvm/visualvm/lib/jfluid/wireprotocol/RootClassLoadedCommand.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,20 @@ void readObject(ObjectInputStream gin) throws IOException {
167167
for (int i = 0; i < len; i++) {
168168
parentLoaderIds[i] = in.readInt();
169169
}
170+
int eof = in.read();
171+
if (eof != -1) throw new IOException("RootClassLoadedCommand EOF not found, read:"+eof);
172+
boolean failed = false;
173+
for (int i = 21; i<127; i+=7) {
174+
int inb = gin.read();
175+
if (inb != i) {
176+
failed = true;
177+
if (WireIO.DEBUG) System.out.print(i+"="+inb+"; ");
178+
if (inb%7 == 0) {
179+
i = inb;
180+
}
181+
}
182+
}
183+
if (WireIO.DEBUG && failed) System.out.println("RootClassLoadedCommand fixed.");
170184
}
171185

172186
void writeObject(ObjectOutputStream gout) throws IOException {
@@ -229,6 +243,8 @@ void writeObject(ObjectOutputStream gout) throws IOException {
229243
}
230244
out.flush();
231245
eox.finish();
246+
gout.flush();
247+
for (int i = 7; i<127; i+=7) gout.write(i);
232248

233249
// Free memory
234250
allLoadedClassNames = null;

0 commit comments

Comments
 (0)