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

Incorrect handling of long values in AbstractResult

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.0.0
    • Fix Version/s: 1.3.0, 2.0.0-M3
    • Component/s: jdbc
    • Labels:
      None
    • Patch Info:
      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

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

              Dates

              • Created:
                Updated:
                Resolved: