aboutsummaryrefslogtreecommitdiff
path: root/src/share/classes/com/sun
diff options
context:
space:
mode:
authorsla <none@none>2014-05-09 12:06:13 +0200
committersla <none@none>2014-05-09 12:06:13 +0200
commit3e58546ec229b55f6df70e4a95d2ce8c450e1044 (patch)
tree2a1d43717920b27b9283bfcb193177d224e42c1e /src/share/classes/com/sun
parent1c4b8767a99699d45356153f8a71a845e84ab931 (diff)
8039173: Propagate errors from Diagnostic Commands as exceptions in the attach framework
Reviewed-by: alanb, dsamersoff, jbachorik
Diffstat (limited to 'src/share/classes/com/sun')
-rw-r--r--src/share/classes/com/sun/tools/attach/AttachOperationFailedException.java54
-rw-r--r--src/share/classes/com/sun/tools/attach/VirtualMachine.java20
2 files changed, 71 insertions, 3 deletions
diff --git a/src/share/classes/com/sun/tools/attach/AttachOperationFailedException.java b/src/share/classes/com/sun/tools/attach/AttachOperationFailedException.java
new file mode 100644
index 000000000..7f676ee49
--- /dev/null
+++ b/src/share/classes/com/sun/tools/attach/AttachOperationFailedException.java
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.tools.attach;
+
+import java.io.IOException;
+
+/**
+ * Exception type to signal that an attach operation failed in the target VM.
+ *
+ * <p> This exception can be thrown by the various operations of
+ * {@link com.sun.tools.attach.VirtualMachine} when the operation
+ * fails in the target VM. If there is a communication error,
+ * a regular IOException will be thrown.
+ *
+ * @since 1.9
+ */
+@jdk.Exported
+public class AttachOperationFailedException extends IOException {
+
+ private static final long serialVersionUID = 2140308168167478043L;
+
+ /**
+ * Constructs an <code>AttachOperationFailedException</code> with
+ * the specified detail message.
+ *
+ * @param s the detail message.
+ */
+ public AttachOperationFailedException(String message) {
+ super(message);
+ }
+}
diff --git a/src/share/classes/com/sun/tools/attach/VirtualMachine.java b/src/share/classes/com/sun/tools/attach/VirtualMachine.java
index 1bea75121..642f55163 100644
--- a/src/share/classes/com/sun/tools/attach/VirtualMachine.java
+++ b/src/share/classes/com/sun/tools/attach/VirtualMachine.java
@@ -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
@@ -564,8 +564,15 @@ public abstract class VirtualMachine {
*
* @return The system properties
*
+ * @throws AttachOperationFailedException
+ * If the target virtual machine is unable to complete the
+ * attach operation. A more specific error message will be
+ * given by {@link AttachOperationFailedException#getMessage()}.
+ *
* @throws IOException
- * If an I/O error occurs
+ * If an I/O error occurs, a communication error for example,
+ * that cannot be identified as an error to indicate that the
+ * operation failed in the target VM.
*
* @see java.lang.System#getProperties
* @see #loadAgentLibrary
@@ -591,8 +598,15 @@ public abstract class VirtualMachine {
*
* @return The agent properties
*
+ * @throws AttachOperationFailedException
+ * If the target virtual machine is unable to complete the
+ * attach operation. A more specific error message will be
+ * given by {@link AttachOperationFailedException#getMessage()}.
+ *
* @throws IOException
- * If an I/O error occurs
+ * If an I/O error occurs, a communication error for example,
+ * that cannot be identified as an error to indicate that the
+ * operation failed in the target VM.
*/
public abstract Properties getAgentProperties() throws IOException;