playframework / playframework/play-ws
Wrong 'ahc-default.properties' resource file loaded when there's a non-shaded version of asynchttpclient in the class path.
Nobody has claimed this yet.
- Dominant language
- Scala
- Stars
- 224
- Forks
- 92
- Avg merge
- 1d 19h
- Merged PRs (30d)
- 28
Description
Are you looking for help?
Play WS Version (2.5.x / etc)
2.6.2
API (Scala / Java / Neither / Both)
Both
Operating System (Ubuntu 15.10 / MacOS 10.10 / Windows 10)
Windows 10
JDK (Oracle 1.8.0_72, OpenJDK 1.8.x, Azul Zing)
java version "1.8.0_77"
Java(TM) SE Runtime Environment (build 1.8.0_77-b03)
Java HotSpot(TM) 64-Bit Server VM (build 25.77-b03, mixed mode)
Library Dependencies
Expected Behavior
When there is a non-shaded version of asynchttpclient in the class path, depending on the order of jars in the classpath, the non-shaded version of the ahc-default.properties file can get loaded. This in turn makes config queries fail with using the prefix 'play.shaded.ahc'. I would expect the shaded library to specifically load the shaded properties files by renaming the shaded property files.
Actual Behavior
NumberFomatException occurs when trying to instantiate the AsyncHttpClientProvider class when launching a play application.
Caused by: java.lang.NumberFormatException: null
at java.lang.Integer.parseInt(Integer.java:542)
at java.lang.Integer.parseInt(Integer.java:615)
at play.shaded.ahc.org.asynchttpclient.config.AsyncHttpClientConfigHelper$Config.getInt(AsyncHttpClientConfigHelper.java:109)
at play.shaded.ahc.org.asynchttpclient.config.AsyncHttpClientConfigDefaults.defaultMaxRedirects(AsyncHttpClientConfigDefaults.java:64)
at play.shaded.ahc.org.asynchttpclient.DefaultAsyncHttpClientConfig$Builder.<init>(DefaultAsyncHttpClientConfig.java:599)
at play.api.libs.ws.ahc.AhcConfigBuilder.<init>(AhcConfig.scala:127)
at play.api.libs.ws.ahc.AsyncHttpClientProvider.<init>(AhcWSModule.scala:64)
at play.api.libs.ws.ahc.AsyncHttpClientProvider$$FastClassByGuice$$68dd0aee.newInstance(<generated>)
at com.google.inject.internal.DefaultConstructionProxyFactory$FastClassProxy.newInstance(DefaultConstructionProxyFactory.java:89)
Contributor guide
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 with the resource-loading path in the shaded AsyncHttpClient classes named in the stack trace, then trace how AhcConfig.scala and AsyncHttpClientProvider use those defaults. Reproduce the failure with shaded and non-shaded client jars in different classpath orders. Done means the shaded client consistently loads its own properties and AsyncHttpClientProvider starts without the NumberFormatException.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, scala
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100