Derby
  1. Derby
  2. DERBY-5012

[patch] bad allocation guard in ResultSet#resetUpdatedColumnsForInsert

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Trivial Trivial
    • Resolution: Fixed
    • Affects Version/s: 10.7.1.1
    • Fix Version/s: 10.8.1.2
    • Component/s: Network Client
    • Labels:
      None
    • Urgency:
      Normal

      Description

      code checks to see if an array is not null, and if so allocates the array. This is backwards. Should check to see if the array is null.

      1. no-alloc.diff
        0.9 kB
        Knut Anders Hatlen
      2. bad_allocation_guard.diff
        0.6 kB
        Dave Brosius

        Activity

        Hide
        Knut Anders Hatlen added a comment -

        Thanks, Dag. All the regression tests ran cleanly with the no-alloc.diff patch. Committed revision 1068772.

        Show
        Knut Anders Hatlen added a comment - Thanks, Dag. All the regression tests ran cleanly with the no-alloc.diff patch. Committed revision 1068772.
        Hide
        Dag H. Wanvik added a comment -

        +1 to no-alloc.diff

        Show
        Dag H. Wanvik added a comment - +1 to no-alloc.diff
        Hide
        Knut Anders Hatlen added a comment -

        The patch looks correct to me. The reason why it still works, even if the check is backwards, is that the call to updateColumn() in the loop below will allocate the array if it is null.

        Since both of the arrays will be allocated lazily by updateColumn() anyways, I'm thinking that it may make sense to stop allocating them in resetUpdatedColumnsForInsert() altogether. See the attached patch (no-alloc.diff), which simplifies that method a bit.

        Show
        Knut Anders Hatlen added a comment - The patch looks correct to me. The reason why it still works, even if the check is backwards, is that the call to updateColumn() in the loop below will allocate the array if it is null. Since both of the arrays will be allocated lazily by updateColumn() anyways, I'm thinking that it may make sense to stop allocating them in resetUpdatedColumnsForInsert() altogether. See the attached patch (no-alloc.diff), which simplifies that method a bit.

          People

          • Assignee:
            Dave Brosius
            Reporter:
            Dave Brosius
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Time Tracking

              Estimated:
              Original Estimate - 1h
              1h
              Remaining:
              Remaining Estimate - 1h
              1h
              Logged:
              Time Spent - Not Specified
              Not Specified

                Development