Bug 521914 - HttpRetryException error on unauthorized access
Summary: HttpRetryException error on unauthorized access
Status: NEW
Alias: None
Product: EGit
Classification: Technology
Component: GitHub (show other bugs)
Version: 4.8   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-09-06 05:12 EDT by Maxime Chéramy CLA
Modified: 2017-09-06 05:12 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Maxime Chéramy CLA 2017-09-06 05:12:15 EDT
When trying to create a repository with an invalid token, an error is raised:

java.net.HttpRetryException: cannot retry due to server authentication, in streaming mode

This code looks suspicious to me:

```java GitHubClient.java
	protected InputStream getStream(HttpURLConnection request)
			throws IOException {
		if (request.getResponseCode() < HTTP_BAD_REQUEST)
			return request.getInputStream();
		else {
			InputStream stream = request.getErrorStream();
			return stream != null ? stream : request.getInputStream();
		}
	}
```

I don't think we should do a `request.getInputStream()` on a request with reponseCode >= 400.