Uploaded image for project: 'OpenJPA'
  1. OpenJPA
  2. OPENJPA-1158

Incorrect handling of long values in AbstractResult

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 2.0.0
    • 1.3.0, 2.0.0-M3
    • jdbc
    • None
    • Patch Available

    Description

      This code is in org.apache.openjpa.jdbc.sql.AbstractResult.

      public long getLong(Object obj)
      throws SQLException

      { return getLongInternal(translate(obj, null), null); }

      public long getLong(Column col, Joins joins)
      throws SQLException

      { return getLongInternal(translate(col, joins), joins); }

      protected long getLongInternal(Object obj, Joins joins)
      throws SQLException

      { Number val = (Number) checkNull(getObjectInternal(obj, JavaTypes.INT, null, joins)); return (val == null) ? 0 : val.intValue(); }

      It seems like it's an obvious bug; using intValue and JavaTypes.INT in getLongInternal should use longValue and JavaTypes.LONG.

      Attachments

        1. OPENJPA-1158.patch
          0.7 kB
          Craig L Russell

        Activity

          People

            drwoods Donald Woods
            clr Craig L Russell
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: