[CONTAINER-357] [S2Container] AbstractInterceptor の冗長なコードを削除しました. Created: 2009-04-12 Updated: 2009-04-13 Resolved: 2009-04-13 |
|
Status: | Resolved |
Project: | S2Container |
Component/s: | S2Container |
Affects Version/s: | 2.4.34 |
Fix Version/s: | 2.4.35 |
Type: | Improvement | Priority: | Major |
Reporter: | r_ikeda | Assignee: | koichik |
Resolution: | Fixed | Votes: | 0 |
Labels: | None |
Description |
org.seasar.framework.aop.interceptors.AbstractInterceptor の getTargetClass メソッドについてです。 protected Class getTargetClass(MethodInvocation invocation) { if (invocation instanceof S2MethodInvocation) { return ((S2MethodInvocation) invocation).getTargetClass(); } Class thisClass = invocation.getThis().getClass(); Class superClass = thisClass.getSuperclass(); if (superClass == Object.class) { return thisClass.getInterfaces()[0]; } return superClass; } 8 行目で thisClass.getInterfaces()[0]; としていますが、インターフェースを実装していないクラスの場合、 Index: s2-framework/src/main/java/org/seasar/framework/aop/interceptors/AbstractInterceptor.java =================================================================== --- s2-framework/src/main/java/org/seasar/framework/aop/interceptors/AbstractInterceptor.java (revision 4270) +++ s2-framework/src/main/java/org/seasar/framework/aop/interceptors/AbstractInterceptor.java (working copy) @@ -63,10 +63,14 @@ } Class thisClass = invocation.getThis().getClass(); Class superClass = thisClass.getSuperclass(); - if (superClass == Object.class) { - return thisClass.getInterfaces()[0]; + if (superClass != Object.class) { + return superClass; } - return superClass; + Class[] interfaces = thisClass.getInterfaces(); + if (interfaces.length > 0) { + return interfaces[0]; + } + return thisClass; } /** |
Comments |
Comment by koichik [ 2009-04-13 ] |
対応しました. |