Skip to content

Conversation

@jha9262
Copy link

@jha9262 jha9262 commented Nov 2, 2025

What's the problem?

Code review flagged a bunch of error handling issues. Basically, we weren't validating inputs properly, so users would get cryptic NPEs instead of helpful error messages. CI was also failing silently in some cases which made debugging a pain.

What did I change?

Java code

  • Added input validation to all parsers (XML, SARIF) and the main CheckstyleAutoFix recipe
  • Now we check if files exist before trying to parse them
  • Validate that required fields aren't null/empty
  • Fail fast with clear error messages instead of letting things blow up later

CI workflow

  • Fixed the git diff check to use proper if-statements
  • Added continue-on-error: false to be explicit about error handling
  • Now shows which files changed when the check fails (way easier to debug)

Config docs

  • Added comments to rewrite.yml explaining what each path does
  • Documented expected file formats

Why does this matter?

  • Users get helpful error messages instead of stack traces
  • Easier to debug when something goes wrong
  • CI failures are obvious instead of mysterious
  • Prevents NPEs from bad inputs

Testing

Manually tested with:

  • Missing files ✓
  • Invalid paths ✓
  • Malformed XML ✓

Should probably add unit tests for the validation logic but wanted to get this out first.

Screenshots/Examples

Before: NullPointerException at line 47
After: IllegalArgumentException: Violation report path cannot be null or empty

Much better 👍

Copy link
Member

@romani romani left a comment

Choose a reason for hiding this comment

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

This AI generated code is useless.

Please read and watch videos at Starting_Development.
Please join us in crafting code that matters

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.

2 participants