patreon-java icon indicating copy to clipboard operation
patreon-java copied to clipboard

Fix invalid URL on all requests

Open Fabricio20 opened this issue 5 years ago • 1 comments

This PR fixes an Invalid URL issue that is currently happening on Patreon-Java.

java.io.FileNotFoundException: https://www.patreon.com/api/oauth2/api//campaigns/123123/pledges?page%5Bcount%5D=15
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1915)
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1515)
    at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:251)
    at com.patreon.resources.RequestUtil.request(RequestUtil.java:26)
    at com.patreon.PatreonAPI.getDataStream(PatreonAPI.java:201)
    at com.patreon.PatreonAPI.fetchPageOfPledges(PatreonAPI.java:156)
    at com.patreon.PatreonAPI.fetchPageOfPledges(PatreonAPI.java:129)
    at com.patreon.PatreonAPI.fetchAllPledges(PatreonAPI.java:189)

This path issue has been present on Patreon-Java for a long time now but Patreon API never had issues with it, recently however, I started to receive a FileNotFound/404 on the URL because of that extra / in there.

Fabricio20 avatar Oct 13 '19 21:10 Fabricio20

+1

This is happening to me now too since I've migrated from Java 8 to 11

Edit: Digging further, it looks like a more specific version of my earlier message would be to say that it works fine on httpclient-4.5.6 but is broken on httpclient-4.5.10 because of how URIBuilder works. Specifially, URIBuilder.buildString() stopped using a method normalizePath() which decided on whether or not to add a leading slash.

So this is not really something that can be changed in this repo since fixing it for some will break it for others. Repo needs to package up its dependencies.

decmurphy avatar Feb 08 '20 20:02 decmurphy