Bug #11191
ChUI: COMBO-BOX raises error 4058 on valid SCREEN-VALUE assignment
100%
History
#2 Updated by Vladimir Tsichevski 6 months ago
Run this example in CHARACTER mode:
DEFINE VARIABLE id AS CHARACTER FORMAT "x(3)". DEFINE FRAME f id VIEW-AS COMBO-BOX LIST-ITEM-PAIRS "123456789qwe", "123456789abc" DROP-DOWN-LIST. ENABLE ALL WITH FRAME f. id:SCREEN-VALUE = "123456789abc". WAIT-FOR WINDOW-CLOSE OF CURRENT-WINDOW.
- In OE: code runs without error.
- In FWD: error 4058 raised ("**Attribute SCREEN-VALUE for the %s has an invalid value of 123.").
This problem was initially reported as #11126-11.
#3 Updated by Razvan-Nicolae Chichirau 5 months ago
- Status changed from New to WIP
SCREEN-VALUE attribute. I'll use the following messages for reference:
- Any message that results from the fact that a value could not be converted to the combo-box format.
**Attribute SCREEN-VALUE for the <widget_type> <widget_name> has an invalid value of <unformatted_value>. (4058)
For GUI combo boxes of type DROP-DOWN or SIMPLE, the value assigned to SCREEN-VALUE is not validated (i.e., whether it can be formatted or whether the formatted value exists among the items) and is simply accepted, so no errors are thrown. The following is true for DROP-DOWN-LIST on GUI and all types (SIMPLE, DROP-DOWN, DROP-DOWN-LIST) on ChUI:
- Value can not be formatted: 1 (ERROR) + 2 (WARNING)
- Value can be formatted, but does not exist in the items: 2 (WARNING)
- Value is empty string
- no items: no error
- has items: no error
- Value is unknown value:
- no items: no error
- has items: no error
#4 Updated by Razvan-Nicolae Chichirau 5 months ago
- Assignee set to Razvan-Nicolae Chichirau
#5 Updated by Razvan-Nicolae Chichirau 5 months ago
Did some extensive testing for the following control set entities: radio-set, combo-box and selection-list. Consider the error messages from #11191-3.
COMBO-BOX¶
The following data-types were tested:character, logical, integer, decimal, date, datetime, datetime-tz, recid
- GUI
- The
SIMPLEandDROP-DOWNcombos does not throw any errors and accept the input as is. - For
DROP-DOWN-LIST:- Widget is not realized
- Can not format the screen-value: 1 + 2
- Can format, but does not exist among the current items: no errors, silent exit
- Widget is realized
- Can not format the screen-value: 1 + 2
- Can format, but does not exist among the current items: 2
- Widget is not realized
- The
- CHUI
- The following is true for all combo-box types:
- Widget is not realized
- Can not format the screen-value: 1 + 2
- Can format, but does not exist among the current items: no errors, silent exit
- Widget is realized
- Can not format the screen-value: 1 + 2
- Can format, but does not exist among the current items: 2
- Widget is not realized
- The following is true for all combo-box types:
RADIO-SET¶
The following data-types were tested:character, logical, integer, decimal, date, datetime, datetime-tz, recid
- GUI + CHUI
- Widget is not realized or it is realized: 2
SELECTION-LIST¶
Onlycharacter data-type was tested as it was the only one permitted for this widget.
- GUI + CHUI:
- Widget is not realized or it is realized: 2
The browse column widget has another behavior compared with the widgets listed above. This can be treated in another task and the functionality of combo-box, radio-set and selection-list can be grouped and treated in this issue.
#6 Updated by Razvan-Nicolae Chichirau 3 months ago
- % Done changed from 0 to 100
- Status changed from WIP to Review
Hynek: Please review 11191a/rev. 16549.
#7 Updated by Hynek Cihlar 3 months ago
- % Done changed from 100 to 90
- Status changed from Review to WIP
Code review 11191a revisions 16548..16549
- [CRITICAL] style
RadioSetWidget: Copyright year in the file header is still2005-2025, but the file is modified in 2026. Update to2005-2026, Golden Code Development Corporation. - [CRITICAL] functional
ControlSetEntity.invalidScreenValueWarning: Method dereferencesunparsedValueviaunparsedValue.isUnknown()with no null check. Concrete trigger: the 3-argGenericWidget.setScreenValue(ScreenBuffer, Object, boolean)forwardsunparsedValue=nullto the 4-arg overload; this is exercised on the standard frame realization / DISPLAY path viaGenericFrame.copyToScreenBuffer(around line 11301) on a RADIO-SET, SELECTION-LIST or already-realized COMBO-BOX whose value failsisValidScreenValue. The chain reachesvalidateScreenValue(value, null)which callsinvalidScreenValueWarning(null, ...); for RADIO-SET / SELECTION-LIST therealizeCheck=falseguard does not bail out, and the method NPEs onunparsedValue.isUnknown(). The old inline implementation referenced only the parsedvalue(never null), so this is a regression. Add a null guard or fall back to the parsedvaluewhenunparsedValueis null. - [CRITICAL] functional
RadioSetWidget.validateScreenValue: CallsinvalidScreenValueWarning(unparsedValue, false)when validation fails. Same trigger as above —unparsedValuecan benullon the 3-argsetScreenValuepath (used during frame realization). WithrealizeCheck=falseand a non-nullframe,invalidScreenValueWarning(null, false)immediately NPEs onunparsedValue.isUnknown(). - [MAJOR] functional
ControlSetEntity.invalidScreenValueWarning: ReplacesErrorManager.recordOrShowWarning(...)withErrorManager.displayWarning(...). The two are not equivalent: (a)recordOrShowWarningshort-circuits onisSuppressWarnings()and on per-codesuppressWarningsSet.contains(num), whiledisplayWarningnever consults the per-code suppression set and adds the condition to_MSGeven under SESSION:SUPPRESS-WARNINGS; (b)recordOrShowWarningdelegates torecordOrShowErrorwhich throwsDeferredLegacyErrorExceptionwhenhasLegacyError()/mustManageLegacyError()is true, allowing an enclosing 4GLCATCH Progress.Lang.SysErrorto capture the condition —displayWarningnever throws. Reachable from straightforward 4GL:ASSIGN cb:SCREEN-VALUE = "<invalid>"inside SESSION:SUPPRESS-WARNINGS, with SUPPRESS-WARNINGS-LIST naming 4056/4058, or inside a CATCH block. Verify against OE behavior; ifdisplayWarningis the intended API, the previously suppressed/catchable cases need explicit handling. - [MINOR] style
RadioSetWidget.setScreenValueInt: Continuation lines of the multi-lineifcondition are indented one column short of the opening condition character, breaking project convention for multi-line condition alignment. - [MINOR] style
GenericFrame.setScreenValue: Newly added Javadoc\@param widgetdescription reads "The widget for which the value is to be retrieved". This is a setter; description must say "set". - [MINOR] style
ControlSetEntity.invalidScreenValueWarning: Both\@paramtags use 3 spaces after the tag keyword. All other Javadoc\@paramtags in this file and in the same diff use 4 spaces — adjust for consistency. - [MINOR] style
ControlSetEntity.shouldParseScreenValue/ComboBoxWidget.shouldParseScreenValue: Both newly added Javadoc blocks use\@returnwith 2 spaces. Existing\@returntags in these files use 3 spaces — adjust for consistency.
Instead of getSubType().getValue().equals("DROP-DOWN-LIST") compare the enum value returned by ComboBoxConfig.getMode.
In setScreenValueInt catching ErrorConditionException is used for the happy path. The catch block here is part of the expected flow, not an exceptional condition. Let's turn this into a predicate (e.g. tryParseScreenValue returning a boolean) and reserve the exception for genuinely unexpected failures (or the error condition in this case).
Is the 'UNKNOWN' in invalidScreenValueWarning also displayed in OpenEdge? OpenEdge AFAIK typically represents unknown values as '?' in the messages.
#8 Updated by Razvan-Nicolae Chichirau 3 months ago
- Status changed from WIP to Review
- % Done changed from 90 to 100
Hynek Cihlar wrote:
Code review 11191a revisions 16548..16549
- [CRITICAL] style
RadioSetWidget: Copyright year in the file header is still2005-2025, but the file is modified in 2026. Update to2005-2026, Golden Code Development Corporation.- [CRITICAL] functional
ControlSetEntity.invalidScreenValueWarning: Method dereferencesunparsedValueviaunparsedValue.isUnknown()with no null check. Concrete trigger: the 3-argGenericWidget.setScreenValue(ScreenBuffer, Object, boolean)forwardsunparsedValue=nullto the 4-arg overload; this is exercised on the standard frame realization / DISPLAY path viaGenericFrame.copyToScreenBuffer(around line 11301) on a RADIO-SET, SELECTION-LIST or already-realized COMBO-BOX whose value failsisValidScreenValue. The chain reachesvalidateScreenValue(value, null)which callsinvalidScreenValueWarning(null, ...); for RADIO-SET / SELECTION-LIST therealizeCheck=falseguard does not bail out, and the method NPEs onunparsedValue.isUnknown(). The old inline implementation referenced only the parsedvalue(never null), so this is a regression. Add a null guard or fall back to the parsedvaluewhenunparsedValueis null.- [CRITICAL] functional
RadioSetWidget.validateScreenValue: CallsinvalidScreenValueWarning(unparsedValue, false)when validation fails. Same trigger as above —unparsedValuecan benullon the 3-argsetScreenValuepath (used during frame realization). WithrealizeCheck=falseand a non-nullframe,invalidScreenValueWarning(null, false)immediately NPEs onunparsedValue.isUnknown().- [MINOR] style
RadioSetWidget.setScreenValueInt: Continuation lines of the multi-lineifcondition are indented one column short of the opening condition character, breaking project convention for multi-line condition alignment.- [MINOR] style
GenericFrame.setScreenValue: Newly added Javadoc\@param widgetdescription reads "The widget for which the value is to be retrieved". This is a setter; description must say "set".- [MINOR] style
ControlSetEntity.invalidScreenValueWarning: Both\@paramtags use 3 spaces after the tag keyword. All other Javadoc\@paramtags in this file and in the same diff use 4 spaces — adjust for consistency.- [MINOR] style
ControlSetEntity.shouldParseScreenValue/ComboBoxWidget.shouldParseScreenValue: Both newly added Javadoc blocks use\@returnwith 2 spaces. Existing\@returntags in these files use 3 spaces — adjust for consistency.Instead of
getSubType().getValue().equals("DROP-DOWN-LIST")compare the enum value returned byComboBoxConfig.getMode.In
setScreenValueIntcatchingErrorConditionExceptionis used for the happy path. The catch block here is part of the expected flow, not an exceptional condition. Let's turn this into a predicate (e.g.tryParseScreenValuereturning a boolean) and reserve the exception for genuinely unexpected failures (or the error condition in this case).
Fixed.
Raising a warning for the invalid screen-value in 4GL will:
- [MAJOR] functional
ControlSetEntity.invalidScreenValueWarning: ReplacesErrorManager.recordOrShowWarning(...)withErrorManager.displayWarning(...). The two are not equivalent: (a)recordOrShowWarningshort-circuits onisSuppressWarnings()and on per-codesuppressWarningsSet.contains(num), whiledisplayWarningnever consults the per-code suppression set and adds the condition to_MSGeven under SESSION:SUPPRESS-WARNINGS; (b)recordOrShowWarningdelegates torecordOrShowErrorwhich throwsDeferredLegacyErrorExceptionwhenhasLegacyError()/mustManageLegacyError()is true, allowing an enclosing 4GLCATCH Progress.Lang.SysErrorto capture the condition —displayWarningnever throws. Reachable from straightforward 4GL:ASSIGN cb:SCREEN-VALUE = "<invalid>"inside SESSION:SUPPRESS-WARNINGS, with SUPPRESS-WARNINGS-LIST naming 4056/4058, or inside a CATCH block. Verify against OE behavior; ifdisplayWarningis the intended API, the previously suppressed/catchable cases need explicit handling.
- Make the warning be unconditionally added to _MSG, whether
SESSION:SUPPRESS-WARNINGSor set or not - Not display the warning in case of
SESSION:SUPPRESS-WARNINGS - Not throw an actual 4GL legacy error which can be caught by a CATCH block.
As such, displayWarning is the correct API to use here.
Is the 'UNKNOWN' in
invalidScreenValueWarningalso displayed in OpenEdge? OpenEdge AFAIK typically represents unknown values as '?' in the messages.
Check this testcase:
def var rs as char view-as radio-set radio-buttons "a", "b". def frame f rs. rs:screen-value = ?.
Please review 11191a/rev. 16550.
#9 Updated by Hynek Cihlar 3 months ago
- Status changed from Review to Internal Test
Code review 11191a revisions 16548..16550
The changes look good. Please go ahead with regression testing. Also run ChUI regression tests.
#10 Updated by Razvan-Nicolae Chichirau about 1 month ago
- Status changed from Internal Test to Review
Small regression detected on the testcases project:
define variable rs as logical initial ? format 'one/two' view-as radio-set radio-buttons "first", true, "second", true. def frame f rs. rs:screen-value = "". display rs with frame f. wait-for window-close of current-window.
Trunk and 4GL do not raise a warning, meanwhile 11191a does, GUI + ChUI.
Hynek: Please review 11191a/rev. 16624.
#11 Updated by Hynek Cihlar 20 days ago
- % Done changed from 100 to 90
- Status changed from Review to WIP
Code review 11191a revisions 16621..16624
Intsead of this instanceof BrowseColumnWidget override recoverFromParsingError.
Please check the following functional points.
- [MAJOR] functional
RadioSetWidget.setScreenValueInt/isValidScreenValue: The rev-16624savedValuerecovery that suppresses the false-positive 4058 warning is captured only inside the GUI branch (!LogicalTerminal.isChui()), so the ChUI arm of the reproducer regresses. In ChUI,setScreenValueIntleaves""untouched andsavedValuestaysnull;parseScreenValue(logical, "", "one/two")yields an unknownlogical(empty value, format not delimited by/), whichControlSetEntity.setScreenValuere-derives as an unknowncharacter;isValidScreenValuethen has nosavedValueto restore the original"", returnsfalseon!value.isUnknown(), andvalidateScreenValuefires a spurious 4058. GUI works only because it capturessavedValue = ""and swaps it back. Trigger: the redmine section-3 reproducer (rs as logical initial ? format 'one/two' view-as radio-set ...; rs:screen-value = "") run in CHARACTER mode — redmine states the false positive appeared in both GUI and ChUI on 11191a. CapturesavedValue(or otherwise preserve the original value for validation) on the ChUI path as well.
- [MINOR] functional
ControlSetEntity.invalidScreenValueWarning: The switch fromErrorManager.recordOrShowWarningtoErrorManager.displayWarning(id, msg, true)drops honoring ofSESSION:SUPPRESS-WARNINGS-LIST.recordOrShowWarningsuppresses when either the globalSUPPRESS-WARNINGSboolean or the per-number setsuppressWarningsSetmatches (ErrorManager~line 1452-1454);displayWarningchecks only the global boolean (~line 3441) and never consultssuppressWarningsSet. Trigger: a program setsSESSION:SUPPRESS-WARNINGS-LIST = "4058"(or "4056") then assigns an invalid SCREEN-VALUE to a realized control-set widget — previously suppressed entirely, now displayed and added to_MSG. Redmine section 2 mandates only the globalSUPPRESS-WARNINGSfor this case and requires the warning to unconditionally reach_MSG, so this may be acceptable; verify the per-number-list behavior against OE.
- [MINOR] style
ComboBoxWidget(header history entry #057): Typo in the new history description — "Overriden 'shouldParseScreenValue()'." should be "Overridden".
#12 Updated by Razvan-Nicolae Chichirau 16 days ago
- % Done changed from 90 to 100
- Status changed from WIP to Review
Hynek Cihlar wrote:
Intsead of
this instanceof BrowseColumnWidgetoverriderecoverFromParsingError.
- [MAJOR] functional
RadioSetWidget.setScreenValueInt/isValidScreenValue: The rev-16624savedValuerecovery that suppresses the false-positive 4058 warning is captured only inside the GUI branch (!LogicalTerminal.isChui()), so the ChUI arm of the reproducer regresses. In ChUI,setScreenValueIntleaves""untouched andsavedValuestaysnull;parseScreenValue(logical, "", "one/two")yields an unknownlogical(empty value, format not delimited by/), whichControlSetEntity.setScreenValuere-derives as an unknowncharacter;isValidScreenValuethen has nosavedValueto restore the original"", returnsfalseon!value.isUnknown(), andvalidateScreenValuefires a spurious 4058. GUI works only because it capturessavedValue = ""and swaps it back. Trigger: the redmine section-3 reproducer (rs as logical initial ? format 'one/two' view-as radio-set ...; rs:screen-value = "") run in CHARACTER mode — redmine states the false positive appeared in both GUI and ChUI on 11191a. CapturesavedValue(or otherwise preserve the original value for validation) on the ChUI path as well.
- [MINOR] style
ComboBoxWidget(header history entry #057): Typo in the new history description — "Overriden 'shouldParseScreenValue()'." should be "Overridden".
Solved.
- [MINOR] functional
ControlSetEntity.invalidScreenValueWarning: The switch fromErrorManager.recordOrShowWarningtoErrorManager.displayWarning(id, msg, true)drops honoring ofSESSION:SUPPRESS-WARNINGS-LIST.recordOrShowWarningsuppresses when either the globalSUPPRESS-WARNINGSboolean or the per-number setsuppressWarningsSetmatches (ErrorManager~line 1452-1454);displayWarningchecks only the global boolean (~line 3441) and never consultssuppressWarningsSet. Trigger: a program setsSESSION:SUPPRESS-WARNINGS-LIST = "4058"(or "4056") then assigns an invalid SCREEN-VALUE to a realized control-set widget — previously suppressed entirely, now displayed and added to_MSG. Redmine section 2 mandates only the globalSUPPRESS-WARNINGSfor this case and requires the warning to unconditionally reach_MSG, so this may be acceptable; verify the per-number-list behavior against OE.
4GL suppresses the warning message if either SESSION:SUPPRESS-WARNINGS is used or the message number is in the SESSION:SUPPRESS-WARNINGS-LIST value. Additionally, it adds it to _MSG() only if silent error is disabled and the process is not running in headless mode. As such, the correct method is recordOrShowWarning(), but with a slight modification. If the warning is suppressed and silent mode is disabled + not running in headless mode, append the message number to _MSG().
Note that I've verified all usages of this method, and the behavior is the same in every case. Please check rev. 16625.