Uploaded image for project: 'Commons DBCP'
  1. Commons DBCP
  2. DBCP-145

[dbcp] PoolingDriver.getConnectionPool() should use contextClassLoader

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • None
    • 1.3
    • None
    • Operating System: Windows XP
      Platform: PC

    • 32964

    Description

      [commons-dbcp.jar 1.2.1]

      In PoolingDriver.getConnectionPool(String), the following is used:

      InputStream in = this.getClass().getResourceAsStream(String.valueOf(name) +
      ".jocl");

      In certain environments, this will fail to find the resource. In particular the
      Eclipse Rich Client Platform, i.e. Eclipse's Plugin classloader architecture,
      prevent this from working, but this might apply for some application servers as
      well. It is generally common (and recommandable) to use the current Thread's
      contextClassLoader instead, e.g. by following the above line with:

      if (in==null) {
      in =
      Thread.currentThread().getContextClassLoader().getResourceAsStream(String.valueOf(name)
      + ".jocl");
      }

      Thanks,
      Jörg.

      Attachments

        Activity

          People

            Unassigned Unassigned
            jfrantzius Jörg von Frantzius
            Votes:
            1 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: