Details
Description
In our company, Oracle JDBC connections are externally authenticated (OS authenticated). So, username and password are not passed in when using JDBC drivers. Infact, when you pass them in, the connection fails.
DBCPConnectionProvider inserts username and password into a hashatbale without checking for null. So, it will get a null pointer exception. Once I added the checks, it worked fine.
I understand that, external authentication is specific to companies paranoid of security. So, its a very low priority issue.
////////////////////////////////////////////////////
public void configure(Properties props) throws HibernateException {
try {
log.debug("Configure DBCPConnectionProvider");
// DBCP properties used to create the BasicDataSource
Properties dbcpProperties = new Properties();
// DriverClass & url
String jdbcDriverClass = props.getProperty(Environment.DRIVER);
String jdbcUrl = props.getProperty(Environment.URL);
dbcpProperties.put("driverClassName", jdbcDriverClass);
dbcpProperties.put("url", jdbcUrl);
//////////////////////////////////////
// Username / password
String username = props.getProperty(Environment.USER);
String password = props.getProperty(Environment.PASS);
if(username != null) // Srini - added a null check - does not exist in xwiki source
dbcpProperties.put("username", username);
if(password != null) // Srini - added a null check
dbcpProperties.put("password", password);