Details
Assignee
UnassignedUnassignedReporter
Phil HaeuslerPhil HaeuslerPriority
MajorLabels
New Issue warning screen
Before you create a new Issue, please post to the mailing list first https://dev.lucee.org
Once the issue has been verified, one of the Lucee team will ask you to file an issue
Affects versions
Details
Details
Assignee
Unassigned
UnassignedReporter
Phil Haeusler
Phil HaeuslerPriority
Labels
New Issue warning screen
Before you create a new Issue, please post to the mailing list first https://dev.lucee.org
Once the issue has been verified, one of the Lucee team will ask you to file an issue
Affects versions
Created 14 July 2017 at 23:56
Updated 28 September 2021 at 11:59
Adding a new JDBC - Other datasource with an invalid JDBC Connection string successfully adds the datasource but any attempt to use that datasource results in an internal Lucee NPE.
Java Stacktrace lucee.runtime.exp.NativeException: java.lang.NullPointerException at lucee.runtime.db.DCStack.openConnectionsIn(DCStack.java:104) at lucee.runtime.db.DCStack.openConnections(DCStack.java:117) at lucee.runtime.db.DatasourceConnectionPool.openConnections(DatasourceConnectionPool.java:272) at lucee.runtime.db.DatasourceConnectionPool.openConnections(DatasourceConnectionPool.java:280)
This is due to an invalid connection string being passed to the JDBC driver that can result in null being returned by DataSourceSupport._getConnection(). This is turn in is not checked by DataSourceSupport.getConnection() which results in Lucee ending up with a DataSource with a null connection.
This then falls over when the Connection is attempted to be retrieved in DCStack.openConnectionsIn()
Suggest that DataSourceSupport.getConnection() add a null check and throw a RuntimeException to prevent an invalid DataSource from being created.
Found as a result of investigation in https://dev.lucee.org/t/using-ucanaccess-with-lucee-5/2594