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

prevent exceptions from being passed into Args #2140

Merged
merged 7 commits into from
Apr 6, 2022

Conversation

rzpt
Copy link
Contributor

@rzpt rzpt commented Mar 28, 2022

Before this PR

Exceptions can be passed into SafeArg/UnsafeArg, which loses the stacktrace.

After this PR

==COMMIT_MSG==
prevent exceptions from being passed into Args
==COMMIT_MSG==

Possible downsides?

None.

@changelog-app
Copy link

changelog-app bot commented Mar 28, 2022

Generate changelog in changelog/@unreleased

Type

  • Feature
  • Improvement
  • Fix
  • Break
  • Deprecation
  • Manual task
  • Migration

Description

prevent exceptions from being passed into Args

Check the box to generate changelog(s)

  • Generate changelog entry

@policy-bot policy-bot bot requested a review from xRuiAlves March 28, 2022 17:39
Copy link
Contributor

@carterkozak carterkozak left a comment

Choose a reason for hiding this comment

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

generally lgtm, just a couple suggestions!

Comment on lines 56 to 58
return buildDescription(tree)
.setMessage("Args with type Throwable are not allowed.")
.build();
Copy link
Contributor

Choose a reason for hiding this comment

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

When there's a single failure message, we can set it in the top-level @BugPattern annotation summary field, then we can return describeMatch(tree); on failure.


@AutoService(BugChecker.class)
@BugPattern(
name = "LogsafeArgument",
Copy link
Contributor

Choose a reason for hiding this comment

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

Sorry for the delay, I think we'll need to rebase and remove this line (due to the error_prone 2.11 upgrade)

Suggested change
name = "LogsafeArgument",

@bulldozer-bot bulldozer-bot bot merged commit 3618cab into develop Apr 6, 2022
@bulldozer-bot bulldozer-bot bot deleted the no-arg-of-exception branch April 6, 2022 23:02
@svc-autorelease
Copy link
Collaborator

Released 4.99.0

bulldozer-bot bot pushed a commit to palantir/witchcraft-api that referenced this pull request Apr 7, 2022
###### _excavator_ is a bot for automating changes across repositories.

Changes produced by the roomba/latest-baseline-oss check.

# Release Notes
## 4.99.0
| Type | Description | Link |
| ---- | ----------- | ---- |
| Feature | prevent exceptions from being passed into Args | palantir/gradle-baseline#2140 |



To enable or disable this check, please contact the maintainers of Excavator.
This was referenced Apr 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants