Skip to content

Commit 0d445fa

Browse files
committed
GH-395 no checks are needed if heap dump completes without exception
1 parent 74de315 commit 0d445fa

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

visualvm/jmx/src/org/graalvm/visualvm/jmx/impl/JmxSupport.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@
3535
import java.lang.management.ThreadInfo;
3636
import java.lang.management.ThreadMXBean;
3737
import java.nio.file.Files;
38-
import java.nio.file.LinkOption;
3938
import java.nio.file.Path;
4039
import java.nio.file.Paths;
4140
import java.text.SimpleDateFormat;
@@ -370,19 +369,19 @@ private void printLock(StringBuilder sb,LockInfo lock) {
370369
boolean takeHeapDump(String fileName) {
371370
HotSpotDiagnosticMXBean hsDiagnostic = getHotSpotDiagnostic();
372371
if (hsDiagnostic != null) {
373-
Path f = Paths.get(fileName);
374372
try {
375373
hsDiagnostic.dumpHeap(fileName,true);
376374
} catch (IOException ex) {
377375
LOGGER.log(Level.INFO,"takeHeapDump", ex); // NOI18N
378376
try {
377+
Path f = Paths.get(fileName);
379378
Files.deleteIfExists(f);
380379
} catch (IOException ex1) {
381380
LOGGER.log(Level.INFO,"takeHeapDump", ex1); // NOI18N
382381
}
383382
return false;
384383
}
385-
return Files.isRegularFile(f, LinkOption.NOFOLLOW_LINKS) && Files.isReadable(f);
384+
return true;
386385
}
387386
return false;
388387
}

0 commit comments

Comments
 (0)