Java 8 RuntimeOperationsException - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Java 8 RuntimeOperationsException class.

This code example shows how to use the following methods:printStackTrace, getCause
            Object fieldValues[] = { 1, 2, 3 }; 
            d.setFields(fieldNames, fieldValues);
            System.out.println("Didn't get expected exception");
            ok = false;
        } catch (RuntimeOperationsException e) {
            if (e.getCause() instanceof IllegalArgumentException) {
                System.out.println("Got expected exception:");
                ok = true;
            } else { 
                System.out.println("Got unexpected exception:");
                ok = false;
            } 
            e.printStackTrace(System.out);
        } catch (Exception e) {
            System.out.println("Got unexpected exception:");
            ok = false;
            e.printStackTrace(System.out);
        } 
        try { 
            System.out.println(

5
CodeRank
This code example shows how to use the following methods:printStackTrace, getCause
            Object fieldValues[] = { 1, 2, 3 }; 
            d.setFields(fieldNames, fieldValues);
            System.out.println("Didn't get expected exception");
            ok = false;
        } catch (RuntimeOperationsException e) {
            if (e.getCause() instanceof IllegalArgumentException) {
                System.out.println("Got expected exception:");
                ok = true;
            } else { 
                System.out.println("Got unexpected exception:");
                ok = false;
            } 
            e.printStackTrace(System.out);
        } catch (Exception e) {
            System.out.println("Got unexpected exception:");
            ok = false;
            e.printStackTrace(System.out);
        } 
        try { 
            System.out.println(

5
CodeRank
This code example shows how to use the following methods:printStackTrace, getTargetException
                                      new ModelMBeanAttributeInfo[] {mmbai},
                                      null, null, null); 
        try { 
            mmbi.setDescriptor(null, "attribute");
        } catch (RuntimeOperationsException e) {
            if (e.getTargetException() instanceof IllegalArgumentException) {
                System.out.println("Test passes: got a " +
                                   "RuntimeOperationsException wrapping an " + 
                                   "IllegalArgumentException"); 
                return true; 
            } else { 
                System.out.println("TEST FAILS: wrong exception:");
                e.printStackTrace(System.out);
                return false; 
            } 
        } catch (Exception e) {
            System.out.println("TEST FAILS: wrong exception:");
            e.printStackTrace(System.out);
            return false; 
        } 
5
CodeRank
This code example shows how to use the following methods:printStackTrace, getTargetException
                                      new ModelMBeanAttributeInfo[] {mmbai},
                                      null, null, null); 
        try { 
            mmbi.setDescriptor(null, "attribute");
        } catch (RuntimeOperationsException e) {
            if (e.getTargetException() instanceof IllegalArgumentException) {
                System.out.println("Test passes: got a " +
                                   "RuntimeOperationsException wrapping an " + 
                                   "IllegalArgumentException"); 
                return true; 
            } else { 
                System.out.println("TEST FAILS: wrong exception:");
                e.printStackTrace(System.out);
                return false; 
            } 
        } catch (Exception e) {
            System.out.println("TEST FAILS: wrong exception:");
            e.printStackTrace(System.out);
            return false; 
        } 
5
CodeRank
This code example shows how to use the following methods:
        throws AttributeNotFoundException, MBeanException,
        ReflectionException {
  
        // Validate the input parameters 
        if (name == null)
            throw new RuntimeOperationsException
                (new IllegalArgumentException("Attribute name is null"),
                 "Attribute name is null"); 
 
        ContextResource cr = null;
        try { 
            cr = (ContextResource) getManagedResource();
        } catch (InstanceNotFoundException e) {
            throw new MBeanException(e);
        } catch (InvalidTargetObjectTypeException e) {
             throw new MBeanException(e);
        } 
         
        String value = null;
        if ("auth".equals(name)) {
4
CodeRank
This code example shows how to use the following methods:
            MBeanException, ReflectionException {
 
        Object attribute = null; 
        // Validate the input parameters 
        if (name == null)
            throw new RuntimeOperationsException(new IllegalArgumentException(
                    "Attribute name is null"), "Attribute name is null"); 
 
        Object result = null; 
        try { 
            Connector connector = (Connector) getManagedResource();
            result = IntrospectionUtils.getProperty(connector, name);
        } catch (InstanceNotFoundException e) {
            throw new MBeanException(e);
        } catch (InvalidTargetObjectTypeException e) {
            throw new MBeanException(e);
        } 
 
        return result; 
 
4
CodeRank
This code example shows how to use the following methods:
    public Object getAttribute(String name)
        throws AttributeNotFoundException, MBeanException,
            ReflectionException {
        // Validate the input parameters 
        if (name == null)
            throw new RuntimeOperationsException
                (new IllegalArgumentException("Attribute name is null"),
                 "Attribute name is null"); 
 
        if( (resource instanceof DynamicMBean) &&
             ! ( resource instanceof BaseModelMBean )) { 
            return ((DynamicMBean)resource).getAttribute(name);
        } 
 
        Method m=managedBean.getGetter(name, this, resource);
        Object result = null; 
        try { 
            Class<?> declaring = m.getDeclaringClass();
            // workaround for catalina weird mbeans - the declaring class is BaseModelMBean. 
            // but this is the catalina class. 
4
CodeRank
This code example shows how to use the following methods:
        throws AttributeNotFoundException, MBeanException,
        ReflectionException {
  
        // Validate the input parameters 
        if (name == null)
            throw new RuntimeOperationsException
                (new IllegalArgumentException("Attribute name is null"),
                 "Attribute name is null"); 
 
        ContextResource cr = null;
        try { 
            cr = (ContextResource) getManagedResource();
        } catch (InstanceNotFoundException e) {
            throw new MBeanException(e);
        } catch (InvalidTargetObjectTypeException e) {
             throw new MBeanException(e);
        } 
         
        String value = null;
        if ("auth".equals(name)) {
5
CodeRank
This code example shows how to use the following methods:
String name = attribute.getName();
        Object value = attribute.getValue();
 
        if (name == null) {
            throw new RuntimeOperationsException(new IllegalArgumentException(
                "Attribute name cannot be null"), 
                "Cannot invoke the setter of " + m_className
                        + " with null attribute name"); 
        } 
        // Check for a recognized attribute name and call the corresponding 
        // setter 
        // 
 
        PropertyField propertyField = (PropertyField) m_configMap
            .getPropertyFromName(name);
        if (propertyField == null) {
            // unrecognized attribute name: 
            throw new AttributeNotFoundException("Attribute " + name
                    + " not found in " + m_className);
4
CodeRank
This code example shows how to use the following methods:
                        new AssertionError(targetException),
                        "Unexpected throwable occured while invoking " + toSimpleName(method));
            } 
        } 
        catch (RuntimeException e) {
            throw new RuntimeOperationsException(e, "RuntimeException occured while invoking " + toSimpleName(method));
        } 
        catch (IllegalAccessException e) {
            throw new ReflectionException(e, "IllegalAccessException occured while invoking " + toSimpleName(method));
        } 
        catch (Error err) {
            throw new RuntimeErrorException(err, "Error occured while invoking " + toSimpleName(method));
        } 
        catch (Exception e) {
            throw new ReflectionException(e, "Exception occured while invoking " + toSimpleName(method));
        } 
    } 
 
    private static String toSimpleName(Method method)
    { 
4
CodeRank
See Code Examples for Java 8 RuntimeOperationsException Methods: