Indexing throws an NPE in some cases
vmuzikar opened this issue · comments
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.
Interesting. I will take a look next week, thanks for the reproducer!
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.
@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?
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.