/** * Create new work-in-progress. */ private ContainerAnalysis createWorkInProgress(final Class cls) { final ContainerAnalysis analysis; try { analysis = (ContainerAnalysis) constructor.newInstance(cls); } catch (InstantiationException ex) { throw new RuntimeException(ex.toString()); } catch (IllegalAccessException ex) { throw new RuntimeException(ex.toString()); } catch (InvocationTargetException ex) { throw new RuntimeException(ex.toString()); } workInProgress.put(new InProgressKey(cls, Thread.currentThread()), analysis); return analysis; }
mSetter.invoke(target, mTmpValueArray); } catch (InvocationTargetException e) { Log.e("PropertyValuesHolder", e.toString()); } catch (IllegalAccessException e) { Log.e("PropertyValuesHolder", e.toString());
mSetter.invoke(target, mTmpValueArray); } catch (InvocationTargetException e) { Log.e("PropertyValuesHolder", e.toString()); } catch (IllegalAccessException e) { Log.e("PropertyValuesHolder", e.toString());
/** * Internal function to set the value on the target object, using the setter set up * earlier on this PropertyValuesHolder object. This function is called by ObjectAnimator * to handle turning the value calculated by ValueAnimator into a value set on the object * according to the name of the property. * @param target The target object on which the value is set */ void setAnimatedValue(Object target) { if (mProperty != null) { mProperty.set(target, getAnimatedValue()); } if (mSetter != null) { try { mTmpValueArray[0] = getAnimatedValue(); mSetter.invoke(target, mTmpValueArray); } catch (InvocationTargetException e) { Log.e("PropertyValuesHolder", e.toString()); } catch (IllegalAccessException e) { Log.e("PropertyValuesHolder", e.toString()); } } }
/** * Utility function to set the value stored in a particular Keyframe. The value used is * whatever the value is for the property name specified in the keyframe on the target object. * * @param target The target object from which the current value should be extracted. * @param kf The keyframe which holds the property name and value. */ private void setupValue(Object target, Keyframe kf) { if (mProperty != null) { kf.setValue(mProperty.get(target)); } try { if (mGetter == null) { Class targetClass = target.getClass(); setupGetter(targetClass); } kf.setValue(mGetter.invoke(target)); } catch (InvocationTargetException e) { Log.e("PropertyValuesHolder", e.toString()); } catch (IllegalAccessException e) { Log.e("PropertyValuesHolder", e.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() ); } }
/** * 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() ); } }
fail("Should have thrown @ " + m); } catch (InvocationTargetException ex) { assertTrue(ex.toString(), ex.getCause() instanceof NullPointerException);
fail("Should have thrown @ " + m); } catch (InvocationTargetException ex) { assertTrue(ex.toString(), ex.getCause() instanceof NullPointerException);
/** * 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()); } }
kf.setValue(mGetter.invoke(target)); } catch (InvocationTargetException e) { Log.e("PropertyValuesHolder", e.toString()); } catch (IllegalAccessException e) { Log.e("PropertyValuesHolder", e.toString());
} catch ( InvocationTargetException e ) { log.logError( UpgradeRepositoryProgressDialog.class.toString(), "Error creating/updating repository: " + e.toString() ); log.logError( toString(), Const.getStackTracker( e ) ); showErrorDialog( e );
log.logError( RepositoryExportProgressDialog.class.toString(), "Error creating repository: " + e.toString() ); log.logError( Const.getStackTracker( e ) ); new ErrorDialog( shell, BaseMessages.getString( PKG, "RepositoryExportDialog.ErrorExport.Title" ), BaseMessages
mSetter.invoke(target, mTmpValueArray); } catch (InvocationTargetException e) { Log.e("PropertyValuesHolder", e.toString()); } catch (IllegalAccessException e) { Log.e("PropertyValuesHolder", e.toString());
/** * Internal function to set the value on the target object, using the setter set up * earlier on this PropertyValuesHolder object. This function is called by ObjectAnimator * to handle turning the value calculated by ValueAnimator into a value set on the object * according to the name of the property. * @param target The target object on which the value is set */ void setAnimatedValue(Object target) { if (mProperty != null) { mProperty.set(target, getAnimatedValue()); } if (mSetter != null) { try { mTmpValueArray[0] = getAnimatedValue(); mSetter.invoke(target, mTmpValueArray); } catch (InvocationTargetException e) { Log.e("PropertyValuesHolder", e.toString()); } catch (IllegalAccessException e) { Log.e("PropertyValuesHolder", e.toString()); } } }
mSetter.invoke(target, mTmpValueArray); } catch (InvocationTargetException e) { Log.e("PropertyValuesHolder", e.toString()); } catch (IllegalAccessException e) { Log.e("PropertyValuesHolder", e.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()); } } });
/** * Utility function to set the value stored in a particular Keyframe. The value used is * whatever the value is for the property name specified in the keyframe on the target object. * * @param target The target object from which the current value should be extracted. * @param kf The keyframe which holds the property name and value. */ private void setupValue(Object target, Keyframe kf) { if (mProperty != null) { kf.setValue(mProperty.get(target)); } try { if (mGetter == null) { Class targetClass = target.getClass(); setupGetter(targetClass); } kf.setValue(mGetter.invoke(target)); } catch (InvocationTargetException e) { Log.e("PropertyValuesHolder", e.toString()); } catch (IllegalAccessException e) { Log.e("PropertyValuesHolder", 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()); } }