本文整理了Java中java.lang.reflect.InvocationTargetException.<init>()
方法的一些代码示例,展示了InvocationTargetException.<init>()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。InvocationTargetException.<init>()
方法的具体详情如下:
包路径:java.lang.reflect.InvocationTargetException
类名称:InvocationTargetException
方法名:<init>
[英]Constructs a new InvocationTargetException instance with a null cause / target exception.
[中]构造具有空原因/目标异常的新InvocationTargetException实例。
代码示例来源:origin: pentaho/pentaho-kettle
public void run( IProgressMonitor monitor ) throws InvocationTargetException, InterruptedException {
try {
Xpaths = doScan( monitor );
} catch ( Exception e ) {
e.printStackTrace();
throw new InvocationTargetException( e, BaseMessages.getString( PKG,
"GetXMLDateLoopNodesImportProgressDialog.Exception.ErrorScanningFile", filename, e.toString() ) );
}
}
};
代码示例来源:origin: pentaho/pentaho-kettle
public void run( IProgressMonitor monitor ) throws InvocationTargetException, InterruptedException {
try {
fields = doScan( monitor );
} catch ( Exception e ) {
e.printStackTrace();
throw new InvocationTargetException( e, BaseMessages.getString( PKG,
"GetXMLDateLoopNodesImportProgressDialog.Exception.ErrorScanningFile", filename, e.toString() ) );
}
}
};
代码示例来源:origin: pentaho/pentaho-kettle
public void run( IProgressMonitor monitor ) throws InvocationTargetException, InterruptedException {
try {
message = doScan( monitor, failOnParseError );
} catch ( Exception e ) {
e.printStackTrace();
throw new InvocationTargetException( e,
BaseMessages.getString( PKG, "TextFileCSVImportProgressDialog.Exception.ErrorScanningFile",
"" + rownumber, debug, e.toString() ) );
}
}
};
代码示例来源:origin: pentaho/pentaho-kettle
public void run( IProgressMonitor monitor ) throws InvocationTargetException, InterruptedException {
try {
message = doScan( monitor, failOnParseError );
} catch ( Exception e ) {
e.printStackTrace();
throw new InvocationTargetException( e, BaseMessages.getString( PKG,
"TextFileCSVImportProgressDialog.Exception.ErrorScanningFile", "" + rownumber, debug, e.toString() ) );
}
}
};
代码示例来源:origin: EsotericSoftware/kryonet
public Object invoke (Object target, Object[] args) throws IllegalAccessException, InvocationTargetException {
try {
return methodAccess.invoke(target, methodAccessIndex, args);
} catch (Exception ex) {
throw new InvocationTargetException(ex);
}
}
}
代码示例来源:origin: wildfly/wildfly
protected static Throwable exceptionFromStream(DataInput in, int recursion_count) throws Exception {
// 1. null check
if(in.readBoolean())
return null;
// 2. InvocationTargetException
if(in.readBoolean())
return new InvocationTargetException(readException(in, recursion_count));
return readException(in, recursion_count);
}
代码示例来源:origin: pentaho/pentaho-kettle
public void run( IProgressMonitor monitor ) throws InvocationTargetException, InterruptedException {
db = new Database( Spoon.loggingObject, dbMeta );
try {
db.connect();
result = db.getQueryFields( sql, false );
if ( monitor.isCanceled() ) {
throw new InvocationTargetException( new Exception( "This operation was cancelled!" ) );
}
} catch ( Exception e ) {
throw new InvocationTargetException( e, "Problem encountered determining query fields: " + e.toString() );
} finally {
db.disconnect();
}
}
};
代码示例来源:origin: pentaho/pentaho-kettle
public void run( IProgressMonitor monitor ) throws InvocationTargetException, InterruptedException {
try {
rep.save( jobMeta, versionComment, new ProgressMonitorAdapter( monitor ) );
} catch ( KettleException e ) {
throw new InvocationTargetException( e, "Error saving job" );
}
}
};
代码示例来源:origin: pentaho/pentaho-kettle
public void run( IProgressMonitor monitor ) throws InvocationTargetException, InterruptedException {
try {
impact.clear(); // Start with a clean slate!!
transMeta.analyseImpact( impact, new ProgressMonitorAdapter( monitor ) );
impactHasRun = true;
} catch ( Exception e ) {
impact.clear();
impactHasRun = false;
// Problem encountered generating impact list: {0}
throw new InvocationTargetException( e, BaseMessages.getString(
PKG, "AnalyseImpactProgressDialog.RuntimeError.UnableToAnalyzeImpact.Exception", e.toString() ) );
}
}
};
代码示例来源:origin: pentaho/pentaho-kettle
public void run( IProgressMonitor monitor ) throws InvocationTargetException, InterruptedException {
try {
transMeta.checkSteps(
remarks, onlySelected, new ProgressMonitorAdapter( monitor ), space, repository, metaStore );
} catch ( Exception e ) {
throw new InvocationTargetException( e, BaseMessages.getString(
PKG, "AnalyseImpactProgressDialog.RuntimeError.ErrorCheckingTransformation.Exception", e.toString() ) );
}
}
};
代码示例来源:origin: pentaho/pentaho-kettle
public void run( IProgressMonitor monitor ) throws InvocationTargetException, InterruptedException {
try {
dmi.getData( Spoon.loggingObject, new ProgressMonitorAdapter( monitor ) );
} catch ( Exception e ) {
throw new InvocationTargetException( e, BaseMessages.getString(
PKG, "GetDatabaseInfoProgressDialog.Error.GettingInfoTable", e.toString() ) );
}
}
};
代码示例来源:origin: google/guava
private static <T> void callAllPublicMethods(TypeToken<T> type, T object)
throws InvocationTargetException {
for (Method method : type.getRawType().getMethods()) {
if ((method.getModifiers() & STATIC) != 0) {
continue;
}
ImmutableList<Parameter> parameters = type.method(method).getParameters();
Object[] args = new Object[parameters.size()];
for (int i = 0; i < parameters.size(); i++) {
args[i] = getDefaultValue(parameters.get(i).getType());
}
try {
try {
method.invoke(object, args);
} catch (InvocationTargetException ex) {
try {
throw ex.getCause();
} catch (UnsupportedOperationException unsupported) {
// this is a legit exception
}
}
} catch (Throwable cause) {
throw new InvocationTargetException(
cause, method + " with args: " + Arrays.toString(args));
}
}
}
}
代码示例来源:origin: Karumi/Rosie
private InvocationTargetException givenAnInvocationExceptionWrappingAnErrorNotHandledException() {
ErrorNotHandledException errorNotHandledException = new ErrorNotHandledException(error);
return new InvocationTargetException(errorNotHandledException);
}
代码示例来源:origin: pentaho/pentaho-kettle
public void run( IProgressMonitor monitor ) throws InvocationTargetException, InterruptedException {
// This is running in a new process: copy some KettleVariables info
// LocalVariables.getInstance().createKettleVariables(Thread.currentThread(), parentThread, true);
// --> don't set variables if not running in different thread --> pmd.run(true,true, op);
try {
stats = transMeta.getSQLStatements( new ProgressMonitorAdapter( monitor ) );
} catch ( KettleException e ) {
throw new InvocationTargetException( e, BaseMessages.getString(
PKG, "GetSQLProgressDialog.RuntimeError.UnableToGenerateSQL.Exception", e.getMessage() ) );
}
}
};
代码示例来源:origin: pentaho/pentaho-kettle
public void run( IProgressMonitor monitor ) throws InvocationTargetException, InterruptedException {
try {
rep.save( meta, versionComment, new ProgressMonitorAdapter( monitor ) );
} catch ( KettleException e ) {
throw new InvocationTargetException( e, BaseMessages.getString(
PKG, "TransSaveProgressDialog.Exception.ErrorSavingTransformation" )
+ e.toString() );
}
}
};
代码示例来源:origin: springside/springside4
@Test
public void convertReflectionExceptionToUnchecked() {
IllegalArgumentException iae = new IllegalArgumentException();
// ReflectionException,normal
RuntimeException e = ReflectionUtil.convertReflectionExceptionToUnchecked(iae);
assertThat(e).isEqualTo(iae);
// InvocationTargetException,extract it's target exception.
Exception ex = new Exception();
e = ReflectionUtil.convertReflectionExceptionToUnchecked(new InvocationTargetException(ex));
assertThat(e.getCause()).isEqualTo(ex);
// UncheckedException, ignore it.
RuntimeException re = new RuntimeException("abc");
e = ReflectionUtil.convertReflectionExceptionToUnchecked(re);
assertThat(e).hasMessage("abc");
// Unexcepted Checked exception.
e = ReflectionUtil.convertReflectionExceptionToUnchecked(ex);
assertThat(e).isInstanceOf(UncheckedException.class);
}
代码示例来源:origin: springside/springside4
@Test
public void unwrap() {
RuntimeException re = new RuntimeException("my runtime");
assertThat(ExceptionUtil.unwrap(re)).isSameAs(re);
ExecutionException ee = new ExecutionException(re);
assertThat(ExceptionUtil.unwrap(ee)).isSameAs(re);
InvocationTargetException ie = new InvocationTargetException(re);
assertThat(ExceptionUtil.unwrap(ie)).isSameAs(re);
Exception e = new Exception("my exception");
ExecutionException ee2 = new ExecutionException(e);
try{
ExceptionUtil.unwrapAndUnchecked(ee2);
}catch (Throwable t) {
assertThat(t).isInstanceOf(UncheckedException.class).hasCauseExactlyInstanceOf(Exception.class);
}
}
代码示例来源:origin: jdbi/jdbi
@Test
public void invocationTargetExceptionIsUnwrapped() {
Throwable cause = new WhateverException();
InvocationTargetException ite = new InvocationTargetException(cause);
assertThatThrownBy(() -> Sneaky.throwAnyway(ite))
.isSameAs(cause);
}
代码示例来源:origin: apache/hive
@Test
public void testWrappedMetaExceptionRetry() throws MetaException {
IHMSHandler mockBaseHandler = Mockito.mock(IHMSHandler.class);
Mockito.when(mockBaseHandler.getConf()).thenReturn(conf);
//JDOException wrapped in MetaException wrapped in InvocationException
MetaException me = new MetaException("Dummy exception");
me.initCause(new JDOException());
InvocationTargetException ex = new InvocationTargetException(me);
Mockito
.doThrow(me)
.doNothing()
.when(mockBaseHandler).init();
RetryingHMSHandler.getProxy(conf, mockBaseHandler, false);
Mockito.verify(mockBaseHandler, Mockito.times(2)).init();
}
}
代码示例来源:origin: pentaho/pentaho-kettle
public void run( IProgressMonitor monitor ) throws InvocationTargetException, InterruptedException {
db = new Database( Spoon.loggingObject, dbMeta );
try {
db.connect();
if ( limit > 0 ) {
db.setQueryLimit( limit );
}
rows = db.getFirstRows( tableName, limit, new ProgressMonitorAdapter( monitor ) );
rowMeta = db.getReturnRowMeta();
} catch ( KettleException e ) {
throw new InvocationTargetException( e, "Couldn't find any rows because of an error :" + e.toString() );
} finally {
db.disconnect();
}
}
};
内容来源于网络,如有侵权,请联系作者删除!