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

        Transition Time In Source Status Execution Times Last Executer Last Execution Date
        Open Open Resolved Resolved
        1d 2h 13m 1 Knut Anders Hatlen 09/Feb/11 07:51
        Resolved Resolved Closed Closed
        10d 5h 15m 1 Dave Brosius 19/Feb/11 13:06
        Gavin made changes -
        Workflow jira [ 12544856 ] Default workflow, editable Closed status [ 12797742 ]
        Rick Hillegas made changes -
        Fix Version/s 10.8.1.2 [ 12316362 ]
        Fix Version/s 10.8.1.1 [ 12316356 ]
        Rick Hillegas made changes -
        Fix Version/s 10.8.1.1 [ 12316356 ]
        Fix Version/s 10.8.1.0 [ 12315561 ]
        Dave Brosius made changes -
        Status Resolved [ 5 ] Closed [ 6 ]
        Knut Anders Hatlen made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Issue & fix info [Patch Available]
        Assignee Dave Brosius [ dbrosius ]
        Resolution Fixed [ 1 ]
        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
        Dag H. Wanvik made changes -
        Summary [patch] bad allocation guard [patch] bad allocation guard in ResultSet#resetUpdatedColumnsForInsert
        Knut Anders Hatlen made changes -
        Attachment no-alloc.diff [ 12470579 ]
        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.
        Dave Brosius made changes -
        Attachment bad_allocation_guard.diff [ 12470547 ]
        Dave Brosius made changes -
        Attachment bad_allocation_guard.diff [ 12470549 ]
        Dave Brosius made changes -
        Field Original Value New Value
        Attachment bad_allocation_guard.diff [ 12470547 ]
        Dave Brosius created issue -

          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