Skip to content

SONARJAVA-6695 Implement new rule S9130 - #5855

Draft
romainbrenguier wants to merge 2 commits into
masterfrom
new-rule/SONARJAVA-6695-S9130
Draft

SONARJAVA-6695 Implement new rule S9130#5855
romainbrenguier wants to merge 2 commits into
masterfrom
new-rule/SONARJAVA-6695-S9130

Conversation

@romainbrenguier

Copy link
Copy Markdown
Contributor

Detect when the return value of InputStream.read() or Reader.read() is cast to byte or char before being checked for -1, which can cause false end-of-stream detection or missed end-of-stream conditions.

Part of

@hashicorp-vault-sonar-prod

hashicorp-vault-sonar-prod Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

SONARJAVA-6695

@github-actions

github-actions Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Ruling needs updating. A fix PR has been created: #5858

Please review and merge it into your branch.

@romainbrenguier
romainbrenguier force-pushed the new-rule/SONARJAVA-6695-S9130 branch 2 times, most recently from 42eae74 to 08931d1 Compare August 3, 2026 08:25
@github-actions

github-actions Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Ruling needs updating. A fix PR has been created: #5858

Please review and merge it into your branch.

Detect when the return value of InputStream.read() or Reader.read() is cast
to byte or char before being checked for -1, which can cause false
end-of-stream detection or missed end-of-stream conditions.
@romainbrenguier
romainbrenguier force-pushed the new-rule/SONARJAVA-6695-S9130 branch from 08931d1 to 4f2a408 Compare August 3, 2026 08:36
@github-actions

github-actions Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Ruling needs updating. A fix PR has been created: #5858

Please review and merge it into your branch.

1 similar comment
@github-actions

github-actions Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Ruling needs updating. A fix PR has been created: #5858

Please review and merge it into your branch.

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
@github-actions

github-actions Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Ruling Diff Summary

Detected changes in 1 rule files: 0 issues removed, 9 issues added.

S9130 (java) on eclipse-jetty - 0 issues removed, 9 issues added - new ruling file

Added jetty-server/src/test/java/org/eclipse/jetty/server/DumpHandler.java (line 84)

(source file not found at this revision: jetty-server/src/test/java/org/eclipse/jetty/server/DumpHandler.java)

Added jetty-server/src/test/java/org/eclipse/jetty/server/HttpServerTestBase.java (line 1379)

(source file not found at this revision: jetty-server/src/test/java/org/eclipse/jetty/server/HttpServerTestBase.java)

Added jetty-server/src/test/java/org/eclipse/jetty/server/HttpServerTestBase.java (line 1386)

(source file not found at this revision: jetty-server/src/test/java/org/eclipse/jetty/server/HttpServerTestBase.java)

Added jetty-server/src/test/java/org/eclipse/jetty/server/HttpServerTestBase.java (line 1407)

(source file not found at this revision: jetty-server/src/test/java/org/eclipse/jetty/server/HttpServerTestBase.java)

Added jetty-server/src/test/java/org/eclipse/jetty/server/ssl/SSLSelectChannelConnectorLoadTest.java (line 303)

(source file not found at this revision: jetty-server/src/test/java/org/eclipse/jetty/server/ssl/SSLSelectChannelConnectorLoadTest.java)

Added jetty-util/src/main/java/org/eclipse/jetty/util/UrlEncoded.java (line 466)

(source file not found at this revision: jetty-util/src/main/java/org/eclipse/jetty/util/UrlEncoded.java)

Added jetty-util/src/main/java/org/eclipse/jetty/util/UrlEncoded.java (line 467)

(source file not found at this revision: jetty-util/src/main/java/org/eclipse/jetty/util/UrlEncoded.java)

@github-actions

github-actions Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Ruling needs updating. A fix PR has been created: #5864

Please review and merge it into your branch.

@gitar-bot

gitar-bot Bot commented Aug 3, 2026

Copy link
Copy Markdown
CI failed: Test failures caused by introducing new rule S9130: a profile registration assertion failed because the total rule count increased from 465 to 466, and ruling integration tests failed due to mismatched snapshot output.

Overview

Two distinct test failures occurred as a direct result of implementing new rule S9130 in PR #5855 across 2 analyzed log files. Both failures are change-related and stem from failing to update test assertions and ruling baseline expectations to account for the newly added rule.

Failures

Quality Profile Rule Count Assertion Failure (confidence: high)

  • Type: test
  • Affected jobs: 91614739812
  • Related to change: yes
  • Root cause: The quality profile test JavaAgenticWayProfileTest expects 465 registered rules, but the addition of rule S9130 increased the actual count to 466.
  • Suggested fix: Update the expected rule count in org.sonar.plugins.java.JavaAgenticWayProfileTest.profile_is_registered_as_expected from 465 to 466.

Ruling Integration Test Mismatch (confidence: high)

  • Type: test
  • Affected jobs: 91637925003
  • Related to change: yes
  • Root cause: The ruling QA integration tests compare actual analysis output against expected snapshot/baseline files in src/test/resources. The introduction of rule S9130 changes the analysis output, causing a mismatch with the existing baseline.
  • Suggested fix: Review the generated diff HTML artifact (diff_sonar-m-public_without-sonarqube-project.html) and update the expected ruling test results or baseline files to include rule S9130.

Summary

  • Change-related failures: 2 test failures (profile rule count assertion and ruling integration test baseline mismatch caused by new rule S9130)
  • Infrastructure/flaky failures: 0
  • Recommended action: Update JavaAgenticWayProfileTest to expect 466 rules and update the ruling test expected output baselines to reflect rule S9130.
Code Review ✅ Approved

Implements new rule S9130 to detect incorrect casting of InputStream.read() or Reader.read() return values before checking for -1. No issues found.

Tip

Comment Gitar fix CI or enable auto-apply: gitar auto-apply:on

Options

Auto-apply is off → Gitar will not commit updates to this branch.
Display: compact → Showing less information.

Comment with these commands to change the behavior for this request:

Auto-apply Compact
gitar auto-apply:on         
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Gitar

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.

1 participant