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

Add a null check before reading GitHub response #563

Merged
merged 5 commits into from
Sep 21, 2023
Merged

Add a null check before reading GitHub response #563

merged 5 commits into from
Sep 21, 2023

Conversation

vinokurig
Copy link
Contributor

What does this PR do?

Add a null check to prevent NullPointer exception while reading body from the GitHub API response. response.body() should not return null according to the java documentation, but the NullPointer exception was found in the customer debug logs:

Caused by: java.lang.NullPointerException: null
	at java.base/java.io.Reader.<init>(Reader.java:168)
	at java.base/java.io.InputStreamReader.<init>(InputStreamReader.java:112)
	at org.eclipse.che.api.factory.server.github.GithubApiClient.executeRequest(GithubApiClient.java:278)
	at org.eclipse.che.api.factory.server.github.GithubApiClient.getLatestCommit(GithubApiClient.java:184)
	at org.eclipse.che.api.factory.server.github.GithubURLParser.getLatestCommit(GithubURLParser.java:251)
	at org.eclipse.che.api.factory.server.github.GithubURLParser.parse(GithubURLParser.java:163)
	at org.eclipse.che.api.factory.server.github.GithubURLParser.parse(GithubURLParser.java:115)
	at org.eclipse.che.api.factory.server.github.GithubFactoryParametersResolver.createFactory(GithubFactoryParametersResolver.java:124)
	at org.eclipse.che.api.factory.server.FactoryService.resolveFactory(FactoryService.java:111)

Screenshot/screencast of this PR

What issues does this PR fix or reference?

https://issues.redhat.com/browse/CRW-4506

How to test this PR?

N/A

PR Checklist

As the author of this Pull Request I made sure that:

Reviewers

Reviewers, please comment how you tested the PR when approving it.

@ibuziuk
Copy link
Member

ibuziuk commented Sep 13, 2023

/retest

Copy link
Member

@ibuziuk ibuziuk left a comment

Choose a reason for hiding this comment

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

can we add the test for that?

@vinokurig
Copy link
Contributor Author

@ibuziuk

can we add the test for that?

done

@vinokurig
Copy link
Contributor Author

/retest

@openshift-ci
Copy link

openshift-ci bot commented Sep 19, 2023

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: tolusha, vinokurig

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@vinokurig vinokurig merged commit 261be8f into main Sep 21, 2023
4 checks passed
@vinokurig vinokurig deleted the CRW-4506 branch September 21, 2023 07:48
@devstudio-release
Copy link

Build 3.10 :: server_3.x/239: Console, Changes, Git Data

@devstudio-release
Copy link

Build 3.10 :: server_3.x/238: Console, Changes, Git Data

@devstudio-release
Copy link

@devstudio-release
Copy link

@devstudio-release
Copy link

@devstudio-release
Copy link

@devstudio-release
Copy link

@devstudio-release
Copy link

@devstudio-release
Copy link

@devstudio-release
Copy link

Build 3.10 :: server_3.x/238: SUCCESS

Upstream sync done; /DS_CI/sync-to-downstream_3.x/4695 triggered

@devstudio-release
Copy link

@devstudio-release
Copy link

@devstudio-release
Copy link

@devstudio-release
Copy link

Build 3.10 :: server_3.x/239: SUCCESS

Upstream sync done; /DS_CI/sync-to-downstream_3.x/4696 triggered

@devstudio-release
Copy link

@devstudio-release
Copy link

@devstudio-release
Copy link

@devstudio-release
Copy link

Build 3.10 :: copyIIBsToQuay/1918: Console, Changes, Git Data

@devstudio-release
Copy link

Build 3.10 :: sync-to-downstream_3.x/4697: SUCCESS

Build container: devspaces-operator-bundle synced; /DS_CI/get-sources-rhpkg-container-build_3.x/4493 triggered; /job/DS_CI/job/dsc_3.x triggered;

@devstudio-release
Copy link

Build 3.10 :: operator-bundle_3.x/2072: SUCCESS

Upstream sync done; /DS_CI/sync-to-downstream_3.x/4697 triggered

@devstudio-release
Copy link

Build 3.10 :: dsc_3.x/1379: Console, Changes, Git Data

@devstudio-release
Copy link

Build 3.10 :: update-digests_3.x/4360: SUCCESS

Detected new images: rebuild operator-bundle
* server; /DS_CI/operator-bundle_3.x/2072 triggered

@devstudio-release
Copy link

@devstudio-release
Copy link

Build 3.10 :: update-digests_3.x/4361: UNSTABLE

No new images detected: nothing to do!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants