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

Never ever throw an instance of java.lang.Error

    XMLWordPrintable

Details

    Description

      We had a setup of commons-pool2 and mariadb-connector-j got stuck, because creating a MariaDB connection threw a Throwable, which was derived from java.lang.Error, see https://issues.apache.org/jira/browse/POOL-336 for details.

      The exact cause may also be due to an openjdk8 bug under Linux in sun.nio.ch.DatagramChannelImpl.connect(SocketAddress), because commons-pool2 does not log swallowed exception during connection establishment.

      However, the discussion in the above mentioned issue showed, that actively throwing an instance of java.lang.Error like an AssertionError or an IOError is a bad idea, because such erros are usually thrown by the JVM as a last resort.

      I will prepare a pull request for this issue, which replaces the thrown Errors by likewise RuntimeExceptions.

      Attachments

        Activity

          People

            diego dupin Diego Dupin
            wglas Wolfgang Glas
            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.