// Path: src/main/java/org/weakref/jmx/ReflectionUtils.java
// public static Object invoke(Object target, Method method, Object... params)
//         throws MBeanException, ReflectionException
// {
//     assertNotNull(target, "target");
//     assertNotNull(target, "method");
//     assertNotNull(target, "params");
// 
//     try {
//         Object result = method.invoke(target, params);
//         return result;
//     }
//     catch (InvocationTargetException e) {
//         // unwrap exception
//         Throwable targetException = e.getTargetException();
//         if (targetException instanceof RuntimeException) {
//             throw new MBeanException(
//                     (RuntimeException) targetException,
//                     "RuntimeException occurred while invoking " + toSimpleName(method));
//         }
//         else if (targetException instanceof ReflectionException) {
//             // allow ReflectionException to passthrough
//             throw (ReflectionException) targetException;
//         }
//         else if (targetException instanceof MBeanException) {
//             // allow MBeanException to passthrough
//             throw (MBeanException) targetException;
//         }
//         else if (targetException instanceof Exception) {
//             throw new MBeanException(
//                     (Exception) targetException,
//                     "Exception occurred while invoking " + toSimpleName(method));
//         }
//         else if (targetException instanceof Error) {
//             throw new RuntimeErrorException(
//                     (Error) targetException,
//                     "Error occurred while invoking " + toSimpleName(method));
//         }
//         else {
//             throw new RuntimeErrorException(
//                     new AssertionError(targetException),
//                     "Unexpected throwable occurred while invoking " + toSimpleName(method));
//         }
//     }
//     catch (RuntimeException e) {
//         throw new RuntimeOperationsException(e, "RuntimeException occurred while invoking " + toSimpleName(method));
//     }
//     catch (IllegalAccessException e) {
//         throw new ReflectionException(e, "IllegalAccessException occurred while invoking " + toSimpleName(method));
//     }
//     catch (Error err) {
//         throw new RuntimeErrorException(err, "Error occurred while invoking " + toSimpleName(method));
//     }
//     catch (Exception e) {
//         throw new ReflectionException(e, "Exception occurred while invoking " + toSimpleName(method));
//     }
// }


import static org.weakref.jmx.ReflectionUtils.invoke;
import javax.management.AttributeNotFoundException;
import javax.management.InvalidAttributeValueException;
import javax.management.MBeanAttributeInfo;
import javax.management.MBeanException;
import javax.management.ReflectionException;
import java.lang.reflect.Method;
        this.target = target;
        this.name = info.getName();
        this.getter = getter;
        this.setter = setter;
    }

    @Override
    public MBeanAttributeInfo getInfo()
    {
        return info;
    }

    public Object getTarget()
    {
        return target;
    }

    @Override
    public String getName()
    {
        return name;
    }

    @Override
    public Object getValue()
            throws AttributeNotFoundException, MBeanException, ReflectionException
    {
        if (getter == null) {
            throw new AttributeNotFoundException(name + " is write-only");
        }
// Path: src/main/java/org/weakref/jmx/ReflectionUtils.java
// public static Object invoke(Object target, Method method, Object... params)
//         throws MBeanException, ReflectionException
// {
//     assertNotNull(target, "target");
//     assertNotNull(target, "method");
//     assertNotNull(target, "params");
// 
//     try {
//         Object result = method.invoke(target, params);
//         return result;
//     }
//     catch (InvocationTargetException e) {
//         // unwrap exception
//         Throwable targetException = e.getTargetException();
//         if (targetException instanceof RuntimeException) {
//             throw new MBeanException(
//                     (RuntimeException) targetException,
//                     "RuntimeException occurred while invoking " + toSimpleName(method));
//         }
//         else if (targetException instanceof ReflectionException) {
//             // allow ReflectionException to passthrough
//             throw (ReflectionException) targetException;
//         }
//         else if (targetException instanceof MBeanException) {
//             // allow MBeanException to passthrough
//             throw (MBeanException) targetException;
//         }
//         else if (targetException instanceof Exception) {
//             throw new MBeanException(
//                     (Exception) targetException,
//                     "Exception occurred while invoking " + toSimpleName(method));
//         }
//         else if (targetException instanceof Error) {
//             throw new RuntimeErrorException(
//                     (Error) targetException,
//                     "Error occurred while invoking " + toSimpleName(method));
//         }
//         else {
//             throw new RuntimeErrorException(
//                     new AssertionError(targetException),
//                     "Unexpected throwable occurred while invoking " + toSimpleName(method));
//         }
//     }
//     catch (RuntimeException e) {
//         throw new RuntimeOperationsException(e, "RuntimeException occurred while invoking " + toSimpleName(method));
//     }
//     catch (IllegalAccessException e) {
//         throw new ReflectionException(e, "IllegalAccessException occurred while invoking " + toSimpleName(method));
//     }
//     catch (Error err) {
//         throw new RuntimeErrorException(err, "Error occurred while invoking " + toSimpleName(method));
//     }
//     catch (Exception e) {
//         throw new ReflectionException(e, "Exception occurred while invoking " + toSimpleName(method));
//     }
// }


// Path: src/main/java/org/weakref/jmx/ReflectionMBeanAttribute.java
import static org.weakref.jmx.ReflectionUtils.invoke;
import javax.management.AttributeNotFoundException;
import javax.management.InvalidAttributeValueException;
import javax.management.MBeanAttributeInfo;
import javax.management.MBeanException;
import javax.management.ReflectionException;
import java.lang.reflect.Method;

        this.target = target;
        this.name = info.getName();
        this.getter = getter;
        this.setter = setter;
    }

    @Override
    public MBeanAttributeInfo getInfo()
    {
        return info;
    }

    public Object getTarget()
    {
        return target;
    }

    @Override
    public String getName()
    {
        return name;
    }

    @Override
    public Object getValue()
            throws AttributeNotFoundException, MBeanException, ReflectionException
    {
        if (getter == null) {
            throw new AttributeNotFoundException(name + " is write-only");
        }
        Object result = invoke(target, getter);