Adjust NegativeArraySizeException demo in MainActivity - #240
Open
sentry[bot] wants to merge 1 commit into
Open
Conversation
| addAttachment(false); | ||
| Sentry.addBreadcrumb("Button for NegativeArraySizeException clicked..."); | ||
| int[] a = new int[-5]; | ||
| int[] a = new int[5]; |
Author
There was a problem hiding this comment.
Bug: The change from new int[-5] to new int[5] prevents the intended NegativeArraySizeException, breaking the "RTE and Strip PII" button's demonstration purpose.
Severity: MEDIUM
Suggested Fix
Revert the array allocation from new int[5] back to new int[-5]. This will restore the intended behavior of throwing a NegativeArraySizeException when the button is clicked, which is the feature's purpose in this demonstration application.
Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent. Verify if this is a real issue. If it is, propose a fix; if not, explain why it's
not valid.
Location: app/src/main/java/com/example/vu/android/MainActivity.java#L61
Potential issue: The code was changed from `new int[-5]` to `new int[5]` in a Sentry
demonstration application. The original code was intended to throw a
`NegativeArraySizeException` when the "RTE and Strip PII" button is clicked, as
confirmed by code comments and the button's label. The new code prevents this exception
from being thrown, effectively breaking the button's core demonstration purpose.
Consequently, related demonstration logic in `MyApplication.java` that handles this
specific exception for PII stripping will no longer execute, and the button performs no
meaningful action.
Did we get this right? 👍 / 👎 to inform future reviews.
Author
📲 Install BuildsAndroid
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The
negative_index_buttoninMainActivitywas designed to demonstrate aNegativeArraySizeExceptionby attempting to create an array with a size of -5. This change modifies the array creation tonew int[5], which is a valid operation, thereby preventing theNegativeArraySizeExceptionfrom being thrown when the button is clicked. This effectively changes the behavior of this specific error demonstration.Fixes ANDROID-J8