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

Handle null Throwable stack trace to avoid NullPointerException #2168

Merged
merged 2 commits into from Aug 8, 2017

Conversation

blindpirate
Copy link
Collaborator

Context

See #1618

Contributor Checklist

This fixes gradle#1618

When an exception with null pointer stackTrace (usually a mock
exception) is thrown in test, ExceptionPlaceholder can't handle it
correctly and throws a NPE. This commit set the stackTrace to empty
array if it's null.

An unit test is provided.
Copy link
Contributor

@bmuschko bmuschko left a comment

Choose a reason for hiding this comment

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

Thanks for providing the pull request. Could you please also add an integration test that demonstrates the correct behavior? The reporter of the problem provided a sample project that might be useful.

@bmuschko
Copy link
Contributor

bmuschko commented Aug 1, 2017

@blindpirate Just making sure you saw my comments. Are you planning to address those soon?

@blindpirate
Copy link
Collaborator Author

Sure, I missed it. I'll tackle it today.

@blindpirate
Copy link
Collaborator Author

Sorry for the delay, and this is the first time I write an integration test from scratch, so please let me know if there's anything inappropriate.

Copy link
Contributor

@bmuschko bmuschko left a comment

Choose a reason for hiding this comment

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

Thanks for providing the integration tests. I am going to merge this PR soon.

@bmuschko bmuschko changed the title Set empty array to stackTrace if it is null pointer (Fix #1618) Set empty array to stackTrace for null value (Fix #1618) Aug 8, 2017
@bmuschko bmuschko changed the title Set empty array to stackTrace for null value (Fix #1618) Handle null Throwable stack trace to avoid NullPointerException (Fix #1618) Aug 8, 2017
@bmuschko bmuschko changed the title Handle null Throwable stack trace to avoid NullPointerException (Fix #1618) Handle null Throwable stack trace to avoid NullPointerException Aug 8, 2017
@bmuschko bmuschko merged commit 9d24439 into gradle:master Aug 8, 2017
@bmuschko bmuschko added this to the 4.2 RC1 milestone Aug 8, 2017
@bmuschko
Copy link
Contributor

bmuschko commented Aug 8, 2017

Thanks for the pull request. It has been merged.

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.

None yet

2 participants