From ae90afc36086b8716a402d1b7ac548a0671cdb05 Mon Sep 17 00:00:00 2001 From: Sharath Ballal Date: Tue, 2 Feb 2016 10:44:55 +0100 Subject: [PATCH] 6659240: Exceptions thrown by MXBeans wrongly documented in j.l.m.ManagementFactory Reviewed-by: dfuchs, jbachorik --- .../java/lang/management/ManagementFactory.java | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/jdk/src/java.management/share/classes/java/lang/management/ManagementFactory.java b/jdk/src/java.management/share/classes/java/lang/management/ManagementFactory.java index 24c848800fd..8d0083ff807 100644 --- a/jdk/src/java.management/share/classes/java/lang/management/ManagementFactory.java +++ b/jdk/src/java.management/share/classes/java/lang/management/ManagementFactory.java @@ -519,9 +519,13 @@ public class ManagementFactory { * {@code MBeanServerConnection} where * {@link java.io.IOException IOException} may be thrown * when the communication problem occurs with the connector server. - * An application remotely accesses the platform MXBeans using - * proxy should prepare to catch {@code IOException} as if - * accessing with the {@code MBeanServerConnector} interface. + * If thrown, {@link java.io.IOException IOException} will be wrappped in + * {@link java.lang.reflect.UndeclaredThrowableException UndeclaredThrowableException}. + * An application remotely accessing the platform MXBeans using + * proxy should prepare to catch {@code UndeclaredThrowableException} and + * handle its {@linkplain java.lang.reflect.UndeclaredThrowableException#getCause() cause} + * as if that cause had been thrown by the {@code MBeanServerConnection} + * interface. * *
  • When a client application is designed to remotely access MXBeans * for a running virtual machine whose version is different than @@ -530,7 +534,11 @@ public class ManagementFactory { * {@link java.io.InvalidObjectException InvalidObjectException} * which is thrown when an MXBean proxy receives a name of an * enum constant which is missing in the enum class loaded in - * the client application.
  • + * the client application. If thrown, + * {@link java.io.InvalidObjectException InvalidObjectException} will be + * wrappped in + * {@link java.lang.reflect.UndeclaredThrowableException UndeclaredThrowableException}. + * * *
  • {@link javax.management.MBeanServerInvocationHandler * MBeanServerInvocationHandler} or its