From: Marc L. <li...@lo...> - 2005-10-31 19:22:15
|
Hi, please take a look at that stack: java.lang.NullPointerException at java.lang.StringBuffer.<init>(StringBuffer.java:80) at org.springframework.aop.interceptor.AbstractPerformanceMonitorInterceptor.createInvocationTraceName(AbstractPerformanceMonitorInterceptor.java:80) at org.springframework.aop.interceptor.JamonPerformanceMonitorInterceptor.invokeUnderTrace(JamonPerformanceMonitorInterceptor.java:57) [..] this is the related Spring config: <!-- =================================== --> <!-- AutpoProxy Creator --> <!-- =================================== --> <bean id="proxyCreator" class="org.springframework.aop.framework.autoproxy.BeanNameAutoProxyCreator"> <property name="beanNames"> <list> <value>loginService</value> </list> </property> <property name="interceptorNames"> <list> <value>JAMonInterceptor</value> </list> </property> </bean> <bean id="JAMonInterceptor" class="org.springframework.aop.interceptor.JamonPerformanceMonitorInterceptor"/> This configuration worked for months but after upgrading to Spring 1.2.5 i am getting the stack. The reason is quite obvious, Juergen tried to be a good boy and used StringBuffer instead of String concatenation and initialized it with a Prefix, but i dont have a prefix and i dont know if its a good idea to take for granted that there is one. See the relevant method from Spring _before_ 1.2.5 --- snipp --- protected String createInvocationTraceName(MethodInvocation invocation){ String invocationData = invocation.getMethod().getDeclaringClass().getName() + "." + invocation.getMethod().getName(); return getPrefix() + invocationData + getSuffix(); } --- snapp --- Now the current one in 1.2.5: --- snipp --- protected String createInvocationTraceName(MethodInvocation invocation){ StringBuffer sb = new StringBuffer(getPrefix()); sb.append(invocation.getMethod().getDeclaringClass().getName()); sb.append('.').append(invocation.getMethod().getName()); sb.append(getSuffix()); return sb.toString(); } --- snapp --- So either we should intitialize the prefix property with "" or just dont use the parametrized constructor of StringBuffer. Tell me what you think.... Marc Logemann http://www.logemann.org |