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

fix(codewhisperer): handle out of bounds endLine #4254

Merged
merged 4 commits into from
Apr 9, 2024

Conversation

ctlai95
Copy link
Contributor

@ctlai95 ctlai95 commented Apr 9, 2024

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)

Description

If service returns out of bounds value for endLine, the plugin fails with IndexOutOfBoundsException when executing document.getLineEndOffset(). Force the value to be in the range (0, lineCount - 1) when calculating the endCol value.

Checklist

  • My code follows the code style of this project
  • I have added tests to cover my changes
  • A short description of the change has been added to the CHANGELOG if the change is customer-facing in the IDE.
  • I have added metrics for my changes (if required)

License

I confirm that my contribution is made under the terms of the Apache 2.0 license.

@ctlai95 ctlai95 force-pushed the ctlai95/fix-out-of-bounds-exception branch from 9bef13b to c70d371 Compare April 9, 2024 19:56
Copy link

sonarqubecloud bot commented Apr 9, 2024

Quality Gate Failed Quality Gate failed

Failed conditions
3.4% Duplication on New Code (required ≤ 3%)

See analysis details on SonarCloud

@ctlai95 ctlai95 marked this pull request as ready for review April 9, 2024 23:00
@ctlai95 ctlai95 requested review from a team as code owners April 9, 2024 23:00
@ctlai95 ctlai95 merged commit c6db2fe into aws:main Apr 9, 2024
9 of 11 checks passed
sarayev pushed a commit to sarayev/aws-toolkit-jetbrains that referenced this pull request Apr 10, 2024
* fix(codewhisperer): handle out of bounds endLine

* reduce code duplication
kumsmrit pushed a commit to kumsmrit/aws-toolkit-jetbrains that referenced this pull request Apr 16, 2024
* fix(codewhisperer): handle out of bounds endLine

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

Successfully merging this pull request may close these issues.

3 participants