eclipse-ee4j / eclipse-ee4j/jersey
LinkProvider does not parse links with ';' in parameters correctly
- Dominant language
- Java
- Stars
- 730
- Forks
- 382
- PR merge metrics
- No merged PRs in 30d
Description
LinkHeader with parameter values containing ';' cause an Exception:
org.glassfish.jersey.message.internal.HeaderValueException: Unable to parse "Link" header value: "[; rel="self"; verb="GET", ; verb="GET"; rel="info"; type="application/json"; title="Information of the boundary", ; verb="GET"; rel="version"; type="text/plain"; title="Get the version of the service", ; verb="GET"; rel="new"; type="application/json;charset=UTF-8"; title="Get empty registration templates", ; verb="GET"; rel="all"; type="application/json;charset=UTF-8"; title="Read all registrations", ; verb="POST"; rel="deregister"; type="application/json;charset=UTF-8"; title="Deregister a component", ; verb="GET"; rel="search"; type="application/json;charset=UTF-8"; title="Search nearest matching registration", ; verb="GET"; rel="status"; type="application/json"; title="Get the status of the registry service", ; verb="POST"; rel="register"; type="application/json;charset=UTF-8"; title="Register a component"]"
at org.glassfish.jersey.message.internal.InboundMessageContext.exception(InboundMessageContext.java:338)
at org.glassfish.jersey.message.internal.InboundMessageContext.getLinks(InboundMessageContext.java:683)
at org.glassfish.jersey.client.ClientResponse.getLinks(ClientResponse.java:244)
at org.glassfish.jersey.client.InboundJaxrsResponse.getLinks(InboundJaxrsResponse.java:232)
at com.hartter.bpc.core.rest.client.ServiceClient$RestResponse.fromResponse(ServiceClient.java:755)
at com.hartter.bpc.core.rest.client.ServiceClient$RestResponse.access$500(ServiceClient.java:723)
at com.hartter.bpc.core.rest.client.ServiceClient$Request.(ServiceClient.java:229)
... 43 more
Caused by: java.lang.IllegalArgumentException: Unable to parse link <[http://localhost:8080/registry-binding-rest/registration](http://localhost:8080/registry-binding-rest/registration)>; verb="GET"; rel="new"; type="application/json;charset=UTF-8"; title="Get empty registration templates"
at org.glassfish.jersey.message.internal.LinkProvider.initBuilder(LinkProvider.java:125)
at org.glassfish.jersey.message.internal.JerseyLink$Builder.link(JerseyLink.java:97)
at org.glassfish.jersey.message.internal.JerseyLink$Builder.link(JerseyLink.java:73)
at javax.ws.rs.core.Link.valueOf(Link.java:173)
at org.glassfish.jersey.message.internal.InboundMessageContext.getLinks(InboundMessageContext.java:678)
... 48 more
[https://gist.github.com/anonymous/83b29da7ad08fd0ea795](https://gist.github.com/anonymous/83b29da7ad08fd0ea795)
I have posted a correction at:
[https://gist.github.com/anonymous/83b29da7ad08fd0ea795](https://gist.github.com/anonymous/83b29da7ad08fd0ea795)
#### Affected Versions
[2.22.1]
Contributor guide
Research direction
Start in LinkProvider.initBuilder, identified in the stack trace around line 125, and reproduce the failure with the Link header shown in the issue. Verify that parameter values containing semicolons are parsed without an exception and add or update the relevant parser coverage if the surrounding tests identify its location.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- api
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100