本文整理了Java中java.lang.IllegalAccessException.initCause()
方法的一些代码示例,展示了IllegalAccessException.initCause()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。IllegalAccessException.initCause()
方法的具体详情如下:
包路径:java.lang.IllegalAccessException
类名称:IllegalAccessException
方法名:initCause
暂无
代码示例来源:origin: junit-team/junit4
+ "'. Ensure that the field '" + field.getName()
+ "' is public.");
wrappedException.initCause(e);
throw wrappedException;
} catch (IllegalArgumentException iare) {
代码示例来源:origin: apache/attic-polygene-java
illegalAccessException.initCause( e.getTargetException() );
throw cleanStackTrace( illegalAccessException, proxy, method );
代码示例来源:origin: de.richtercloud/flexdock-core
e.initCause(t);
throw e;
代码示例来源:origin: intermine/intermine
/**
* Returns the value of a public or protected Field of an Object given by the field name without
* dereferencing any ProxyReference objects.
*
* @param o the Object
* @param fieldName the name of the relevant Field
* @return the value of the field, without dereferencing ProxyReferences
* @throws IllegalAccessException if the field is inaccessible
*/
public static Object getFieldProxy(Object o, String fieldName) throws IllegalAccessException {
try {
Method proxyGetter = getProxyGetter(o.getClass(), fieldName);
if (proxyGetter == null) {
proxyGetter = getGetter(o.getClass(), fieldName);
}
return proxyGetter.invoke(o, new Object[] {});
} catch (Exception e) {
String type = null;
try {
type = getFieldInfo(o.getClass(), fieldName).getGetter().getReturnType().getName();
} catch (Exception e3) {
// ignore
}
IllegalAccessException e2 = new IllegalAccessException("Couldn't proxyGet field \""
+ o.getClass().getName() + "." + fieldName + "\""
+ (type == null ? "" : " (a " + type + ")"));
e2.initCause(e);
throw e2;
}
}
代码示例来源:origin: intermine/intermine
/**
* Returns the value of a public or protected Field of an Object given the field name
*
* @param o the Object
* @param fieldName the name of the relevant Field
* @return the value of the Field
* @throws IllegalAccessException if the field is inaccessible
*/
public static Object getFieldValue(Object o, String fieldName)
throws IllegalAccessException {
try {
return getGetter(o.getClass(), fieldName).invoke(o, new Object[] {});
} catch (Exception e) {
String type = "";
try {
type = " (a " + getFieldInfo(o.getClass(), fieldName).getGetter().getReturnType()
.getName() + ")";
} catch (Exception e3) {
type = " (available fields are " + getFieldInfos(o.getClass()).keySet() + ")";
}
IllegalAccessException e2 = new IllegalAccessException("Couldn't get field \""
+ Util.decomposeClass(o.getClass()) + "." + fieldName + "\""
+ type);
e2.initCause(e);
throw e2;
}
}
代码示例来源:origin: EvoSuite/evosuite
@Override
public synchronized Throwable initCause(Throwable cause) {
if(!MockFramework.isEnabled()){
return super.initCause(cause);
}
return getDelegate().initCause(cause);
}
代码示例来源:origin: org.intermine/intermine-model
/**
* Returns the value of a public or protected Field of an Object given by the field name without
* dereferencing any ProxyReference objects.
*
* @param o the Object
* @param fieldName the name of the relevant Field
* @return the value of the field, without dereferencing ProxyReferences
* @throws IllegalAccessException if the field is inaccessible
*/
public static Object getFieldProxy(Object o, String fieldName) throws IllegalAccessException {
try {
Method proxyGetter = getProxyGetter(o.getClass(), fieldName);
if (proxyGetter == null) {
proxyGetter = getGetter(o.getClass(), fieldName);
}
return proxyGetter.invoke(o, new Object[] {});
} catch (Exception e) {
String type = null;
try {
type = getFieldInfo(o.getClass(), fieldName).getGetter().getReturnType().getName();
} catch (Exception e3) {
// ignore
}
IllegalAccessException e2 = new IllegalAccessException("Couldn't proxyGet field \""
+ o.getClass().getName() + "." + fieldName + "\""
+ (type == null ? "" : " (a " + type + ")"));
e2.initCause(e);
throw e2;
}
}
代码示例来源:origin: org.intermine/intermine-model
/**
* Returns the value of a public or protected Field of an Object given the field name
*
* @param o the Object
* @param fieldName the name of the relevant Field
* @return the value of the Field
* @throws IllegalAccessException if the field is inaccessible
*/
public static Object getFieldValue(Object o, String fieldName)
throws IllegalAccessException {
try {
return getGetter(o.getClass(), fieldName).invoke(o, new Object[] {});
} catch (Exception e) {
String type = "";
try {
type = " (a " + getFieldInfo(o.getClass(), fieldName).getGetter().getReturnType()
.getName() + ")";
} catch (Exception e3) {
type = " (available fields are " + getFieldInfos(o.getClass()).keySet() + ")";
}
IllegalAccessException e2 = new IllegalAccessException("Couldn't get field \""
+ Util.decomposeClass(o.getClass()) + "." + fieldName + "\""
+ type);
e2.initCause(e);
throw e2;
}
}
代码示例来源:origin: org.jgroups/com.springsource.org.jgroups
private static Address readOtherAddress(DataInputStream in) throws IOException, IllegalAccessException, InstantiationException {
ClassConfigurator conf;
try {
conf=ClassConfigurator.getInstance(false);
}
catch(ChannelException e) {
IllegalAccessException new_ex=new IllegalAccessException();
new_ex.initCause(e);
throw new_ex;
}
int b=in.read();
short magic_number;
String classname;
Class cl=null;
Address addr;
if(b == 1) {
magic_number=in.readShort();
cl=conf.get(magic_number);
}
else {
classname=in.readUTF();
cl=conf.get(classname);
}
addr=(Address)cl.newInstance();
addr.readFrom(in);
return addr;
}
内容来源于网络,如有侵权,请联系作者删除!