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; } }
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; } }
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; } }