Skip to content

Fix NPE in SQL param conversion#10027

Merged
nielsm5 merged 4 commits intomasterfrom
issue/10023_FixNPEinJdbcParamConversion
Nov 26, 2025
Merged

Fix NPE in SQL param conversion#10027
nielsm5 merged 4 commits intomasterfrom
issue/10023_FixNPEinJdbcParamConversion

Conversation

@tnleeuw
Copy link
Contributor

@tnleeuw tnleeuw commented Nov 26, 2025

Changes

Fix an NPE in SQL parameter conversion

Pull Request Checklist

Title

  • Title expresses the business value (who benefits + what outcome)

Issues

Backports

  • Backport PRs created (if needed) and linked

Documentation

  • FF! Doc updated (user-facing behavior/config)
  • FF! Manual updated (if applicable)
  • Javadoc updated/generated (developer-facing APIs)

Tests

  • Unit tests added/updated
  • E2E/Integration tests added/updated (N/A)

Breaking changes

  • Breaking change recorded in markdown file
  • Migration notes included (if needed)

@tnleeuw tnleeuw self-assigned this Nov 26, 2025
@tnleeuw tnleeuw added the JDBC label Nov 26, 2025
}
// Some databases (MySQL, MariaDB, Oracle) do not support parameter type matching from the metadata. For these databases,
// we should return from this function before we reach this statement.
int sqlTYpe = parameterMetaData.getParameterType(parameterIndex);
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
int sqlTYpe = parameterMetaData.getParameterType(parameterIndex);
int sqlType = parameterMetaData.getParameterType(parameterIndex);

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Dat is geloof ik nog niemand opgevallen... 😆

if (!parameterTypeMatchRequired) {
statement.setString(parameterIndex, value);
if (value != null) {
statement.setString(parameterIndex, value);
Copy link
Contributor

Choose a reason for hiding this comment

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

Dus hij kan hier dus niet tegen een null value .. /sigh

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Eigenlijk denk ik dat hij hier wel tegen een null value kan maar ik vond het netter om het ook hier maar gewoon af te dekken.

Make unit test easier to grasp
@sonarqubecloud
Copy link

@nielsm5 nielsm5 merged commit 8425a78 into master Nov 26, 2025
31 checks passed
@nielsm5 nielsm5 deleted the issue/10023_FixNPEinJdbcParamConversion branch November 26, 2025 16:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

NPE in DateUtils after parameter fix in 7.9.7

3 participants