freemarker.core.Environment.getWrapUncheckedExceptions()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(2.9k)|赞(0)|评价(0)|浏览(173)

本文整理了Java中freemarker.core.Environment.getWrapUncheckedExceptions()方法的一些代码示例,展示了Environment.getWrapUncheckedExceptions()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Environment.getWrapUncheckedExceptions()方法的具体详情如下:
包路径:freemarker.core.Environment
类名称:Environment
方法名:getWrapUncheckedExceptions

Environment.getWrapUncheckedExceptions介绍

暂无

代码示例

代码示例来源:origin: org.freemarker/freemarker

  1. static boolean shouldWrapUncheckedException(Throwable e, Environment env) {
  2. if (FlowControlException.class.isInstance(e)) {
  3. return false;
  4. }
  5. if (env.getWrapUncheckedExceptions()) {
  6. return true;
  7. } else if (env.getConfiguration().getIncompatibleImprovements().intValue() >= _TemplateAPI.VERSION_INT_2_3_27) {
  8. // We have to judge if we dare to wrap this exception, or it's too likely that some applications try to
  9. // catch it around the template processing to do something special. For the same reason, we only wrap very
  10. // frequent exceptions.
  11. // We use "==" instead of "instanceof" deliberately; user defined subclasses must not match.
  12. Class<? extends Throwable> c = e.getClass();
  13. return c == NullPointerException.class
  14. || c == ClassCastException.class
  15. || c == IndexOutOfBoundsException.class
  16. || c == InvocationTargetException.class;
  17. } else {
  18. return false;
  19. }
  20. }

代码示例来源:origin: org.freemarker/freemarker-gae

  1. static boolean shouldWrapUncheckedException(Throwable e, Environment env) {
  2. if (FlowControlException.class.isInstance(e)) {
  3. return false;
  4. }
  5. if (env.getWrapUncheckedExceptions()) {
  6. return true;
  7. } else if (env.getConfiguration().getIncompatibleImprovements().intValue() >= _TemplateAPI.VERSION_INT_2_3_27) {
  8. // We have to judge if we dare to wrap this exception, or it's too likely that some applications try to
  9. // catch it around the template processing to do something special. For the same reason, we only wrap very
  10. // frequent exceptions.
  11. // We use "==" instead of "instanceof" deliberately; user defined subclasses must not match.
  12. Class<? extends Throwable> c = e.getClass();
  13. return c == NullPointerException.class
  14. || c == ClassCastException.class
  15. || c == IndexOutOfBoundsException.class
  16. || c == InvocationTargetException.class;
  17. } else {
  18. return false;
  19. }
  20. }

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.freemarker

  1. static boolean shouldWrapUncheckedException(Throwable e, Environment env) {
  2. if (FlowControlException.class.isInstance(e)) {
  3. return false;
  4. }
  5. if (env.getWrapUncheckedExceptions()) {
  6. return true;
  7. } else if (env.getConfiguration().getIncompatibleImprovements().intValue() >= _TemplateAPI.VERSION_INT_2_3_27) {
  8. // We have to judge if we dare to wrap this exception, or it's too likely that some applications try to
  9. // catch it around the template processing to do something special. For the same reason, we only wrap very
  10. // frequent exceptions.
  11. // We use "==" instead of "instanceof" deliberately; user defined subclasses must not match.
  12. Class<? extends Throwable> c = e.getClass();
  13. return c == NullPointerException.class
  14. || c == ClassCastException.class
  15. || c == IndexOutOfBoundsException.class
  16. || c == InvocationTargetException.class;
  17. } else {
  18. return false;
  19. }
  20. }

相关文章

Environment类方法