Uploaded image for project: 'XWiki Platform'
  1. XWiki Platform
  2. XWIKI-239

DBCPConnectionProvider should not fail when database username and password are not supplied in hibernate configuration.

    XMLWordPrintable

Details

    • Improvement
    • Resolution: Fixed
    • Major
    • 1.0 B2
    • 1.0 B1
    • Storage
    • None
    • XWiki + Oracle (Externally authenticated)

    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);

      Attachments

        Activity

          People

            vmassol Vincent Massol
            spulugur Srini Pulugurtha
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: