Bug Report: CacheFactory does not create a LRUCacheImpl from @DataSourceDefinition propertiy fish.payara.statement-cache-type #6647
Labels
Status: Open
Issue has been triaged by the front-line engineers and is being worked on verification
Type: Bug
Label issue as a bug defect
Brief Summary
CacheFactory runs into an error, because null value is interpreted as "null"-string value.
Resulting error log:
Error while creating the Statement cache data structure for type : null
This happens if no @DataSourceDefinition > propertiy > fish.payara.statement-cache-type is set and a cache-size > 0.
A workaround for this is to set a whitespace string for the property, which seems not intuitive.
Expected Outcome
If cache size is set > 0 a LRUCacheImpl must be returned by the CacheFactory if nothing else is set.
Current Outcome
Error while creating the Statement cache data structure for type : null
Reproducer
Please be aware of the "null" and null here, since this might be confusing.
Given this DataSourceDefinition
the following section will append an empty string to the null value. which results in a "null" string value
https://github.com/payara/Payara/blob/master/appserver/jdbc/jdbc-runtime/src/main/java/org/glassfish/jdbc/deployer/JdbcConnectionPoolDeployer.java#L410
In the CacheFactory the "null" string will end up in the initCustomCacheStructurePrivileged path, which creates a ClassNotFoundException.
https://github.com/payara/Payara/blob/master/appserver/jdbc/jdbc-ra/jdbc-core/src/main/java/com/sun/gjc/spi/base/datastructure/CacheFactory.java#L71
if i substitute the cacheType with the receiving value it would look like this
if("null" == null || "null".trim().equals("")) { ...
Operating System
any
JDK Version
openjdk version "17.0.3" 2022-04-19 LTS
Payara Distribution
Payara Micro
The text was updated successfully, but these errors were encountered: