@JFinal 你好,想跟你请教个问题:
如题,每次都跳转到com.jfinal.aop.Invocation
原代码是:
public void invoke() {
if (index < inters.length) {
inters[index++].intercept(this);
}
else if (index++ == inters.length) { // index++ ensure invoke action only one time
try {
// Invoke the action
if (action != null) {
returnValue = action.getMethod().invoke(target, args);
}
// Invoke the method
else {
// if (!Modifier.isAbstract(method.getModifiers()))
// returnValue = methodProxy.invokeSuper(target, args);
if (useInjectTarget)
returnValue = methodProxy.invoke(target, args);
else
returnValue = methodProxy.invokeSuper(target, args);
}
}
catch (InvocationTargetException e) {
Throwable t = e.getTargetException();
throw t instanceof RuntimeException ? (RuntimeException)t : new RuntimeException(e);
}
catch (RuntimeException e) {
throw e;
}
catch (Throwable t) {
throw new RuntimeException(t);
}
}
}
<p>
<br>
</p>
<p>
<br>
</p>
改为以下代码,就可以查看到sql语句报的异常了
public void invoke() {
if (index < inters.length) {
inters[index++].intercept(this);
}
else if (index++ == inters.length) { // index++ ensure invoke action only one time
// Invoke the action
if (action != null) {
try {
returnValue = action.getMethod().invoke(target, args);
} catch (IllegalAccessException e) {
e.printStackTrace();
} catch (IllegalArgumentException e) {
e.printStackTrace();
} catch (InvocationTargetException e) {
e.printStackTrace();
}
}
// Invoke the method
else {
// if (!Modifier.isAbstract(method.getModifiers()))
// returnValue = methodProxy.invokeSuper(target, args);
if (useInjectTarget)
try {
returnValue = methodProxy.invoke(target, args);
} catch (Throwable e) {
e.printStackTrace();
}
else
try {
returnValue = methodProxy.invokeSuper(target, args);
} catch (Throwable e) {
e.printStackTrace();
}
}
}
}
<p>
<br>
</p>
<p>
<br>
</p>
版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。
日志没有配置好而已,你这样改源代码的结果,只会在控制台输出,不会输出到log4j配置的日志文件中去,非常不利于生产环境,e.printStackTrace()几乎没有什么合适的使用场合,是学生时代用来看看控制台异常输出的。