Skip to content

Fix code quality issues: raw types, printStackTrace, System.out, and empty catch blocks#18342

Merged
xiangfu0 merged 2 commits intoapache:masterfrom
Akanksha-kedia:fix/code-issues-and-cleanup
Apr 27, 2026
Merged

Fix code quality issues: raw types, printStackTrace, System.out, and empty catch blocks#18342
xiangfu0 merged 2 commits intoapache:masterfrom
Akanksha-kedia:fix/code-issues-and-cleanup

Conversation

@Akanksha-kedia
Copy link
Copy Markdown
Contributor

Summary

  • Replace raw type new HashMap() / new ArrayList() with diamond operator in RealtimeSegmentStatsHistory, SparkSegmentGenerationJobRunner, and HadoopSegmentGenerationJobRunner
  • Replace e.printStackTrace() with LOGGER.error() in PinotDataBuffer.closeOpenBuffers()
  • Replace System.out.println with LOGGER.debug() in OffHeapStarTree.printTreeHelper() (added slf4j Logger)
  • Add LOGGER.warn() to silent catch block in PinotTaskManager during task lock acquisition
  • Add LOGGER.debug() to silent catch block in ByteArray for MethodHandle fallback
  • Add descriptive comments to catch blocks in DriverUtils, TimestampUtils, ExtraInstanceConfig, and S3Config

Test plan

  • Verify spotless:apply and checkstyle:check pass on all affected modules
  • Verify no behavioral changes — all fixes are logging/comment-only or type inference (diamond operator)
  • CI green

…empty catch blocks

- Replace raw type `new HashMap()` / `new ArrayList()` with diamond operator across 3 files
- Replace `e.printStackTrace()` with `LOGGER.error()` in PinotDataBuffer
- Replace `System.out.println` with `LOGGER.debug()` in OffHeapStarTree
- Add logging or comments to silent empty catch blocks in PinotTaskManager,
  DriverUtils, TimestampUtils, ByteArray, ExtraInstanceConfig, and S3Config
@Akanksha-kedia
Copy link
Copy Markdown
Contributor Author

@xiangfu0 please review

The inner catch block variable 'e' shadowed the outer catch block's
variable of the same name, causing a compilation failure.
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Apr 27, 2026

Codecov Report

❌ Patch coverage is 44.44444% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 63.39%. Comparing base (e7ea035) to head (46f4bf4).
⚠️ Report is 140 commits behind head on master.

Files with missing lines Patch % Lines
...ain/java/org/apache/pinot/spi/utils/ByteArray.java 0.00% 2 Missing ⚠️
...apache/pinot/common/helix/ExtraInstanceConfig.java 0.00% 1 Missing ⚠️
.../pinot/segment/local/startree/OffHeapStarTree.java 50.00% 1 Missing ⚠️
...ache/pinot/segment/spi/memory/PinotDataBuffer.java 0.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master   #18342      +/-   ##
============================================
- Coverage     63.96%   63.39%   -0.57%     
- Complexity     1617     1679      +62     
============================================
  Files          3179     3253      +74     
  Lines        193741   198767    +5026     
  Branches      29926    30791     +865     
============================================
+ Hits         123918   126007    +2089     
- Misses        60031    62683    +2652     
- Partials       9792    10077     +285     
Flag Coverage Δ
custom-integration1 100.00% <ø> (ø)
integration 100.00% <ø> (ø)
integration1 100.00% <ø> (ø)
integration2 0.00% <ø> (ø)
java-11 ?
java-21 63.39% <44.44%> (-0.55%) ⬇️
temurin 63.39% <44.44%> (-0.57%) ⬇️
unittests 63.39% <44.44%> (-0.57%) ⬇️
unittests1 55.35% <14.28%> (-0.50%) ⬇️
unittests2 34.93% <44.44%> (+0.59%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@xiangfu0 xiangfu0 merged commit 1881884 into apache:master Apr 27, 2026
11 checks passed
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