Skip to content
This repository was archived by the owner on Dec 23, 2023. It is now read-only.
This repository was archived by the owner on Dec 23, 2023. It is now read-only.

Empty path results in StringIndexOutOfBoundsException #1921

Open
@dansiviter

Description

@dansiviter

Please answer these questions before submitting a bug report.

What version of OpenCensus are you using?

io.opencensus:opencensus-contrib-http-jaxrs:0.21.0

What JVM are you using (java -version)?

JDK 1.8.0_191

What did you do?

Tracing using io.opencensus.contrib.http.jaxrs.JaxrsContainerFilter with a @Path(""). Although an empty path is not strictly good practice, Jersey allows it.

What did you expect to see?

Successful trace.

What did you see instead?

java.lang.StringIndexOutOfBoundsException: String index out of range: -1
	at java.lang.AbstractStringBuilder.deleteCharAt(AbstractStringBuilder.java:824) ~[?:1.8.0_191]
	at java.lang.StringBuilder.deleteCharAt(StringBuilder.java:253) ~[?:1.8.0_191]
	at io.opencensus.contrib.http.jaxrs.JaxrsContainerExtractor.resolveRoute(JaxrsContainerExtractor.java:93) ~[opencensus-contrib-http-jaxrs-0.21.0.jar:0.21.0]
	at io.opencensus.contrib.http.jaxrs.JaxrsContainerExtractor.getRoute(JaxrsContainerExtractor.java:37) ~[opencensus-contrib-http-jaxrs-0.21.0.jar:0.21.0]

Additional context

I've implemented my own version which addresses this and it needs simply the addition of a && path.length() > 0 on line:37 of io.opencensus.contrib.http.jaxrs:JaxrsContainerExtractor.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions