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

Logic error in implementation of OSGi DataSourceFactory (MariaDbDataSourceFactory)

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Minor
    • Resolution: Fixed
    • 2.6.0
    • 2.6.1
    • Other
    • 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

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

            Dates

              Created:
              Updated:
              Resolved:

              Git Integration

                Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.