Refine search
throw new MBeanException(new ServiceNotFoundException( "Could not find target")); throw new ReflectionException(x); } catch (IllegalArgumentException x) { throw new MBeanException(x); } catch (InvocationTargetException x) { Throwable t = x.getTargetException(); if (t instanceof Error) throw new MBeanException(new RuntimeErrorException((Error) t)); else throw new MBeanException((Exception) t);
throw ex.getTargetException(); throw ex.getTargetError(); RuntimeException rex = ex.getTargetException(); if (rex instanceof RuntimeMBeanException) { throw ((RuntimeMBeanException) rex).getTargetException(); throw ((RuntimeErrorException) rex).getTargetError();
throw new RuntimeOperationsException(new IllegalArgumentException("attribute cannot be null")); throw new MBeanException((Exception) t, "Exception in MBean when getting attribute '" + attribute + "'"); throw new RuntimeErrorException((Error) t, "Error in MBean when getting attribute '" + attribute + "'"); throw new RuntimeErrorException(e, "Error in AttributeProvider for getting '" + attribute + "'");
/** * Simply reads a property resource file that contains the version of this * Ninja build. Helps to identify the Ninja version currently running. * * @return The version of Ninja. Eg. "1.6-SNAPSHOT" while developing of "1.6" when released. */ private final String readNinjaVersion() { // location of the properties file String LOCATION_OF_NINJA_BUILTIN_PROPERTIES = "ninja/ninja-builtin.properties"; // and the key inside the properties file. String NINJA_VERSION_PROPERTY_KEY = "ninja.version"; String ninjaVersion; try (InputStream stream = Thread.currentThread().getContextClassLoader().getResourceAsStream(LOCATION_OF_NINJA_BUILTIN_PROPERTIES)){ Properties prop = new Properties(); prop.load(stream); ninjaVersion = prop.getProperty(NINJA_VERSION_PROPERTY_KEY); } catch (Exception e) { //this should not happen. Never. throw new RuntimeErrorException(new Error("Something is wrong with your build. Cannot find resource " + LOCATION_OF_NINJA_BUILTIN_PROPERTIES)); } return ninjaVersion; }
t = e.getTargetException(); if (t instanceof InstanceAlreadyExistsException) throw (InstanceAlreadyExistsException) t; throw new RuntimeMBeanException((RuntimeException) result); if (result instanceof Error) throw new RuntimeErrorException((Error) result);
/** * Handles runtime exceptions and rethrows them wraped if neccessary, arccording to the spec. * * @param e the exception thrown by the invocation */ private static void handleRuntimeExceptionOrError(Throwable e) { // is already of throwable type if (e instanceof RuntimeOperationsException) throw (RuntimeOperationsException)e; if (e instanceof RuntimeErrorException) throw (RuntimeErrorException)e; if (e instanceof RuntimeMBeanException) throw (RuntimeMBeanException)e; // wrap java core runtime exceptions if (e instanceof IllegalArgumentException) throw new RuntimeOperationsException((IllegalArgumentException)e); if (e instanceof IndexOutOfBoundsException) throw new RuntimeOperationsException((IndexOutOfBoundsException)e); if (e instanceof NullPointerException) throw new RuntimeOperationsException((NullPointerException)e); // wrap any error if (e instanceof Error) throw new RuntimeErrorException((Error)e); // wrap any runtime exception if (e instanceof RuntimeException) throw new RuntimeMBeanException((RuntimeException)e); }
Thread.sleep(millis / 2); fails--; RuntimeErrorException e = new RuntimeErrorException(new Error("fake error for Retry Testing")); Utils.log(e.toString());
public Object handleRuntimeError(ProxyContext ctx, RuntimeErrorException e, Method m, Object[] args) throws Exception { // just unwrap and throw the actual error throw e.getTargetError(); }
throw new RuntimeOperationsException(new IllegalArgumentException("attribute cannot be null")); throw new MBeanException((Exception) t, "Exception in MBean when getting attribute '" + attribute + "'"); throw new RuntimeErrorException((Error) t, "Error in MBean when getting attribute '" + attribute + "'"); throw new RuntimeErrorException(e, "Error in AttributeProvider for getting '" + attribute + "'");
public Image(File file) { if (file == null || file.getPath().equals(BLANK_IMAGE)) { image = blankImage; } else { try { image = ImageIO.read(file); } catch (IOException e) { throw new RuntimeErrorException(null, "Could not read image " + file); } } }
t = e.getTargetException(); if (t instanceof InstanceAlreadyExistsException) throw (InstanceAlreadyExistsException) t; throw new RuntimeMBeanException((RuntimeException) result); if (result instanceof Error) throw new RuntimeErrorException((Error) result);
/** * Handles runtime exceptions and rethrows them wraped if neccessary, arccording to the spec. * * @param e the exception thrown by the invocation */ private static void handleRuntimeExceptionOrError(Throwable e) { // is already of throwable type if (e instanceof RuntimeOperationsException) throw (RuntimeOperationsException)e; if (e instanceof RuntimeErrorException) throw (RuntimeErrorException)e; if (e instanceof RuntimeMBeanException) throw (RuntimeMBeanException)e; // wrap java core runtime exceptions if (e instanceof IllegalArgumentException) throw new RuntimeOperationsException((IllegalArgumentException)e); if (e instanceof IndexOutOfBoundsException) throw new RuntimeOperationsException((IndexOutOfBoundsException)e); if (e instanceof NullPointerException) throw new RuntimeOperationsException((NullPointerException)e); // wrap any error if (e instanceof Error) throw new RuntimeErrorException((Error)e); // wrap any runtime exception if (e instanceof RuntimeException) throw new RuntimeMBeanException((RuntimeException)e); }
public Object handleRuntimeError(ProxyContext ctx, RuntimeErrorException e, Method m, Object[] args) throws Exception { // just unwrap and throw the actual error throw e.getTargetError(); }
throw new RuntimeOperationsException (new IllegalArgumentException("Attribute name is null"), "Attribute name is null"); t = e; if (t instanceof RuntimeException) throw new RuntimeOperationsException ((RuntimeException) t, "Exception invoking method " + name); else if (t instanceof Error) throw new RuntimeErrorException ((Error) t, "Error invoking method " + name); else throw new MBeanException (e, "Exception invoking method " + name); } catch (Exception e) { throw new MBeanException (e, "Exception invoking method " + name);
private void rethrowAsMBeanException(Throwable t) throws MBeanException { if (t instanceof RuntimeException) throw new RuntimeMBeanException((RuntimeException) t); else if (t instanceof Error) throw new RuntimeErrorException((Error) t); else throw new MBeanException((Exception) t); }
throw ex.getTargetException(); throw ex.getTargetError(); RuntimeException rex = ex.getTargetException(); if (rex instanceof RuntimeMBeanException) { throw ((RuntimeMBeanException) rex).getTargetException(); throw ((RuntimeErrorException) rex).getTargetError();
public static Image fromData(byte[] data) { InputStream istream = new BufferedInputStream(new ByteArrayInputStream(data)); try { return new Image(ImageIO.read(istream)); } catch (IOException e) { throw new RuntimeErrorException(null, "Could not read image data."); } }
t = e.getTargetException(); if (t instanceof InstanceNotFoundException) throw (InstanceNotFoundException) t; throw new RuntimeMBeanException((RuntimeException) result); if (result instanceof Error) throw new RuntimeErrorException((Error) result);
throw new RuntimeOperationsException(new IllegalArgumentException("ObjectName cannot be null or a pattern ObjectName")); throw new RuntimeOperationsException(new IllegalArgumentException("Domain 'JMImplementation' is reserved for the JMX Agent")); throw new MBeanRegistrationException(new RuntimeErrorException(x));
throw new RuntimeOperationsException(new IllegalArgumentException("attribute cannot be null")); throw new MBeanException((Exception) t, "Exception in MBean when setting attribute '" + attribute.getName() + "'"); throw new RuntimeErrorException((Error) t, "Error in MBean when setting attribute '" + attribute.getName() + "'"); throw new RuntimeErrorException(e, "Error in AttributeProvider for setting '" + attribute.getName() + "'");