Skip to content

NullPointerException getting types #38

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
sualeh opened this issue Nov 12, 2023 · 2 comments
Closed

NullPointerException getting types #38

sualeh opened this issue Nov 12, 2023 · 2 comments
Labels
bug Something isn't working

Comments

@sualeh
Copy link
Contributor

sualeh commented Nov 12, 2023

In TypeMetadataResultSetBuilder::buildUDTs, typeNamePattern needs a null-check. Most JDBC drivers support a null typeNamePattern even though the JDBC javadoc does not specifically call out this case.

It is easy enough to use:
if (typeNamePattern != null && typeNamePattern.contains(".")) { on line L119.

@maximevw maximevw added the bug Something isn't working label Nov 12, 2023
@maximevw
Copy link
Collaborator

Hello @sualeh, good catch!

We can even handle null type name patterns as equivalent of the pattern "%" to match any type by replacing the lines 118-119 by:

final AtomicReference<String> typeName = new AtomicReference<>(Objects.toString(typeNamePattern, "%"));
if (typeName.get().contains(".")) {

This also will avoid to get NPE later line 130 when the type name pattern is used to be matched against the found UDTs.

I'll take care of this one and keep you informed.

maximevw added a commit that referenced this issue Nov 12, 2023
Avoid NPE in CassandraDatabaseMetaData.getUDTs() calls when the type name
pattern is null.
@maximevw
Copy link
Collaborator

Fixed and tested in commit eeea9a7

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants