Skip to content

#385 - added null check on SqlTimeConverter - #387

Merged
aaberg merged 2 commits into
masterfrom
385-sqltimeconverter-does-not-handle-nulls
Aug 25, 2026
Merged

#385 - added null check on SqlTimeConverter#387
aaberg merged 2 commits into
masterfrom
385-sqltimeconverter-does-not-handle-nulls

Conversation

@aaberg

@aaberg aaberg commented Aug 25, 2026

Copy link
Copy Markdown
Owner

No description provided.

@aaberg aaberg linked an issue Aug 25, 2026 that may be closed by this pull request
@aaberg
aaberg requested a lite review from Copilot August 25, 2026 19:37

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

The new test file has a minor but potentially build-breaking unused import and deviates from established test class visibility conventions in this package.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

This PR addresses issue #385 by making SqlTimeConverter explicitly handle null inputs, preventing a potential NullPointerException and aligning behavior with other converters that return null for null input.

Changes:

  • Add an explicit null guard in SqlTimeConverter.convert(...).
  • Add a new JUnit 5 test suite covering supported input types (including null) and unsupported input behavior.
File summaries
File Description
core/src/main/java/org/sql2o/converters/SqlTimeConverter.java Adds an early null return in convert(...) to avoid NPE and define null-handling behavior.
core/src/test/java/org/sql2o/converters/SqlTimeConverterTest.java Introduces parameterized tests for supported conversions (including null) and a test for unsupported input.
Review details
  • Files reviewed: 2/2 changed files
  • Comments generated: 2
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread core/src/test/java/org/sql2o/converters/SqlTimeConverterTest.java Outdated
import java.util.Date;
import java.util.stream.Stream;

class SqlTimeConverterTest {
@aaberg
aaberg merged commit b45d9a6 into master Aug 25, 2026
2 checks passed
@aaberg
aaberg deleted the 385-sqltimeconverter-does-not-handle-nulls branch August 25, 2026 19:45
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.

SqlTimeConverter does not handle nulls?

2 participants