Java Code Examples for java.lang.reflect.InvocationTargetException.toString()

The following are Jave code examples for showing how to use toString() of the java.lang.reflect.InvocationTargetException class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: NotifyTools   File: BeanComparator.java   Source Code and License Vote up 7 votes
/**
 * 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() );
    }
}
 
Example 2
Project: tap17-muggl-javaee   File: SolverInfo.java   Source Code and License Vote up 7 votes
public Solver getSolver(SolverManager solverManager){
if (solver == null){
    try{
	Class classRef = Class.forName(className);
	Class[] argTypes = {SolverManager.class};
	Method newInstanceMethod = classRef.getMethod("newInstance", argTypes);
	Object[] args = {solverManager};
	solver = (Solver)newInstanceMethod.invoke(null, args);
    } catch (ClassNotFoundException cnfe){
	throw new InternalError(cnfe.toString());
    } catch (IllegalAccessException iae){
	throw new InternalError(iae.toString());
    } catch (NoSuchMethodException nsme){
	throw new InternalError("Method newInstance(SolverManager) is missing in class " + className);
    } catch (InvocationTargetException ite){
    	ite.printStackTrace();
	throw new InternalError(ite.toString());
    }
}
return solver;
   }