My favorites | Sign in
t-2
Project Home Downloads Wiki Issues Source
READ-ONLY: This project has been archived. For more information see this post.
Search
for
  Advanced search   Search tips   Subscriptions
Issue 275: (commons) MethodDesc#getParameterAnnotationConfigSize()でNPEが発生する
1 person starred this issue and may be notified of changes. Back to list
Status:  Fixed
Owner:  ----
Closed:  Dec 2009


 
Reported by s.sog...@gmail.com, Dec 13, 2009
What steps will reproduce the problem?
1.次のようなプラグインを作成する
    public Navigation beforeActionInvoke(ActionContext actionContext,
MethodDesc targetMethod,
            Object page, Object[] args) {
        targetMethod.getParameterAnnotationConfigSize();
    (snip)     
2. Pageクラスの引数のないメソッドを起動する。

@Page("/")
public class IndexPage {

    @Default
    public Navigation index() {
        return Forward.to("/WEB-INF/pages/index.jsp");
    }
3. 画面に次のスタックトレースが表示される

例外
javax.servlet.ServletException: java.lang.NullPointerException
	org.t2framework.t2.handler.impl.GlobalExceptionHandlerImpl.handleException(GlobalExceptionHandlerImpl.java:79)
	org.t2framework.t2.filter.T2Filter.handleException(T2Filter.java:284)
	org.t2framework.t2.filter.T2Filter.doFilter(T2Filter.java:217)
原因
java.lang.NullPointerException
	org.t2framework.commons.meta.impl.MethodDescImpl.getParameterAnnotationConfigSize(MethodDescImpl.java:139)
jp.ddo.bacons.t2sample.plugins.OvalValidationPlugin.beforeActionInvoke(OvalValidationPlugin.java:50)


What is the expected output? What do you see instead?

NPEが発生しないこと。

What version of the product are you using? On what operating system?

t2 0.6.2-ga
commons 0.6,5-ga

Please provide any additional information below.

getParameterAnnotationConfigSizeでparamertersのnullチェックをするか、
以下のところで、paramertersに空の配列を設定したほうが良いのではないでしょうか。

	protected void initParameters(final Method method) {
		this.parameterAnnotations = method.getParameterAnnotations();
		if (parameterAnnotations.length == 0) {
            // ここ 
			return;
		}
Dec 14, 2009
Project Member #1 shinpei.ohtani@gmail.com
報告ありがとうございます。

対応してみましたので、ご確認お願いします。
http://maven.t2framework.org/maven2-snapshot/org/t2framework/commons/commons/0.6.6-SNAPSHOT/commons-0.6.6-20091214.104018-4.jar

http://maven.t2framework.org/maven2-snapshot/org/t2framework/commons/commons/0.6.6-SNAPSHOT/commons-0.6.6-20091214.104018-4-sources.jar

よければ、Commonsをリリースします。宜しくお願いします。

Status: Accepted
Dec 14, 2009
#2 s.sog...@gmail.com
修正ありがとうございます。
NPEが発生せずに正常に動作することを確認しました。

よろしくお願いします。
Dec 14, 2009
Project Member #3 shinpei.ohtani@gmail.com
確認ありがとうございました。このIssueはこれにてクローズします。
これでコミットとリリースを行いたいと思います。

Status: Fixed

Powered by Google Project Hosting