Java开发网 Java开发网
注册 | 登录 | 帮助 | 搜索 | 排行榜 | 发帖统计  

您没有登录

» Java开发网 » Application Server » Tomcat  

按打印兼容模式打印这个话题 打印话题    把这个话题寄给朋友 寄给朋友    该主题的所有更新都将Email到你的邮箱 订阅主题
flat modethreaded modego to previous topicgo to next topicgo to back
作者 修改 Tomcat 5.0.x 5.5.x jasper 不會正確指出錯誤行號
scottlai



元老


发贴: 451
积分: 366
于 2006-06-21 20:59 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
Download tomcat source

修改 <tomcat-src>/jasper/src/share/org/apache/jasper/compiler/ErrorDispatcher.java

尋找

javacError = new JavacErrorDetail(
fname,
lineNum,
errNode.getStart().getFile(),
errNode.getStart().getLineNumber(),
errMsgBuf);



改成

javacError = new JavacErrorDetail(
fname,
lineNum,
errNode.getStart().getFile(),
//------------------------------------------------------------------
lineNum - errNode.getBeginJavaLine() + errNode.getStart().getLineNumber(),
//------------------------------------------------------------------
errMsgBuf);


....
然後compile
再壓回 jasper-compiler.jar


scottlai edited on 2006-06-21 21:03

作者 Re:修改 Tomcat 5.0.x 5.5.x jasper 不會正確指出錯誤行號 [Re:scottlai]
bluepure

pureblue



发贴: 509
积分: 85
于 2006-06-22 09:42 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
建议提交 bug 到 http://issues.apache.org/bugzilla/

前段时间我提交了个小bug和解决方法,被审核通过了,开心 :)



作者 Re:修改 Tomcat 5.0.x 5.5.x jasper 不會正確指出錯誤行號 [Re:bluepure]
scottlai



元老


发贴: 451
积分: 366
于 2006-06-22 13:25 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
bluepure wrote:
建议提交 bug 到 http://issues.apache.org/bugzilla/

前段时间我提交了个小bug和解决方法,被审核通过了,开心 :)

我覺的這應該是安全性的問題.
因為正確指出行號有可能會造成CODE 洩漏的問題...



作者 Re:修改 Tomcat 5.0.x 5.5.x jasper 不會正確指出錯誤行號 [Re:scottlai]
zcjl

涅槃



发贴: 537
积分: 65
于 2006-06-23 09:31 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
恕我驽钝,Tomcat 5.0.x和5.5.x我都有使用,怎么没发现标题里“jasper 不會正確指出錯誤行號”的现象呢?为了验证这个问题,我特意写了一个肯定会抛出NullPointerException的test.jsp,源代码、编译后的servlet代码以及在Tomcat5.5.17下的运行结果分别如下
//test.jsp


//test_jsp.java


//error message 1


//error message 2


zcjl edited on 2006-06-23 09:38

作者 Re:修改 Tomcat 5.0.x 5.5.x jasper 不會正確指出錯誤行號 [Re:zcjl]
scottlai



元老


发贴: 451
积分: 366
于 2006-06-23 11:39 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
不是RUNTIME
是COMPILE TIME

你把16的str.eq... 改成str1.eq...



作者 Re:修改 Tomcat 5.0.x 5.5.x jasper 不會正確指出錯誤行號 [Re:scottlai]
zcjl

涅槃



发贴: 537
积分: 65
于 2006-06-23 11:50 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
scottlai wrote:
不是RUNTIME
是COMPILE TIME

你把16的str.eq... 改成str1.eq...

结果则是对jsp源码的行号报错不准确(本来在16行,报错信息中为14行),编译后的servlet源码的报错则是准确的,如下图:


不过这个多半是bug,而不应该是出于安全的考虑


zcjl edited on 2006-06-23 11:52


flat modethreaded modego to previous topicgo to next topicgo to back
  已读帖子
  新的帖子
  被删除的帖子
Jump to the top of page

   Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent
Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1
客服电话 18559299278    客服信箱 714923@qq.com    客服QQ 714923