opentracing-contrib/java-jaxrs

When accessing a root resource StringIndexOutOfBoundsException is thrown

pashashiz opened this issue · 2 comments

This is a stack trace, I think you need to check if a path is empty as well:

java.lang.StringIndexOutOfBoundsException: String index out of range: 0
	at java.lang.String.charAt(String.java:658) ~[?:1.8.0_151]
	at io.opentracing.contrib.jaxrs2.server.OperationNameProvider$WildcardOperationName.operationName(OperationNameProvider.java:89) ~[opentracing-jaxrs2-0.1.0.jar:?]
	at io.opentracing.contrib.jaxrs2.server.ServerTracingFilter.filter(ServerTracingFilter.java:67) ~[opentracing-jaxrs2-0.1.0.jar:?]
	at org.glassfish.jersey.server.ContainerFilteringStage.apply(ContainerFilteringStage.java:132) ~[jersey-server-2.26.jar:?]
	at org.glassfish.jersey.server.ContainerFilteringStage.apply(ContainerFilteringStage.java:68) ~[jersey-server-2.26.jar:?]
	at org.glassfish.jersey.process.internal.Stages.process(Stages.java:197) ~[jersey-common-2.26.jar:?]
	at org.glassfish.jersey.server.ServerRuntime$1.run(ServerRuntime.java:269) [jersey-server-2.26.jar:?]
	at org.glassfish.jersey.internal.Errors$1.call(Errors.java:272) [jersey-common-2.26.jar:?]

Reproduced the issue happens on Jersey on root endpoint.

I have also noticed that we have to add first / (we were stripping it) to the operation name, otherwise it will be empty which is wrong.

0.1.4 should include this fix