Java Code Examples for javax.management.NotCompliantMBeanException#initCause()

The following examples show how to use javax.management.NotCompliantMBeanException#initCause() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Introspector.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Throws a NotCompliantMBeanException or a SecurityException.
 * @param notCompliant the class which was under examination
 * @param cause the raeson why NotCompliantMBeanException should
 *        be thrown.
 * @return nothing - this method always throw an exception.
 *         The return type makes it possible to write
 *         <pre> throw throwException(clazz,cause); </pre>
 * @throws SecurityException - if cause is a SecurityException
 * @throws NotCompliantMBeanException otherwise.
 **/
static NotCompliantMBeanException throwException(Class<?> notCompliant,
        Throwable cause)
        throws NotCompliantMBeanException, SecurityException {
    if (cause instanceof SecurityException)
        throw (SecurityException) cause;
    if (cause instanceof NotCompliantMBeanException)
        throw (NotCompliantMBeanException)cause;
    final String classname =
            (notCompliant==null)?"null class":notCompliant.getName();
    final String reason =
            (cause==null)?"Not compliant":cause.getMessage();
    final NotCompliantMBeanException res =
            new NotCompliantMBeanException(classname+": "+reason);
    res.initCause(cause);
    throw res;
}
 
Example 2
Source File: Introspector.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Throws a NotCompliantMBeanException or a SecurityException.
 * @param notCompliant the class which was under examination
 * @param cause the raeson why NotCompliantMBeanException should
 *        be thrown.
 * @return nothing - this method always throw an exception.
 *         The return type makes it possible to write
 *         <pre> throw throwException(clazz,cause); </pre>
 * @throws SecurityException - if cause is a SecurityException
 * @throws NotCompliantMBeanException otherwise.
 **/
static NotCompliantMBeanException throwException(Class<?> notCompliant,
        Throwable cause)
        throws NotCompliantMBeanException, SecurityException {
    if (cause instanceof SecurityException)
        throw (SecurityException) cause;
    if (cause instanceof NotCompliantMBeanException)
        throw (NotCompliantMBeanException)cause;
    final String classname =
            (notCompliant==null)?"null class":notCompliant.getName();
    final String reason =
            (cause==null)?"Not compliant":cause.getMessage();
    final NotCompliantMBeanException res =
            new NotCompliantMBeanException(classname+": "+reason);
    res.initCause(cause);
    throw res;
}
 
Example 3
Source File: DefaultMBeanServerInterceptor.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
private static String getNewMBeanClassName(Object mbeanToRegister)
        throws NotCompliantMBeanException {
    if (mbeanToRegister instanceof DynamicMBean) {
        DynamicMBean mbean = (DynamicMBean) mbeanToRegister;
        final String name;
        try {
            name = mbean.getMBeanInfo().getClassName();
        } catch (Exception e) {
            // Includes case where getMBeanInfo() returns null
            NotCompliantMBeanException ncmbe =
                new NotCompliantMBeanException("Bad getMBeanInfo()");
            ncmbe.initCause(e);
            throw ncmbe;
        }
        if (name == null) {
            final String msg = "MBeanInfo has null class name";
            throw new NotCompliantMBeanException(msg);
        }
        return name;
    } else
        return mbeanToRegister.getClass().getName();
}
 
Example 4
Source File: Introspector.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Throws a NotCompliantMBeanException or a SecurityException.
 * @param notCompliant the class which was under examination
 * @param cause the raeson why NotCompliantMBeanException should
 *        be thrown.
 * @return nothing - this method always throw an exception.
 *         The return type makes it possible to write
 *         <pre> throw throwException(clazz,cause); </pre>
 * @throws SecurityException - if cause is a SecurityException
 * @throws NotCompliantMBeanException otherwise.
 **/
static NotCompliantMBeanException throwException(Class<?> notCompliant,
        Throwable cause)
        throws NotCompliantMBeanException, SecurityException {
    if (cause instanceof SecurityException)
        throw (SecurityException) cause;
    if (cause instanceof NotCompliantMBeanException)
        throw (NotCompliantMBeanException)cause;
    final String classname =
            (notCompliant==null)?"null class":notCompliant.getName();
    final String reason =
            (cause==null)?"Not compliant":cause.getMessage();
    final NotCompliantMBeanException res =
            new NotCompliantMBeanException(classname+": "+reason);
    res.initCause(cause);
    throw res;
}
 
Example 5
Source File: DefaultMBeanServerInterceptor.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
private static String getNewMBeanClassName(Object mbeanToRegister)
        throws NotCompliantMBeanException {
    if (mbeanToRegister instanceof DynamicMBean) {
        DynamicMBean mbean = (DynamicMBean) mbeanToRegister;
        final String name;
        try {
            name = mbean.getMBeanInfo().getClassName();
        } catch (Exception e) {
            // Includes case where getMBeanInfo() returns null
            NotCompliantMBeanException ncmbe =
                new NotCompliantMBeanException("Bad getMBeanInfo()");
            ncmbe.initCause(e);
            throw ncmbe;
        }
        if (name == null) {
            final String msg = "MBeanInfo has null class name";
            throw new NotCompliantMBeanException(msg);
        }
        return name;
    } else
        return mbeanToRegister.getClass().getName();
}
 
Example 6
Source File: Introspector.java    From jdk8u-dev-jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Throws a NotCompliantMBeanException or a SecurityException.
 * @param notCompliant the class which was under examination
 * @param cause the raeson why NotCompliantMBeanException should
 *        be thrown.
 * @return nothing - this method always throw an exception.
 *         The return type makes it possible to write
 *         <pre> throw throwException(clazz,cause); </pre>
 * @throws SecurityException - if cause is a SecurityException
 * @throws NotCompliantMBeanException otherwise.
 **/
static NotCompliantMBeanException throwException(Class<?> notCompliant,
        Throwable cause)
        throws NotCompliantMBeanException, SecurityException {
    if (cause instanceof SecurityException)
        throw (SecurityException) cause;
    if (cause instanceof NotCompliantMBeanException)
        throw (NotCompliantMBeanException)cause;
    final String classname =
            (notCompliant==null)?"null class":notCompliant.getName();
    final String reason =
            (cause==null)?"Not compliant":cause.getMessage();
    final NotCompliantMBeanException res =
            new NotCompliantMBeanException(classname+": "+reason);
    res.initCause(cause);
    throw res;
}
 
Example 7
Source File: DefaultMBeanServerInterceptor.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
private static String getNewMBeanClassName(Object mbeanToRegister)
        throws NotCompliantMBeanException {
    if (mbeanToRegister instanceof DynamicMBean) {
        DynamicMBean mbean = (DynamicMBean) mbeanToRegister;
        final String name;
        try {
            name = mbean.getMBeanInfo().getClassName();
        } catch (Exception e) {
            // Includes case where getMBeanInfo() returns null
            NotCompliantMBeanException ncmbe =
                new NotCompliantMBeanException("Bad getMBeanInfo()");
            ncmbe.initCause(e);
            throw ncmbe;
        }
        if (name == null) {
            final String msg = "MBeanInfo has null class name";
            throw new NotCompliantMBeanException(msg);
        }
        return name;
    } else
        return mbeanToRegister.getClass().getName();
}
 
Example 8
Source File: Introspector.java    From jdk8u_jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Throws a NotCompliantMBeanException or a SecurityException.
 * @param notCompliant the class which was under examination
 * @param cause the raeson why NotCompliantMBeanException should
 *        be thrown.
 * @return nothing - this method always throw an exception.
 *         The return type makes it possible to write
 *         <pre> throw throwException(clazz,cause); </pre>
 * @throws SecurityException - if cause is a SecurityException
 * @throws NotCompliantMBeanException otherwise.
 **/
static NotCompliantMBeanException throwException(Class<?> notCompliant,
        Throwable cause)
        throws NotCompliantMBeanException, SecurityException {
    if (cause instanceof SecurityException)
        throw (SecurityException) cause;
    if (cause instanceof NotCompliantMBeanException)
        throw (NotCompliantMBeanException)cause;
    final String classname =
            (notCompliant==null)?"null class":notCompliant.getName();
    final String reason =
            (cause==null)?"Not compliant":cause.getMessage();
    final NotCompliantMBeanException res =
            new NotCompliantMBeanException(classname+": "+reason);
    res.initCause(cause);
    throw res;
}
 
Example 9
Source File: DefaultMBeanServerInterceptor.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
private static String getNewMBeanClassName(Object mbeanToRegister)
        throws NotCompliantMBeanException {
    if (mbeanToRegister instanceof DynamicMBean) {
        DynamicMBean mbean = (DynamicMBean) mbeanToRegister;
        final String name;
        try {
            name = mbean.getMBeanInfo().getClassName();
        } catch (Exception e) {
            // Includes case where getMBeanInfo() returns null
            NotCompliantMBeanException ncmbe =
                new NotCompliantMBeanException("Bad getMBeanInfo()");
            ncmbe.initCause(e);
            throw ncmbe;
        }
        if (name == null) {
            final String msg = "MBeanInfo has null class name";
            throw new NotCompliantMBeanException(msg);
        }
        return name;
    } else
        return mbeanToRegister.getClass().getName();
}
 
Example 10
Source File: Introspector.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Throws a NotCompliantMBeanException or a SecurityException.
 * @param notCompliant the class which was under examination
 * @param cause the raeson why NotCompliantMBeanException should
 *        be thrown.
 * @return nothing - this method always throw an exception.
 *         The return type makes it possible to write
 *         <pre> throw throwException(clazz,cause); </pre>
 * @throws SecurityException - if cause is a SecurityException
 * @throws NotCompliantMBeanException otherwise.
 **/
static NotCompliantMBeanException throwException(Class<?> notCompliant,
        Throwable cause)
        throws NotCompliantMBeanException, SecurityException {
    if (cause instanceof SecurityException)
        throw (SecurityException) cause;
    if (cause instanceof NotCompliantMBeanException)
        throw (NotCompliantMBeanException)cause;
    final String classname =
            (notCompliant==null)?"null class":notCompliant.getName();
    final String reason =
            (cause==null)?"Not compliant":cause.getMessage();
    final NotCompliantMBeanException res =
            new NotCompliantMBeanException(classname+": "+reason);
    res.initCause(cause);
    throw res;
}
 
Example 11
Source File: DefaultMBeanServerInterceptor.java    From jdk1.8-source-analysis with Apache License 2.0 6 votes vote down vote up
private static String getNewMBeanClassName(Object mbeanToRegister)
        throws NotCompliantMBeanException {
    if (mbeanToRegister instanceof DynamicMBean) {
        DynamicMBean mbean = (DynamicMBean) mbeanToRegister;
        final String name;
        try {
            name = mbean.getMBeanInfo().getClassName();
        } catch (Exception e) {
            // Includes case where getMBeanInfo() returns null
            NotCompliantMBeanException ncmbe =
                new NotCompliantMBeanException("Bad getMBeanInfo()");
            ncmbe.initCause(e);
            throw ncmbe;
        }
        if (name == null) {
            final String msg = "MBeanInfo has null class name";
            throw new NotCompliantMBeanException(msg);
        }
        return name;
    } else
        return mbeanToRegister.getClass().getName();
}
 
Example 12
Source File: DefaultMBeanServerInterceptor.java    From jdk8u_jdk with GNU General Public License v2.0 6 votes vote down vote up
private static String getNewMBeanClassName(Object mbeanToRegister)
        throws NotCompliantMBeanException {
    if (mbeanToRegister instanceof DynamicMBean) {
        DynamicMBean mbean = (DynamicMBean) mbeanToRegister;
        final String name;
        try {
            name = mbean.getMBeanInfo().getClassName();
        } catch (Exception e) {
            // Includes case where getMBeanInfo() returns null
            NotCompliantMBeanException ncmbe =
                new NotCompliantMBeanException("Bad getMBeanInfo()");
            ncmbe.initCause(e);
            throw ncmbe;
        }
        if (name == null) {
            final String msg = "MBeanInfo has null class name";
            throw new NotCompliantMBeanException(msg);
        }
        return name;
    } else
        return mbeanToRegister.getClass().getName();
}
 
Example 13
Source File: DefaultMBeanServerInterceptor.java    From JDKSourceCode1.8 with MIT License 6 votes vote down vote up
private static String getNewMBeanClassName(Object mbeanToRegister)
        throws NotCompliantMBeanException {
    if (mbeanToRegister instanceof DynamicMBean) {
        DynamicMBean mbean = (DynamicMBean) mbeanToRegister;
        final String name;
        try {
            name = mbean.getMBeanInfo().getClassName();
        } catch (Exception e) {
            // Includes case where getMBeanInfo() returns null
            NotCompliantMBeanException ncmbe =
                new NotCompliantMBeanException("Bad getMBeanInfo()");
            ncmbe.initCause(e);
            throw ncmbe;
        }
        if (name == null) {
            final String msg = "MBeanInfo has null class name";
            throw new NotCompliantMBeanException(msg);
        }
        return name;
    } else
        return mbeanToRegister.getClass().getName();
}
 
Example 14
Source File: Introspector.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Throws a NotCompliantMBeanException or a SecurityException.
 * @param notCompliant the class which was under examination
 * @param cause the raeson why NotCompliantMBeanException should
 *        be thrown.
 * @return nothing - this method always throw an exception.
 *         The return type makes it possible to write
 *         <pre> throw throwException(clazz,cause); </pre>
 * @throws SecurityException - if cause is a SecurityException
 * @throws NotCompliantMBeanException otherwise.
 **/
static NotCompliantMBeanException throwException(Class<?> notCompliant,
        Throwable cause)
        throws NotCompliantMBeanException, SecurityException {
    if (cause instanceof SecurityException)
        throw (SecurityException) cause;
    if (cause instanceof NotCompliantMBeanException)
        throw (NotCompliantMBeanException)cause;
    final String classname =
            (notCompliant==null)?"null class":notCompliant.getName();
    final String reason =
            (cause==null)?"Not compliant":cause.getMessage();
    final NotCompliantMBeanException res =
            new NotCompliantMBeanException(classname+": "+reason);
    res.initCause(cause);
    throw res;
}
 
Example 15
Source File: DefaultMBeanServerInterceptor.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
private static String getNewMBeanClassName(Object mbeanToRegister)
        throws NotCompliantMBeanException {
    if (mbeanToRegister instanceof DynamicMBean) {
        DynamicMBean mbean = (DynamicMBean) mbeanToRegister;
        final String name;
        try {
            name = mbean.getMBeanInfo().getClassName();
        } catch (Exception e) {
            // Includes case where getMBeanInfo() returns null
            NotCompliantMBeanException ncmbe =
                new NotCompliantMBeanException("Bad getMBeanInfo()");
            ncmbe.initCause(e);
            throw ncmbe;
        }
        if (name == null) {
            final String msg = "MBeanInfo has null class name";
            throw new NotCompliantMBeanException(msg);
        }
        return name;
    } else
        return mbeanToRegister.getClass().getName();
}
 
Example 16
Source File: DefaultMBeanServerInterceptor.java    From jdk8u-dev-jdk with GNU General Public License v2.0 6 votes vote down vote up
private static String getNewMBeanClassName(Object mbeanToRegister)
        throws NotCompliantMBeanException {
    if (mbeanToRegister instanceof DynamicMBean) {
        DynamicMBean mbean = (DynamicMBean) mbeanToRegister;
        final String name;
        try {
            name = mbean.getMBeanInfo().getClassName();
        } catch (Exception e) {
            // Includes case where getMBeanInfo() returns null
            NotCompliantMBeanException ncmbe =
                new NotCompliantMBeanException("Bad getMBeanInfo()");
            ncmbe.initCause(e);
            throw ncmbe;
        }
        if (name == null) {
            final String msg = "MBeanInfo has null class name";
            throw new NotCompliantMBeanException(msg);
        }
        return name;
    } else
        return mbeanToRegister.getClass().getName();
}
 
Example 17
Source File: Introspector.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Throws a NotCompliantMBeanException or a SecurityException.
 * @param notCompliant the class which was under examination
 * @param cause the raeson why NotCompliantMBeanException should
 *        be thrown.
 * @return nothing - this method always throw an exception.
 *         The return type makes it possible to write
 *         <pre> throw throwException(clazz,cause); </pre>
 * @throws SecurityException - if cause is a SecurityException
 * @throws NotCompliantMBeanException otherwise.
 **/
static NotCompliantMBeanException throwException(Class<?> notCompliant,
        Throwable cause)
        throws NotCompliantMBeanException, SecurityException {
    if (cause instanceof SecurityException)
        throw (SecurityException) cause;
    if (cause instanceof NotCompliantMBeanException)
        throw (NotCompliantMBeanException)cause;
    final String classname =
            (notCompliant==null)?"null class":notCompliant.getName();
    final String reason =
            (cause==null)?"Not compliant":cause.getMessage();
    final NotCompliantMBeanException res =
            new NotCompliantMBeanException(classname+": "+reason);
    res.initCause(cause);
    throw res;
}
 
Example 18
Source File: Introspector.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Throws a NotCompliantMBeanException or a SecurityException.
 * @param notCompliant the class which was under examination
 * @param cause the raeson why NotCompliantMBeanException should
 *        be thrown.
 * @return nothing - this method always throw an exception.
 *         The return type makes it possible to write
 *         <pre> throw throwException(clazz,cause); </pre>
 * @throws SecurityException - if cause is a SecurityException
 * @throws NotCompliantMBeanException otherwise.
 **/
static NotCompliantMBeanException throwException(Class<?> notCompliant,
        Throwable cause)
        throws NotCompliantMBeanException, SecurityException {
    if (cause instanceof SecurityException)
        throw (SecurityException) cause;
    if (cause instanceof NotCompliantMBeanException)
        throw (NotCompliantMBeanException)cause;
    final String classname =
            (notCompliant==null)?"null class":notCompliant.getName();
    final String reason =
            (cause==null)?"Not compliant":cause.getMessage();
    final NotCompliantMBeanException res =
            new NotCompliantMBeanException(classname+": "+reason);
    res.initCause(cause);
    throw res;
}
 
Example 19
Source File: DefaultMBeanServerInterceptor.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
private static String getNewMBeanClassName(Object mbeanToRegister)
        throws NotCompliantMBeanException {
    if (mbeanToRegister instanceof DynamicMBean) {
        DynamicMBean mbean = (DynamicMBean) mbeanToRegister;
        final String name;
        try {
            name = mbean.getMBeanInfo().getClassName();
        } catch (Exception e) {
            // Includes case where getMBeanInfo() returns null
            NotCompliantMBeanException ncmbe =
                new NotCompliantMBeanException("Bad getMBeanInfo()");
            ncmbe.initCause(e);
            throw ncmbe;
        }
        if (name == null) {
            final String msg = "MBeanInfo has null class name";
            throw new NotCompliantMBeanException(msg);
        }
        return name;
    } else
        return mbeanToRegister.getClass().getName();
}
 
Example 20
Source File: Introspector.java    From jdk1.8-source-analysis with Apache License 2.0 6 votes vote down vote up
/**
 * Throws a NotCompliantMBeanException or a SecurityException.
 * @param notCompliant the class which was under examination
 * @param cause the raeson why NotCompliantMBeanException should
 *        be thrown.
 * @return nothing - this method always throw an exception.
 *         The return type makes it possible to write
 *         <pre> throw throwException(clazz,cause); </pre>
 * @throws SecurityException - if cause is a SecurityException
 * @throws NotCompliantMBeanException otherwise.
 **/
static NotCompliantMBeanException throwException(Class<?> notCompliant,
        Throwable cause)
        throws NotCompliantMBeanException, SecurityException {
    if (cause instanceof SecurityException)
        throw (SecurityException) cause;
    if (cause instanceof NotCompliantMBeanException)
        throw (NotCompliantMBeanException)cause;
    final String classname =
            (notCompliant==null)?"null class":notCompliant.getName();
    final String reason =
            (cause==null)?"Not compliant":cause.getMessage();
    final NotCompliantMBeanException res =
            new NotCompliantMBeanException(classname+": "+reason);
    res.initCause(cause);
    throw res;
}