private void readObject(java.io.ObjectInputStream stream) throws IOException, ClassNotFoundException { stream.defaultReadObject(); try { method = ((MethodSerializationWrapper) stream.readObject()).getMethod(); } catch (NoSuchMethodException e) { // ///CLOVER:OFF throw new IOException(e.toString()); // ///CLOVER:ON } }
/** * Invokes HtmlAdapterServer.start() using reflection. * * @since 1.2.16 * @param server instance of com.sun.jdmk.comm.HtmlAdapterServer. */ private static void startServer(final Object server) { try { server.getClass().getMethod("start", new Class[0]). invoke(server, new Object[0]); } catch(InvocationTargetException ex) { Throwable cause = ex.getTargetException(); if (cause instanceof RuntimeException) { throw (RuntimeException) cause; } else if (cause != null) { if (cause instanceof InterruptedException || cause instanceof InterruptedIOException) { Thread.currentThread().interrupt(); } throw new RuntimeException(cause.toString()); } else { throw new RuntimeException(); } } catch(NoSuchMethodException ex) { throw new RuntimeException(ex.toString()); } catch(IllegalAccessException ex) { throw new RuntimeException(ex.toString()); } }
@SuppressWarnings("unchecked") private void readObject(java.io.ObjectInputStream stream) throws IOException, ClassNotFoundException { stream.defaultReadObject(); Set<MethodSerializationWrapper> methods = (Set<MethodSerializationWrapper>) stream .readObject(); if (methods == null) { return; } mockedMethods = new HashSet<>(methods.size()); for (MethodSerializationWrapper m : methods) { try { mockedMethods.add(m.getMethod()); } catch (NoSuchMethodException e) { // ///CLOVER:OFF throw new IOException(e.toString()); // ///CLOVER:ON } } }
protected void readMethod(DataInput in) throws Exception { if(in.readByte() == 1) { Class[] parametertypes=Util.objectFromStream(in); Class declaringclass=Util.objectFromStream(in); try { method=declaringclass.getDeclaredMethod(method_name, parametertypes); } catch(NoSuchMethodException e) { throw new IOException(e.toString()); } } }
private void readObject(java.io.ObjectInputStream stream) throws IOException, ClassNotFoundException { stream.defaultReadObject(); try { toStringMethod = ((MethodSerializationWrapper) stream.readObject()).getMethod(); equalsMethod = ((MethodSerializationWrapper) stream.readObject()).getMethod(); hashCodeMethod = ((MethodSerializationWrapper) stream.readObject()).getMethod(); finalizeMethod = ((MethodSerializationWrapper) stream.readObject()).getMethod(); } catch (NoSuchMethodException e) { // ///CLOVER:OFF throw new IOException(e.toString()); // ///CLOVER:ON } }
/** * Compare two JavaBeans by their shared property. * If {@link #getProperty} is null then the actual objects will be compared. * * @param o1 Object The first bean to get data from to compare against * @param o2 Object The second bean to get data from to compare * @return int negative or positive based on order */ public int compare( final T o1, final T o2 ) { if ( property == null ) { // compare the actual objects return internalCompare( o1, o2 ); } try { final Object value1 = PropertyUtils.getProperty( o1, property ); final Object value2 = PropertyUtils.getProperty( o2, property ); return internalCompare( value1, value2 ); } catch ( final IllegalAccessException iae ) { throw new RuntimeException( "IllegalAccessException: " + iae.toString() ); } catch ( final InvocationTargetException ite ) { throw new RuntimeException( "InvocationTargetException: " + ite.toString() ); } catch ( final NoSuchMethodException nsme ) { throw new RuntimeException( "NoSuchMethodException: " + nsme.toString() ); } }
/** * Compare two JavaBeans by their shared property. * If {@link #getProperty} is null then the actual objects will be compared. * * @param o1 Object The first bean to get data from to compare against * @param o2 Object The second bean to get data from to compare * @return int negative or positive based on order */ public int compare( final T o1, final T o2 ) { if ( property == null ) { // compare the actual objects return internalCompare( o1, o2 ); } try { final Object value1 = PropertyUtils.getProperty( o1, property ); final Object value2 = PropertyUtils.getProperty( o2, property ); return internalCompare( value1, value2 ); } catch ( final IllegalAccessException iae ) { throw new RuntimeException( "IllegalAccessException: " + iae.toString() ); } catch ( final InvocationTargetException ite ) { throw new RuntimeException( "InvocationTargetException: " + ite.toString() ); } catch ( final NoSuchMethodException nsme ) { throw new RuntimeException( "NoSuchMethodException: " + nsme.toString() ); } }
new Object[] { h }); } catch (NoSuchMethodException ex) { throw (InternalError) (new InternalError(ex.toString()) .initCause(ex)); } catch (IllegalAccessException ex) {
String.format( "DataSourceFactory::invokeAllMethods: Exception in creating method using config-property-name property. Exception string=%s", ex.toString()); if (logger.isDebugEnabled()) { logger.debug(exception, ex);
/** * Verify that a specific enum type has no enum constants. * @param <E> the enum type * @param e the enum class instance */ public static <E extends Enum<E>> void assertEmptyEnum(Class<E> e) { assertEquals(0, e.getEnumConstants().length); try { try { Method m0 = e.getDeclaredMethod("values"); Object[] a = (Object[])m0.invoke(null); assertEquals(0, a.length); Method m = e.getDeclaredMethod("valueOf", String.class); m.invoke("INSTANCE"); fail("Should have thrown!"); } catch (InvocationTargetException ex) { fail(ex.toString()); } catch (IllegalAccessException ex) { fail(ex.toString()); } catch (IllegalArgumentException ex) { // we expected this } } catch (NoSuchMethodException ex) { fail(ex.toString()); } }
public Object run(){ cName = System.getProperty("org.osgi.vendor.application.ApplicationHandle"); if (cName == null) { throw new NoClassDefFoundError("org.osgi.vendor.application.ApplicationHandle property must be set"); } try { implementation = Class.forName(cName); } catch (ClassNotFoundException e) { throw new NoClassDefFoundError(e.toString()); } try { setApplicationHandle = implementation.getMethod("setApplicationHandle", new Class[] {ApplicationHandle.class, Object.class}); destroy = implementation.getMethod("destroy", new Class[] {}); } catch (NoSuchMethodException e) { throw new NoSuchMethodError(e.toString()); } return null; } });
/** * Invokes HtmlAdapterServer.start() using reflection. * * @since 1.2.16 * @param server instance of com.sun.jdmk.comm.HtmlAdapterServer. */ private static void startServer(final Object server) { try { server.getClass().getMethod("start", new Class[0]). invoke(server, new Object[0]); } catch(InvocationTargetException ex) { Throwable cause = ex.getTargetException(); if (cause instanceof RuntimeException) { throw (RuntimeException) cause; } else if (cause != null) { if (cause instanceof InterruptedException || cause instanceof InterruptedIOException) { Thread.currentThread().interrupt(); } throw new RuntimeException(cause.toString()); } else { throw new RuntimeException(); } } catch(NoSuchMethodException ex) { throw new RuntimeException(ex.toString()); } catch(IllegalAccessException ex) { throw new RuntimeException(ex.toString()); } }
throw new NoSuchMethodError(e.toString());
XSISAXHandler.logger.warning(e1.toString()); } catch (NoSuchMethodException e1) { XSISAXHandler.logger.warning(e1.toString()); } catch (ClassNotFoundException e1) { XSISAXHandler.logger.warning(e1.toString());
public PatternMatcher<V> run() { Class clz = clazz; if (clz == null) { clz = maker.createClassFile().defineClass(); cPatternMatcherClasses.put(maker.getKey(), clz); } try { Constructor ctor = clz.getConstructor(new Class[]{Object[].class}); return (PatternMatcher)ctor.newInstance(new Object[]{maker.getMappedValues()}); } catch (NoSuchMethodException e) { throw new InternalError(e.toString()); } catch (InstantiationException e) { throw new InternalError(e.toString()); } catch (IllegalAccessException e) { throw new InternalError(e.toString()); } catch (InvocationTargetException e) { throw new InternalError(e.toString()); } } });
(new Object[] {collators, usingComparators}); } catch (NoSuchMethodException e) { throw new InternalError(e.toString()); } catch (InstantiationException e) { throw new InternalError(e.toString());
private void launchAgentFromClassInfo(String resourceClassNames) throws ConfigurationException { String[] names = resourceClassNames.split("\\|"); for (String name : names) { Class<?> impl; try { impl = Class.forName(name); final Constructor<?> constructor = impl.getDeclaredConstructor(); constructor.setAccessible(true); ServerResource resource = (ServerResource)constructor.newInstance(); launchNewAgent(resource); } catch (final ClassNotFoundException e) { throw new ConfigurationException("Resource class not found: " + name + " due to: " + e.toString()); } catch (final SecurityException e) { throw new ConfigurationException("Security excetion when loading resource: " + name + " due to: " + e.toString()); } catch (final NoSuchMethodException e) { throw new ConfigurationException("Method not found excetion when loading resource: " + name + " due to: " + e.toString()); } catch (final IllegalArgumentException e) { throw new ConfigurationException("Illegal argument excetion when loading resource: " + name + " due to: " + e.toString()); } catch (final InstantiationException e) { throw new ConfigurationException("Instantiation excetion when loading resource: " + name + " due to: " + e.toString()); } catch (final IllegalAccessException e) { throw new ConfigurationException("Illegal access exception when loading resource: " + name + " due to: " + e.toString()); } catch (final InvocationTargetException e) { throw new ConfigurationException("Invocation target exception when loading resource: " + name + " due to: " + e.toString()); } } }
/** * Verify that a specific enum type has no enum constants. * @param <E> the enum type * @param e the enum class instance */ public static <E extends Enum<E>> void assertEmptyEnum(Class<E> e) { assertEquals(0, e.getEnumConstants().length); try { try { Method m0 = e.getDeclaredMethod("values"); Object[] a = (Object[])m0.invoke(null); assertEquals(0, a.length); Method m = e.getDeclaredMethod("valueOf", String.class); m.invoke("INSTANCE"); fail("Should have thrown!"); } catch (InvocationTargetException ex) { fail(ex.toString()); } catch (IllegalAccessException ex) { fail(ex.toString()); } catch (IllegalArgumentException ex) { // we expected this } } catch (NoSuchMethodException ex) { fail(ex.toString()); } }
fail(e.toString()); } catch (NoSuchMethodException e) { fail(e.toString());