Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: 1.8.4
-
Fix Version/s: 1.8.6, 2.0-beta-3, 1.7.11
-
Component/s: None
-
Labels:None
-
Environment:Windows XP, Oracle 11.2.0.2
-
Number of attachments :
Description
the following script works with groovy 1.8.2 but not with 1.8.4 oci connection has an error (oci_error.txt) – thin connection works
import groovy.sql.Sql import java.sql.SQLException def dbc = Sql.newInstance('jdbc:oracle:oci:@b003', 'system', 'system', "oracle.jdbc.driver.OracleDriver") //def dbc = Sql.newInstance('jdbc:oracle:thin:@//server:1521/b003', 'system', 'system', "oracle.jdbc.driver.OracleDriver") println dbc.properties def row = dbc.firstRow("SELECT count(*) FROM all_users WHERE username = 'SYSTEM'") println row dbc.connection.autoCommit = false
The problem appears to be with processing EventSetDescriptors. The OCI driver uses the T2CConnection whose super class PhysicalConnection contains add/remove event listener methods. The base class is package private and abstract. The thin driver uses T4CConnection and that class overrides the addXSEventListener methods, so that is likely why the thin driver does not exhibit the problem.
I was able to create some sample classes that reproduce the problem (Groovy 1.8.3+ and JDK 6 and 7):
Note that if you either make FooBaseConnection public or change the event listeners from the FooEventListener interface to the java.util.EventListener you no longer get the NPE.