opentracing-contrib / opentracing-contrib/java-ejb
ctx.methodParams null cause NullPointerException
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 2
- Forks
- 4
- Avg merge
- 1d 10h
- Merged PRs (30d)
- 9
Description
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) {
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in OpenTracingInterceptor.java at line 34, where wrap calls ctx.getParameters(), and compare that behavior with the EJB example shown in the report. Reproduce the interceptor invocation and determine how a null parameter array should be handled; the issue is done when the invocation no longer throws a NullPointerException in this case.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100