8037274: sun.tools.attach.WindowsVirtualMachine#createPipe() needs more descriptive message when pipe creation fails
authorjbachorik
Mon, 24 Mar 2014 13:16:25 +0100
changeset 23570 6b0a90ae5eaa
parent 23569 1ef5563dedda
child 23571 2be40cc450b5
8037274: sun.tools.attach.WindowsVirtualMachine#createPipe() needs more descriptive message when pipe creation fails Reviewed-by: alanb, dcubed, allwin
jdk/src/windows/native/sun/tools/attach/WindowsVirtualMachine.c
--- a/jdk/src/windows/native/sun/tools/attach/WindowsVirtualMachine.c	Mon Mar 24 14:14:03 2014 +0400
+++ b/jdk/src/windows/native/sun/tools/attach/WindowsVirtualMachine.c	Mon Mar 24 13:16:25 2014 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -273,7 +273,9 @@
           NULL);                        // default security attribute
 
     if (hPipe == INVALID_HANDLE_VALUE) {
-        JNU_ThrowIOExceptionWithLastError(env, "CreateNamedPipe failed");
+        char msg[256];
+        _snprintf(msg, sizeof(msg), "CreateNamedPipe failed: %d", GetLastError());
+        JNU_ThrowIOExceptionWithLastError(env, msg);
     }
     return (jlong)hPipe;
 }