本文整理了Java中freemarker.core.Environment.getWrapUncheckedExceptions()
方法的一些代码示例,展示了Environment.getWrapUncheckedExceptions()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Environment.getWrapUncheckedExceptions()
方法的具体详情如下:
包路径:freemarker.core.Environment
类名称:Environment
方法名:getWrapUncheckedExceptions
暂无
代码示例来源:origin: org.freemarker/freemarker
static boolean shouldWrapUncheckedException(Throwable e, Environment env) {
if (FlowControlException.class.isInstance(e)) {
return false;
}
if (env.getWrapUncheckedExceptions()) {
return true;
} else if (env.getConfiguration().getIncompatibleImprovements().intValue() >= _TemplateAPI.VERSION_INT_2_3_27) {
// We have to judge if we dare to wrap this exception, or it's too likely that some applications try to
// catch it around the template processing to do something special. For the same reason, we only wrap very
// frequent exceptions.
// We use "==" instead of "instanceof" deliberately; user defined subclasses must not match.
Class<? extends Throwable> c = e.getClass();
return c == NullPointerException.class
|| c == ClassCastException.class
|| c == IndexOutOfBoundsException.class
|| c == InvocationTargetException.class;
} else {
return false;
}
}
代码示例来源:origin: org.freemarker/freemarker-gae
static boolean shouldWrapUncheckedException(Throwable e, Environment env) {
if (FlowControlException.class.isInstance(e)) {
return false;
}
if (env.getWrapUncheckedExceptions()) {
return true;
} else if (env.getConfiguration().getIncompatibleImprovements().intValue() >= _TemplateAPI.VERSION_INT_2_3_27) {
// We have to judge if we dare to wrap this exception, or it's too likely that some applications try to
// catch it around the template processing to do something special. For the same reason, we only wrap very
// frequent exceptions.
// We use "==" instead of "instanceof" deliberately; user defined subclasses must not match.
Class<? extends Throwable> c = e.getClass();
return c == NullPointerException.class
|| c == ClassCastException.class
|| c == IndexOutOfBoundsException.class
|| c == InvocationTargetException.class;
} else {
return false;
}
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.freemarker
static boolean shouldWrapUncheckedException(Throwable e, Environment env) {
if (FlowControlException.class.isInstance(e)) {
return false;
}
if (env.getWrapUncheckedExceptions()) {
return true;
} else if (env.getConfiguration().getIncompatibleImprovements().intValue() >= _TemplateAPI.VERSION_INT_2_3_27) {
// We have to judge if we dare to wrap this exception, or it's too likely that some applications try to
// catch it around the template processing to do something special. For the same reason, we only wrap very
// frequent exceptions.
// We use "==" instead of "instanceof" deliberately; user defined subclasses must not match.
Class<? extends Throwable> c = e.getClass();
return c == NullPointerException.class
|| c == ClassCastException.class
|| c == IndexOutOfBoundsException.class
|| c == InvocationTargetException.class;
} else {
return false;
}
}
内容来源于网络,如有侵权,请联系作者删除!