Add a null check to method TestUtils.compressHeapDumps (#10053)
Motivation: java.io.File.listFiles() may return null and cause a unexpected NPE. Modification: Add a null check for variable files. And if variable files is null, the compressHeapDumps method will just return after logging a error message. Result: Fix the potential NPE.
This commit is contained in:
parent
880e1239c5
commit
6d09298d1d
@ -141,6 +141,10 @@ public final class TestUtils {
|
||||
return name.endsWith(".hprof");
|
||||
}
|
||||
});
|
||||
if (files == null) {
|
||||
logger.warn("failed to find heap dump due to I/O error!");
|
||||
return;
|
||||
}
|
||||
|
||||
final byte[] buf = new byte[65536];
|
||||
final LZMA2Options options = new LZMA2Options(LZMA2Options.PRESET_DEFAULT);
|
||||
|
Loading…
Reference in New Issue
Block a user