Skip to content
Permalink
Browse files
8269886: Inaccurate error message for compressed hprof test
Reviewed-by: dholmes, cjplummer
  • Loading branch information
Lin Zang authored and David Holmes committed Jul 8, 2021
1 parent a96012f commit 4fbcce119b1736455cb74d0a585097eca617593c
Showing 1 changed file with 10 additions and 5 deletions.
@@ -159,7 +159,12 @@ public static String getStack(String heapFile, int debugLevel)
while ((len = gis.read(buffer)) > 0) {
fos.write(buffer, 0, len);
}
// Check dump data header and print stack trace.
} catch (Exception e) {
out.delete();
throw new IOException("Cannot decompress the compressed hprof file", e);
}
// Check dump data header and print stack trace.
try {
PositionDataInputStream in2 = new PositionDataInputStream(
new BufferedInputStream(new FileInputStream(out)));
i = in2.readInt();
@@ -169,15 +174,15 @@ public static String getStack(String heapFile, int debugLevel)
true, debugLevel);
r.read();
return r.printStackTraces();
} else {
throw new IOException("Unrecognized magic number found in decompressed data: " + i);
}
} catch (Exception e) {
throw new IOException("Can not decompress the compressed hprof file", e);
} finally {
out.delete();
}
out.delete();
} else {
throw new IOException("Unrecognized magic number: " + i);
}
}
return null;
}
}

1 comment on commit 4fbcce1

@openjdk-notifier
Copy link

@openjdk-notifier openjdk-notifier bot commented on 4fbcce1 Jul 8, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.