Skip to content
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

Indexing throws an NPE in some cases #338

Closed
vmuzikar opened this issue Nov 24, 2023 · 4 comments · Fixed by #339
Closed

Indexing throws an NPE in some cases #338

vmuzikar opened this issue Nov 24, 2023 · 4 comments · Fixed by #339
Assignees
Milestone

Comments

@vmuzikar
Copy link

vmuzikar commented Nov 24, 2023

Particularly, the newest Oracle JDBC driver (com.oracle.database.jdbc:ojdbc11:23.3.0.23.09) can't be indexed. For reproducer please see: https://github.com/vmuzikar/reproducers/tree/main/jandex-oracle-bug

Context

Keycloak ran into this issue when "sideloading" the driver leveraging quarkus.package.user-providers-directory Quarkus option since in some cases we can't include the driver with the distribution. We managed to narrow down the issue to a potential Jandex bug. Seems that sometimes the field signature is not decoded correctly. I haven't investigated further.

@Ladicek
Copy link
Collaborator

Ladicek commented Nov 24, 2023

Interesting. I will take a look next week, thanks for the reproducer!

@Ladicek
Copy link
Collaborator

Ladicek commented Nov 27, 2023

OK, this is interesting. The class in question (oracle.jdbc.proxy.oracle$1jdbc$1driver$1AbstractShardingCallableStatement$2oracle$1jdbc$1internal$1OracleCallableStatement$$$Proxy) has a field called cached of type boolean. The class file entry for that field contains the Signature attribute, which encodes the generic signature of a program element.

The Jandex parser of generic signatures closely follows the grammar from JVM Specification (see 4.7.9.1. Signatures). That grammar specifically says:

FieldSignature:
  ReferenceTypeSignature

That is, field signatures are supposed to be signatures of reference types. But the signature of the cached field is Z -- a signature of a primitive type.

It seems clear that the given version of the Oracle JDBC driver contains invalid bytecode, but I take pride in Jandex being able to handle errors like this gracefully. And the fix is simple.

@vmuzikar
Copy link
Author

@Ladicek Thanks for the super quick fix! It's interesting to see the root cause was eventually the driver itself.

Do you have any estimate when can the fixed Jandex version be adopted by Quarkus?

@Ladicek
Copy link
Collaborator

Ladicek commented Nov 27, 2023

I'll release 3.1.6 today. Since this is a micro release, merging into Quarkus typically takes just a few days. Backporting to 3.6 should be doable; I'm not sure about 3.2.

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 a pull request may close this issue.

2 participants