Uploaded image for project: 'MariaDB Connector/J'
  1. MariaDB Connector/J
  2. CONJ-780

Logic error in implementation of OSGi DataSourceFactory (MariaDbDataSourceFactory)

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.6.0
    • Fix Version/s: 2.6.1
    • Component/s: Other
    • Labels:
      None

      Description

      There is the same logic error in all three factory methods in the if clause condition:

          if (props != null
              || props.containsKey(JDBC_MIN_POOL_SIZE)
              || props.containsKey(JDBC_MAX_POOL_SIZE)
              || props.containsKey(JDBC_MAX_IDLE_TIME)) {
            return createPoolDataSource(props);
          } else {
            return createBasicDataSource(props);
          }
      

      "Else" clause can presently never be reached, as even in the case of props==null, the second term in the condition causes a NullPointerException.

      Presumably, the condition should have looked like:

      props != null &&
              (props.containsKey(JDBC_MIN_POOL_SIZE)
              || props.containsKey(JDBC_MAX_POOL_SIZE)
              || props.containsKey(JDBC_MAX_IDLE_TIME))
      

        Attachments

          Activity

            People

            Assignee:
            diego dupin Diego Dupin
            Reporter:
            domagojcc Domagoj Cosic
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: