本文整理了Java中java.lang.reflect.InvocationTargetException.initCause()
方法的一些代码示例,展示了InvocationTargetException.initCause()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。InvocationTargetException.initCause()
方法的具体详情如下:
包路径:java.lang.reflect.InvocationTargetException
类名称:InvocationTargetException
方法名:initCause
暂无
代码示例来源:origin: rhuss/jolokia
private Authenticator lookupAuthenticatorWithDefaultConstructor(final Class<?> pAuthClass, final NoSuchMethodException ignore)
throws InstantiationException, IllegalAccessException {
// fallback to default constructor
try {
final Constructor<?> defaultConstructor = pAuthClass.getConstructor();
return (Authenticator) defaultConstructor.newInstance();
} catch (NoSuchMethodException e) {
e.initCause(ignore);
throw new IllegalArgumentException("Cannot create an instance of custom authenticator class, no default constructor to use", e);
} catch (InvocationTargetException e) {
e.initCause(ignore);
throw new IllegalArgumentException("Cannot create an instance of custom authenticator using default constructor", e);
}
}
代码示例来源:origin: rhuss/jolokia
private Authenticator lookupAuthenticatorWithDefaultConstructor(Class pAuthClass, NoSuchMethodException ignore) throws InstantiationException, IllegalAccessException {
// fallback to default constructor
try {
Constructor defaultConstructor = pAuthClass.getConstructor();
return (Authenticator) defaultConstructor.newInstance();
} catch (NoSuchMethodException e) {
e.initCause(ignore);
throw new IllegalArgumentException("Cannot create an instance of custom authenticator class, no default constructor to use", e);
} catch (InvocationTargetException e) {
e.initCause(ignore);
throw new IllegalArgumentException("Cannot create an instance of custom authenticator using default constructor", e);
}
}
代码示例来源:origin: org.jolokia/jolokia-osgi
private Authenticator lookupAuthenticatorWithDefaultConstructor(final Class<?> pAuthClass, final NoSuchMethodException ignore)
throws InstantiationException, IllegalAccessException {
// fallback to default constructor
try {
final Constructor<?> defaultConstructor = pAuthClass.getConstructor();
return (Authenticator) defaultConstructor.newInstance();
} catch (NoSuchMethodException e) {
e.initCause(ignore);
throw new IllegalArgumentException("Cannot create an instance of custom authenticator class, no default constructor to use", e);
} catch (InvocationTargetException e) {
e.initCause(ignore);
throw new IllegalArgumentException("Cannot create an instance of custom authenticator using default constructor", e);
}
}
代码示例来源:origin: org.jolokia/jolokia-server-core
private Authenticator lookupAuthenticatorWithDefaultConstructor(final Class<?> pAuthClass, final NoSuchMethodException ignore)
throws InstantiationException, IllegalAccessException {
// fallback to default constructor
try {
final Constructor<?> defaultConstructor = pAuthClass.getConstructor();
return (Authenticator) defaultConstructor.newInstance();
} catch (NoSuchMethodException e) {
e.initCause(ignore);
throw new IllegalArgumentException("Cannot create an instance of custom authenticator class, no default constructor to use", e);
} catch (InvocationTargetException e) {
e.initCause(ignore);
throw new IllegalArgumentException("Cannot create an instance of custom authenticator using default constructor", e);
}
}
代码示例来源:origin: org.opentcs.thirdparty.jhotdraw/jhotdraw
/**
* Reads the view from the specified uri.
*/
@Override
public void read(URI f, URIChooser chooser) throws IOException {
try {
final Drawing drawing = createDrawing();
InputFormat inputFormat = drawing.getInputFormats().get(0);
inputFormat.read(f, drawing, true);
SwingUtilities.invokeAndWait(new Runnable() {
@Override
public void run() {
view.getDrawing().removeUndoableEditListener(undo);
view.setDrawing(drawing);
view.getDrawing().addUndoableEditListener(undo);
undo.discardAllEdits();
}
});
} catch (InterruptedException e) {
InternalError error = new InternalError();
e.initCause(e);
throw error;
} catch (InvocationTargetException e) {
InternalError error = new InternalError();
e.initCause(e);
throw error;
}
}
代码示例来源:origin: org.opentcs.thirdparty.jhotdraw/jhotdraw
/**
* Reads the view from the specified uri.
*/
@Override
public void read(URI f, URIChooser chooser) throws IOException {
try {
final Drawing drawing = createDrawing();
InputFormat inputFormat = drawing.getInputFormats().get(0);
inputFormat.read(f, drawing, true);
SwingUtilities.invokeAndWait(new Runnable() {
@Override
public void run() {
view.getDrawing().removeUndoableEditListener(undo);
view.setDrawing(drawing);
view.getDrawing().addUndoableEditListener(undo);
undo.discardAllEdits();
}
});
} catch (InterruptedException e) {
InternalError error = new InternalError();
e.initCause(e);
throw error;
} catch (InvocationTargetException e) {
InternalError error = new InternalError();
e.initCause(e);
throw error;
}
}
内容来源于网络,如有侵权,请联系作者删除!