eclipse-ee4j / eclipse-ee4j/jersey
InetAddresses.isUriInetAddress(String) from the emdeded guava lib could be optimized
- Dominant language
- Java
- Stars
- 730
- Forks
- 382
- PR merge metrics
- No merged PRs in 30d
Description
JerseyUriBuilder.host(String) employs InetAddresses.isUriInetAddress(String) that is embedded in jersey (repackaged or moved to uri.internal). The problem with InetAddresses.isUriInetAddress is that:
1- The flow is controlled by throwing an IllegalArgumentException which may cause a performance hit if the stack is deep (fillinstacktrace).
2- The message is passed to the exception using String.format which is also an uncalled for performance hit.
The remedy is quite simple, either change the guava dependency from 18 to 20 (it was fixed in that version) or just change the isUriInetAddress and forUriString to control the flow in a better way rather than using exceptions
#### Affected Versions
[2.22.2, 2.25.1]
Contributor guide
Research direction
Start by tracing JerseyUriBuilder.host(String) to the embedded InetAddresses.isUriInetAddress(String) and forUriString methods mentioned in the issue. Compare the embedded implementation with the Guava 20 behavior, then confirm that the chosen change preserves URI-host handling while avoiding the reported exception and String.format overhead.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- api, performance
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100