Project

General

Profile

Bug #10599

[Regression] undoLeaveTopLevel() generated during conversion, but it doesn't exist

Added by Dănuț Filimon about 1 year ago. Updated 15 days ago.

Status:
Review
Priority:
Normal
Assignee:
Target version:
-
Start date:
Due date:
% Done:

100%

billable:
No
vendor_id:
GCD
case_num:
version_reported:
version_resolved:
production:
No
env_name:
topics:

block_properties.patch Magnifier (5.41 KB) Dănuț Filimon, 09/19/2025 06:41 AM


Related issues

Related to Base Language - Bug #4602: fixes for OO 4GL and structured error handling Review

History

#1 Updated by Dănuț Filimon about 1 year ago

The test case is:

define temp-table tt1 field f1 as integer.

transactionBlock:
do transaction on error undo, leave:

    create tt1.

    catch err as Progress.Lang.AppError:
        undo, leave transactionBlock.
    end.

end.
and the converted code can't be compiled because the undoLeaveTopLevel() method doesn't exist:
compile:
    [javac] Compiling 32 source files to /home/ddf/gcd/branches/hotel_gui/build/classes
    [javac] Compiling 3 source files to /home/ddf/gcd/branches/hotel_gui/build/classes
    [javac] /home/ddf/gcd/branches/hotel_gui/src/com/goldencode/hotel/Start.java:44: error: cannot find symbol
    [javac]                undoLeaveTopLevel("transactionBlock");
    [javac]                ^
    [javac]   symbol:   method undoLeaveTopLevel(String)
    [javac]   location: class Start
    [javac] 1 error

BUILD FAILED
/home/ddf/gcd/branches/hotel_gui/build.xml:483: Compile failed; see the compiler error output for details.
This regression was introduced in trunk/15867.

#4 Updated by Dănuț Filimon about 1 year ago

I discussed with Eduard and he said that the issues should be fixed by 4602a. He also provided a patch I could use for the moment.

#5 Updated by Dănuț Filimon about 1 year ago

  • Related to Bug #4602: fixes for OO 4GL and structured error handling added

#6 Updated by Alexandru Lungu 19 days ago

  • Status changed from New to WIP
  • Assignee set to Eduard Soltan

I encountered this issue in a project as well:

define temp-table tt field f1 as int.

mainLoop:
repeat while not avail(tt):

   transactionLoop:
   do transaction on error undo, throw:

      create tt.

      catch err as Progress.Lang.AppError:
         undo, leave transactionLoop.
      end.

   end.

end.

Eduard, is it safe to integrate #10599-4 alone in trunk? If so, please create a task branch, add the change there, let me review it, we will test it and merge.

#7 Updated by Alexandru Lungu 19 days ago

FYI, the patch still applied cleanly to trunk and fixes the issue, generating undoLeave instead.

#8 Updated by Eduard Soltan 19 days ago

  • % Done changed from 0 to 100

Committed on 10599a, rev. 16769. I will do an AI review and after that I will move this branch in review status.

#9 Updated by Alexandru Lungu 16 days ago

  • reviewer Alexandru Lungu added

#10 Updated by Eduard Soltan 16 days ago

  • Status changed from WIP to Review

#11 Updated by Alexandru Lungu 15 days ago

  • reviewer Constantin Asofiei added

Review:

1. Critical – copyLabel (conversion crash): an unlabeled UNDO, LEAVE. or UNDO, NEXT. inside a CATCH should make conversion fail with a NullPointerException. The new catch label never gets a refid, and copyLabel then calls createXref(nref, null), which fails on the null. That is the main case the branch is meant to fix, so either this path wasn't converted in testing or something prevents the crash. It's worth reproducing. Fix: only call createXref in copyLabel when refid != null.
2. Major – UNDO, NEXT in a CATCH: at runtime it isn't turned into a LEAVE, because honorNext doesn't list CATCH as a non-looping block. deferredNextWorker clears the pending target and returns CONTINUE. The CATCH handler only stops on BREAK, so it rethrows, and the procedure exits early; code after the block is skipped. Fix: add BlockType.CATCH to honorNext's non-looping list.
3. Major – bare UNDO. in a CATCH: isCatch is decided before the implicit RETRY child is added, so a bare UNDO. still becomes undoRetryTopLevel(), while UNDO, RETRY. becomes undoRetry("__catch__"). Fix: treat a missing action as RETRY when computing isCatch.
4. Major – UNDO, RETURN in a CATCH: the new rule comment says the top-level RETURN variants handle a CATCH. Only the THROW variants and undoReturnErrorTopLevel(object) do; the rest roll back from the top level. This was already broken on trunk, but the branch leaves RETURN out of the fix because of that wrong assumption.
5. Minor – rollbackWorker early return: a CATCH is always pushed with no transaction support, so rollbacks aimed at a CATCH are always ignored. Changes made inside the CATCH body itself (undoable variables, temp-table creates) are never undone, where OpenEdge would revert them. This is a gap the branch leaves open, not something it made worse.
6. Minor – style: a blank line in createLabel has no indentation, unlike its neighbours.

I added Constantin as a second reviewer to this task, as the changes are more similar to the area of #4602.

Also available in: Atom PDF