本文整理了Java中org.nutz.lang.Lang.wrapThrow()
方法的一些代码示例,展示了Lang.wrapThrow()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Lang.wrapThrow()
方法的具体详情如下:
包路径:org.nutz.lang.Lang
类名称:Lang
方法名:wrapThrow
[英]用运行时异常包裹抛出对象,如果抛出对象本身就是运行时异常,则直接返回。
如果是 InvocationTargetException,那么将其剥离,只包裹其 TargetException
[中]用运行时异常包裹抛出对象,如果抛出对象本身就是运行时异常,则直接返回。
如果是 调用targetException那么将其剥离,只包裹其 目标异常
代码示例来源:origin: nutzam/nutz
public void trigger(Object obj) {
try {
method.invoke(obj);
}
catch (Exception e) {
throw Lang.wrapThrow(e);
}
}
代码示例来源:origin: nutzam/nutz
public Object get(ServletContext sc,
HttpServletRequest req,
HttpServletResponse resp,
Object refer) {
try {
return req.getReader();
}
catch (IOException e) {
throw Lang.wrapThrow(e);
}
}
代码示例来源:origin: nutzam/nutz
public MsgDigestInputStream(InputStream in, String name) {
super(in);
try {
this.md = MessageDigest.getInstance(name);
}
catch (NoSuchAlgorithmException e) {
throw Lang.wrapThrow(e);
}
}
代码示例来源:origin: nutzam/nutz
public MsgDigestOutputStream(OutputStream out, String name) {
super(out);
try {
this.md = MessageDigest.getInstance(name);
}
catch (NoSuchAlgorithmException e) {
throw Lang.wrapThrow(e);
}
}
代码示例来源:origin: nutzam/nutz
public Object eject(Object obj) {
try {
if (method != null)
return method.invoke(null, obj);
if (obj == null)
return null;
return obj.getClass().getMethod(by).invoke(obj);
}
catch (Throwable e) {
throw Lang.wrapThrow(e);
}
}
代码示例来源:origin: nutzam/nutz
/**
* @see #copyFile(File, File, long)
*/
public static boolean copyFileWithoutException(File src, File target, long count) {
try {
return copyFile(src, target, -1);
}
catch (IOException e) {
throw Lang.wrapThrow(e);
}
}
代码示例来源:origin: nutzam/nutz
public void printHeader(Writer writer) {
try {
writer.write(header.toString());
}
catch (IOException e) {
throw Lang.wrapThrow(e);
}
}
代码示例来源:origin: nutzam/nutz
public Object invoke(Object obj, String methodName, Class<?>[] types, Object... args) {
try {
return invoke(obj, obj.getClass().getDeclaredMethod(methodName, types), args);
}
catch (Exception e) {
throw Lang.wrapThrow(e);
}
}
代码示例来源:origin: nutzam/nutz
public void run() {
try {
setObj(method.invoke(dao, args));
}
catch (Exception e) {
throw Lang.wrapThrow(e);
}
}
};
代码示例来源:origin: nutzam/nutz
@Override
public Number cast(Boolean src, Class<?> toType, String... args) {
try {
return (Number) Mirror .me(toType)
.getWrapperClass()
.getConstructor(String.class)
.newInstance(src ? "1" : "0");
}
catch (Exception e) {
throw Lang.wrapThrow(e);
}
}
代码示例来源:origin: nutzam/nutz
public PropertiesProxy(InputStream in) {
this(true);
try {
load(new InputStreamReader(in));
}
catch (IOException e) {
throw Lang.wrapThrow(e);
}
finally {
Streams.safeClose(in);
}
}
代码示例来源:origin: nutzam/nutz
public synchronized File returnFile(long fId, String suffix) {
File re = _F(fId, suffix);
if (!re.exists())
try {
Files.createNewFile(re);
}
catch (IOException e) {
throw Lang.wrapThrow(e);
}
return re;
}
代码示例来源:origin: nutzam/nutz
@SuppressWarnings("unchecked")
public Object call() throws Exception {
try {
Object re = chain.doChain().getReturn();
if (hasFuture && re != null) {
return ((Future<Object>)re).get();
}
return null;
} catch (Throwable e) {
throw Lang.wrapThrow(e);
}
}
代码示例来源:origin: nutzam/nutz
public Object born(Constructor<?> constructor, Object... args) {
try {
return fast(constructor).invoke(null, args);
}
catch (Exception e) {
throw Lang.wrapThrow(e);
}
}
代码示例来源:origin: nutzam/nutz
public void addCastor(Class<?> klass) {
try {
fillMap(klass, settingMap, true);
}
catch (Throwable e) {
throw Lang.wrapThrow(Lang.unwrapThrow(e));
}
}
代码示例来源:origin: nutzam/nutz
private Object eval(IocMaking ing, Object obj) {
try {
Object v = getValue(ing, obj);
if (null == next)
return v;
return next.eval(ing, v);
}
catch (Exception e) {
throw Lang.wrapThrow(e);
}
}
代码示例来源:origin: nutzam/nutz
@Override
public String toString() {
try {
return toString(Encoding.defaultEncoding());
}
catch (IOException e) {
throw Lang.wrapThrow(e);
}
}
代码示例来源:origin: nutzam/nutz
protected boolean createObject(int index, ResultSet rs, SqlContext context, int rowCount) {
Object obj = Record.create(rs);
try {
each.invoke(index, obj, rowCount);
}
catch (LoopException e) {
throw Lang.wrapThrow(e);
}
return false;
}
};
代码示例来源:origin: nutzam/nutz
public Object get(IocMaking ing) {
try {
Collection<Object> re = Mirror.me(type).born();
for (ValueProxy vp : values)
re.add(vp.get(ing));
return re;
}
catch (Exception e) {
throw Lang.wrapThrow(e);
}
}
代码示例来源:origin: nutzam/nutz
public Object get(IocMaking ing) {
try {
Map<String, Object> map = Mirror.me(type).born();
for (Pair<ValueProxy> p : list)
map.put(p.getName(), p.getValue().get(ing));
return map;
}
catch (Exception e) {
throw Lang.wrapThrow(e);
}
}
内容来源于网络,如有侵权,请联系作者删除!