java.lang.reflect.InvocationTargetException.toString()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(11.3k)|赞(0)|评价(0)|浏览(128)

本文整理了Java中java.lang.reflect.InvocationTargetException.toString()方法的一些代码示例,展示了InvocationTargetException.toString()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。InvocationTargetException.toString()方法的具体详情如下:
包路径:java.lang.reflect.InvocationTargetException
类名称:InvocationTargetException
方法名:toString

InvocationTargetException.toString介绍

暂无

代码示例

代码示例来源:origin: wildfly/wildfly

/**
 * 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;
}

代码示例来源:origin: commonsguy/cw-omnibus

mSetter.invoke(target, mTmpValueArray);
} catch (InvocationTargetException e) {
  Log.e("PropertyValuesHolder", e.toString());
} catch (IllegalAccessException e) {
  Log.e("PropertyValuesHolder", e.toString());

代码示例来源:origin: commonsguy/cw-omnibus

mSetter.invoke(target, mTmpValueArray);
} catch (InvocationTargetException e) {
  Log.e("PropertyValuesHolder", e.toString());
} catch (IllegalAccessException e) {
  Log.e("PropertyValuesHolder", e.toString());

代码示例来源:origin: commonsguy/cw-omnibus

/**
 * 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());
    }
  }
}

代码示例来源:origin: commonsguy/cw-omnibus

/**
 * 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());
  }
}

代码示例来源:origin: commons-beanutils/commons-beanutils

/**
 * 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() );
  }
}

代码示例来源:origin: wildfly/wildfly

/**
 * 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() );
  }
}

代码示例来源:origin: ReactiveX/RxJava

fail("Should have thrown @ " + m);
} catch (InvocationTargetException ex) {
  assertTrue(ex.toString(), ex.getCause() instanceof NullPointerException);

代码示例来源:origin: ReactiveX/RxJava

fail("Should have thrown @ " + m);
} catch (InvocationTargetException ex) {
  assertTrue(ex.toString(), ex.getCause() instanceof NullPointerException);

代码示例来源:origin: ReactiveX/RxJava

/**
 * 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());
  }
}

代码示例来源:origin: commonsguy/cw-omnibus

kf.setValue(mGetter.invoke(target));
} catch (InvocationTargetException e) {
  Log.e("PropertyValuesHolder", e.toString());
} catch (IllegalAccessException e) {
  Log.e("PropertyValuesHolder", e.toString());

代码示例来源:origin: pentaho/pentaho-kettle

} catch ( InvocationTargetException e ) {
 log.logError( UpgradeRepositoryProgressDialog.class.toString(), "Error creating/updating repository: "
  + e.toString() );
 log.logError( toString(), Const.getStackTracker( e ) );
 showErrorDialog( e );

代码示例来源:origin: pentaho/pentaho-kettle

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

代码示例来源:origin: com.nineoldandroids/library

mSetter.invoke(target, mTmpValueArray);
} catch (InvocationTargetException e) {
  Log.e("PropertyValuesHolder", e.toString());
} catch (IllegalAccessException e) {
  Log.e("PropertyValuesHolder", e.toString());

代码示例来源:origin: com.nineoldandroids/library

/**
 * 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());
    }
  }
}

代码示例来源:origin: com.nineoldandroids/library

mSetter.invoke(target, mTmpValueArray);
} catch (InvocationTargetException e) {
  Log.e("PropertyValuesHolder", e.toString());
} catch (IllegalAccessException e) {
  Log.e("PropertyValuesHolder", e.toString());

代码示例来源:origin: linkedin/indextank-engine

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());
    }
  }
});

代码示例来源:origin: com.nineoldandroids/library

/**
 * 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());
  }
}

代码示例来源:origin: apache/cloudstack

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());
    }
  }
}

代码示例来源:origin: akaita/RxJava2Debug

/**
 * 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());
  }
}

相关文章