8358077: sun.tools.attach.VirtualMachineImpl::checkCatchesAndSendQuitTo on Linux leaks file handles after JDK-8327114
Reviewed-by: kevinw, sspitsyn, syan
This commit is contained in:
parent
d7e58ac480
commit
44d62c8e21
@ -35,6 +35,8 @@ import java.nio.file.Files;
|
|||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
import java.nio.file.Paths;
|
import java.nio.file.Paths;
|
||||||
|
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
import static java.nio.charset.StandardCharsets.UTF_8;
|
import static java.nio.charset.StandardCharsets.UTF_8;
|
||||||
@ -358,7 +360,11 @@ public class VirtualMachineImpl extends HotSpotVirtualMachine {
|
|||||||
if (okToSendQuit) {
|
if (okToSendQuit) {
|
||||||
sendQuitTo(pid);
|
sendQuitTo(pid);
|
||||||
} else if (throwIfNotReady) {
|
} else if (throwIfNotReady) {
|
||||||
final var cmdline = Files.lines(procPid.resolve("cmdline")).findFirst();
|
Optional<String> cmdline = Optional.empty();
|
||||||
|
|
||||||
|
try (final var clf = Files.lines(procPid.resolve("cmdline"))) {
|
||||||
|
cmdline = clf.findFirst();
|
||||||
|
}
|
||||||
|
|
||||||
var cmd = "null"; // default
|
var cmd = "null"; // default
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user