传统的Java异常-捕获机制已不能满足当今大型企业级开发的要求。本文对Struts2提供的异常处理机制进行了研究和扩展,提出将检查型(Checked)异常转化为非检查型(Unchecked)异常进行捕获的思想,通过采用AOP拦截器技术构造一种高效的异常处理机制,提高了代码的可读性,程序的执行速度和可维护性,减少了同类代码的重复使用,避免了由于过量使用检查型(Checked)异常引起的程序结构混乱、代码逻辑复杂等缺陷。关键词:Java; struts2; 运行时异常; 检查/非检查性异常; AOP;Abstract: This paper describes the study and extension in the exception handling mechanismwhich is provides by Struts2, since the traditional Java exception try-catch mechanism has been unable to satisfy today's large-scale enterprise development. The paper proposes a capturing thought that transforms the inspected (Checked) exception to the non-inspected (Unchecked) exception. Using the AOP intercept technology to construct a kind of highly effective, unification exception handling mechanism, to enhance the code readability greatly, the performance and the maintainability of the program , thus reduce the similar codes redundant used, and avoid the excessive using inspection (Checked) exception causing program's chaotic structure, code's complex logic ,etc.Key words: Java; struts2; runtime exception; checked/unchecked exception; AOP;
猜您喜欢
推荐内容
开源项目推荐 更多
热门活动
热门器件
用户搜过
随便看看
热门下载
热门文章
评论