Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ctx.methodParams null cause NullPointerException #8

Open
andreatera opened this issue May 14, 2019 · 1 comment
Open

ctx.methodParams null cause NullPointerException #8

andreatera opened this issue May 14, 2019 · 1 comment

Comments

@andreatera
Copy link

In our EJB example we added the Interceptors annotation as follow:

@Stateless
@Interceptors({ OpenTracingInterceptor.class})
public class PartyServiceImpl implements PartyService {

and then among the code we have the following method:

@Override
public Optional<Person> getOriginalPersonOfCurrentUser() {
	Optional<PersonEntity> entity = partyRepo.getOriginalPersonOfCurrentUser();
	return abstractionOrEmpty(entity);
}

and during the execution of the code we get this exception:

A system exception occurred during an invocation on EJB PartyServiceImpl, method: public java.util.Optional ch.ergon.taifun.commonentities.party.impl.PartyServiceImpl.getPersonOfCurrentUser()
....
Caused by: java.lang.NullPointerException
	at io.opentracing.contrib.ejb.OpenTracingInterceptor.wrap(OpenTracingInterceptor.java:34)
	at sun.reflect.GeneratedMethodAccessor370.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at com.sun.ejb.containers.interceptors.AroundInvokeInterceptor.intercept(InterceptorManager.java:895)
	at com.sun.ejb.containers.interceptors.AroundInvokeChainImpl.invokeNext(InterceptorManager.java:835)
	at com.sun.ejb.EjbInvocation.proceed(EjbInvocation.java:608)
	at org.jboss.weld.ejb.AbstractEJBRequestScopeActivationInterceptor.aroundInvoke(AbstractEJBRequestScopeActivationInterceptor.java:64)
	at org.jboss.weld.ejb.SessionBeanInterceptor.aroundInvoke(SessionBeanInterceptor.java:52)
	at sun.reflect.GeneratedMethodAccessor189.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at com.sun.ejb.containers.interceptors.AroundInvokeInterceptor.intercept(InterceptorManager.java:895)
	at com.sun.ejb.containers.interceptors.AroundInvokeChainImpl.invokeNext(InterceptorManager.java:835)
	at com.sun.ejb.EjbInvocation.proceed(EjbInvocation.java:608)
	at com.sun.ejb.containers.interceptors.SystemInterceptorProxy.doCall(SystemInterceptorProxy.java:163)
	at com.sun.ejb.containers.interceptors.SystemInterceptorProxy.aroundInvoke(SystemInterceptorProxy.java:140)
	at sun.reflect.GeneratedMethodAccessor188.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)

Debugging the issue the error occurred when it tries to getParameters() on the following code part:

for(int i = 0; i < ctx.getParameters().length; ++i) {
  Object parameter = ctx.getParameters()[i];
  if (parameter instanceof SpanContext) {
@jpkrohling
Copy link
Contributor

Ouch, thanks for the report. Would you be interested in sending a PR? I think a simple conditional check before the for statement would be sufficient.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants