OpenJPA
  1. OpenJPA
  2. OPENJPA-1158

Incorrect handling of long values in AbstractResult

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor 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.

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

        Activity

        Hide
        Donald Woods added a comment -

        Committed to 1.3.x in r814825.

        Show
        Donald Woods added a comment - Committed to 1.3.x in r814825.
        Hide
        Donald Woods added a comment -

        Applied to trunk in r808701 by Pinaki.

        Show
        Donald Woods added a comment - Applied to trunk in r808701 by Pinaki.
        Hide
        Craig L Russell added a comment -

        This patch corrects the issue. Please review.

        Show
        Craig L Russell added a comment - This patch corrects the issue. Please review.

          People

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

            Dates

            • Created:
              Updated:
              Resolved:

              Development