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

DECIMAL overflow for long/int/short not throwing exception

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 3.0.3
    • Fix Version/s: 3.0.4
    • Component/s: Other
    • Labels:
      None
    • Environment:
      Linux

      Description

      Calling ResultSet.getLong on a column that contains a value larger than Long.MAX_VALUE should fail. Instead it wraps around to Long.MIN_VALUE.

      The attached test case prints:

      MySQL
      8.0.27
      MariaDB Connector/J
      3.0.3
      SUM = 9223372036854775807
      SUM = -9223372036854775808

      The second fetch should fail with some exception.

      Replacing getLong by getInt and Long.MAX_VALUE by Integer.MAX_VALUE shows correct behaviour: the second fetch fails with "java.sql.SQLDataException: integer overflow".

      This problem was not yet present in version 2.7.5.

        Attachments

          Activity

            People

            Assignee:
            diego dupin Diego Dupin
            Reporter:
            rw7 Ralf Wiebicke
            Votes:
            0 Vote for this issue
            Watchers:
            3 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.