Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CHE-5505: Fix NPE in DockerConnector #5510

Merged
merged 2 commits into from
Jun 30, 2017
Merged

CHE-5505: Fix NPE in DockerConnector #5510

merged 2 commits into from
Jun 30, 2017

Conversation

mmorhun
Copy link
Contributor

@mmorhun mmorhun commented Jun 30, 2017

What does this PR do?

Fixes NPE in DockerConnector when Docker respond with 200 response code and empty stream.

What issues does this PR fix or reference?

#5505

Changelog

Fixed NPE when docker responds with 200 response code and empty stream.

Release Notes

N/A

Docs PR

N/A

@mmorhun mmorhun requested review from garagatyi, a user and AndrienkoAleksandr June 30, 2017 12:33
return GSON.fromJson(reader, clazz);
T objectFromJson = GSON.fromJson(reader, clazz);
if (objectFromJson == null) {
throw new IOException("Docker responded with an empty stream.");

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Empty stream says nothing to a user I suppose. And in certain cases, e.g. 301 or 201, an empty body is OK, so this message can be frustrating a bit.
WDYT about next code instead:

LOG.error("Docker response doesn't contain any data, though it was expected to contain some. Stack trace: {}", Thread.currentThread().getStackTrace());
throw new IOException("Internal server error. Unexpected response body from Docker daemon received.");

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree, this will be better.

@mmorhun mmorhun merged commit f0717e0 into master Jun 30, 2017
@mmorhun mmorhun deleted the CHE-5505 branch June 30, 2017 13:21
@codenvy-ci
Copy link

Build # 2965 - FAILED

Please check console output at https://ci.codenvycorp.com/job/che-pullrequests-build/2965/ to view the results.

@slemeur slemeur added the kind/bug Outline of a bug - must adhere to the bug report template. label Jul 6, 2017
@slemeur slemeur added this to the 5.15.0 milestone Jul 6, 2017
@slemeur
Copy link
Contributor

slemeur commented Jul 6, 2017

@mmorhun : Please assign milestone and label when merging.

JPinkney pushed a commit to JPinkney/che that referenced this pull request Aug 17, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Outline of a bug - must adhere to the bug report template.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants