Bug #10894
Date FILL-IN: Client crash on APPLY '0' after APPLY '?'
100%
Related issues
History
#1 Updated by Vladimir Tsichevski 8 months ago
Run the following example in either GUI or ChUI mode:
SESSION:DATE-FORMAT = 'mdy'. DEFINE VARIABLE dateField AS DATE VIEW-AS FILL-IN NO-UNDO FORMAT '99/99/9999'. DEFINE FRAME f dateField NO-LABEL. ENABLE ALL WITH FRAME f. APPLY '?' TO dateField IN FRAME f. APPLY '0' TO dateField IN FRAME f. WAIT-FOR WINDOW-CLOSE OF FRAME f.
In this example, a frame with a date FILL-IN widget is created. The question mark is passed to the FILL-IN using the 4GL APPLY statement to reset the screen value to empty, then a digit character (e.g., 0) is passed in the same manner.
In OE: The screen value becomes 0 / /.
In FWD: The client crashes on sending 0 with StringIndexOutOfBoundsException. Stack trace:
Thread [main] (Suspended (exception StringIndexOutOfBoundsException)) String.substring(int, int) line: 1967 DateFormat$DateBuf.extractComponentText(String, byte) line: 1528 DateFormat$DateBuf.extractDayOrMonth(String, byte) line: 1566 DateFormat$DateBuf.toDate(List<ErrorEntry>) line: 1784 DateFormat$DateBuf.toVar(BaseDataType) line: 1481 FillInGuiImpl(FillIn<O,C>).update(boolean) line: 1164 FillInGuiImpl(FillIn<O,C>).getValue() line: 894 FillInGuiImpl(DataContainer).getChangedValue() line: 90 ThinClient.lambda$97(Object[], Widget) line: 19242 748975217.run() line: not available ErrorManager.ignoreWorker(Runnable, ErrorManager$WorkArea) line: 4643 ErrorManager.ignore(Runnable) line: 696 ErrorManager.nullErrors(Runnable) line: 713 ThinClient.putWidgetValue(Widget, ScreenBuffer) line: 19242 ThinClient.getScreenBuffer(int, boolean, Set<WidgetId>) line: 19086 ThinClient.getScreenBuffer(int, boolean) line: 19003 ThinClient.apply(int, int, ScreenBuffer[], EventList, boolean) line: 5097
#4 Updated by Vladimir Tsichevski 8 months ago
- Status changed from New to WIP
- Assignee set to Vladimir Tsichevski
The crash occurs when parsing the screen value 0 in a date FILL-IN widget with a delimited format (e.g., 99/99/9999). The absence of expected delimiters triggers a parsing failure.
Two key issues contribute to the StringIndexOutOfBoundsException:
- Missing Pre-Input Formatting: After
APPLY '?'empties the screen value, applying'0'to the dateFILL-INwith delimiters should first expand the value to include placeholders (e.g.," / /") before inserting the digit. FWD skips this step, leading to invalid parsing input. - Error Suppression Failure: The parsing code executes within an
ErrorManager.nullErrors(...)block, which (per Javadoc) should suppress and ignore all errors. This suppression does not occur, allowing the exception to propagate and crash the client.
#5 Updated by Vladimir Tsichevski 8 months ago
- % Done changed from 0 to 30
Vladimir Tsichevski wrote:
The crash occurs when parsing the screen value
0in a dateFILL-INwidget with a delimited format (e.g.,99/99/9999). The absence of expected delimiters triggers a parsing failure.
StringIndexOutOfBoundsException fixed in 10894a revision 16293.
#6 Updated by Vladimir Tsichevski 8 months ago
Missing Pre-Input Formatting¶
When a user presses a key, the code in FillIn.processKeyEvent (line 1545) must invoke zapDataPres.input(ch) to update the screen value with delimiters:
if (focused && !isCharacterInGui() &&
(isZapToBeApplied() ||
appDataPres == null ||
appDataPres.isUnknown()))
...
inputRes = zapDataPres.input(ch);
However, for APPLY-driven input (e.g., APPLY '5'), the widget is not focused, so this branch is skipped.
The Fix¶
Remove the focused check from the condition to ensure zapDataPres.input(ch) is invoked regardless of focus state.
Example¶
Consider this example:
SESSION:DATE-FORMAT = 'mdy'. DEFINE VARIABLE dateField AS DATE VIEW-AS FILL-IN NO-UNDO FORMAT '99/99/9999'. DEFINE VARIABLE otherField AS CHARACTER. DEFINE FRAME f otherField dateField NO-LABEL. ENABLE ALL WITH FRAME f. ON 'a' ANYWHERE DO: APPLY '5' TO dateField IN FRAME f. MESSAGE dateField:SCREEN-VALUE IN FRAME f. END. WAIT-FOR WINDOW-CLOSE OF FRAME f.
This sets up a frame with two enabled FILL-IN widgets (a character field first, followed by the date field). A trigger on the a key applies '5' to the date FILL-IN and displays its SCREEN-VALUE.
Scenario (GUI Mode)¶
- Run the example in GUI mode. The initial focus is on the first
FILL-IN(character field), leaving the dateFILL-INunfocused. Its initial display shows delimiters (" / /"). - Press the
akey (triggersAPPLY '5').
Expected Behavior (OE)¶
On eacha press, the digit 5 is inserted progressively:
- First:
5 / /(displayed and printed). - Second:
55/ /. - Third:
55/5 /(etc.).
FWD Behavior (Before Fix)¶
- Printed
SCREEN-VALUEis correct (includes delimiters). - Visible (displayed) value:
- Does not repaint until window focus changes (e.g., switching windows reveals updates).
- Lacks delimiters (e.g., shows
5555instead of55/55/).
FWD Behavior (After Fix)¶
- Printed
SCREEN-VALUEis correct. - Visible value includes delimiters and repaints properly (e.g.,
5 / /on first press). - Only the first
5inserts; subsequent presses do not change the visible value.
This post-fix behavior aligns with OE in ChUI mode.
Scenario (ChUI Mode)¶
Run the same example and scenario in ChUI mode.
Expected Behavior (OE)¶
- First
apress:5 / /is displayed and printed. - Subsequent
apresses: the same5 / /is displayed and printed.
FWD Behavior (After Fix)¶
Matches OE exactly.
#7 Updated by Vladimir Tsichevski 8 months ago
Vladimir Tsichevski wrote:
Missing Pre-Input Formatting¶
Fixed in 10894a rev. 16294.
- Only the first
5inserts; subsequent presses do not change the visible value.This post-fix behavior aligns with OE in ChUI mode.
This is the remaining difference to fix: implement GUI-specific behavior.
#9 Updated by Vladimir Tsichevski 8 months ago
- Status changed from WIP to Review
- % Done changed from 80 to 100
Vladimir Tsichevski wrote:
Vladimir Tsichevski wrote:
Missing Pre-Input Formatting¶
Fixed in 10894a rev. 16294.
- Only the first
5inserts; subsequent presses do not change the visible value.This post-fix behavior aligns with OE in ChUI mode.
This is the remaining difference to fix: implement GUI-specific behavior.
Fixed in rev. 16295. Please, review.
#10 Updated by Hynek Cihlar 7 months ago
- Status changed from Review to WIP
- % Done changed from 100 to 90
Code review 10894a.
extractComponentText:
- Please fix the indentation.
- The @param screen description is missing a closing parenthesis.
- The @param kind description has a double closing brace.
Otherwise the changes look good.
#11 Updated by Vladimir Tsichevski 7 months ago
- Status changed from WIP to Review
- % Done changed from 90 to 100
Hynek Cihlar wrote:
Code review 10894a.
extractComponentText:
- Please fix the indentation.
- The @param screen description is missing a closing parenthesis.
- The @param kind description has a double closing brace.
Otherwise the changes look good.
Rebased and fixed in 10894a rev. 16334.
#12 Updated by Hynek Cihlar 6 months ago
- Status changed from Review to Internal Test
Code review 10894a. The changes look good.
#13 Updated by Vladimir Tsichevski 6 months ago
Hynek Cihlar wrote:
Code review 10894a. The changes look good.
I've rebased 10894a to the latest trunk, and added a minor optimization fix. The new revision is 16352.
I've retested the original issue and the #10894-6 issue.
Also I ran Sikuli-based tests. All went well.
Hynek, can you run the ChUI test suite on my behalf?
#14 Updated by Hynek Cihlar 6 months ago
Vladimir Tsichevski wrote:
Hynek Cihlar wrote:
Code review 10894a. The changes look good.
I've rebased 10894a to the latest trunk, and added a minor optimization fix. The new revision is 16352.
I've retested the original issue and the #10894-6 issue.
Also I ran Sikuli-based tests. All went well.Hynek, can you run the ChUI test suite on my behalf?
Running.
#15 Updated by Hynek Cihlar 6 months ago
I think there is a regression, more details in a PM.
#20 Updated by Vladimir Tsichevski 6 months ago
- Status changed from WIP to Review
- % Done changed from 80 to 100
Vladimir Tsichevski wrote:
I've run the failing ChUI test suite test, the issue confirmed.
This failure is caused by the known test instability issue #10008.
I ran a stripped-down version of this test 37 times on the latest trunk:
- passed: 20 times
- failed with the same error: 17 times
#21 Updated by Alexandru Lungu 6 months ago
- Status changed from Review to Internal Test
I ran a stripped-down version of this test 37 times on the latest trunk:
In #10894-18, this was still reported as Internal Test. Apparently, a false negative occurred in ChUI. I can confirm that #10008 is indeed occurring now and then and having it pass at least once is ideal. In other words, this seems still in Internal Test.
As ChUI testing passed, can we do a final smoke testing with #9846 customer application? If it succeeds, lets have this 10894a in trunk and then move on with testing of #9846 as notified in #9846-35 (i.e. we must either merge 10894a).
#22 Updated by Vladimir Tsichevski 6 months ago
Alexandru Lungu wrote:
As ChUI testing passed, can we do a final smoke testing with #9846 customer application? If it succeeds, lets have this 10894a in trunk and then move on with testing of #9846 as notified in #9846-35 (i.e.
we must either merge 10894a).
Clarification on dependency between 10894a and 9846c
The fix in 10894a enables fully automatic UI testing with APPLY statements - no user interaction required.
This capability was heavily used during development and verification of 9846c.
However:
- The 9846c fix itself does not depend on 10894a.
- The only complication is that the 10894a fix was cherry-picked into the 9846c branch early - in revision 16331 - before most other 9846c changes.
Consequence when merging 9846c:
- Merging the branch as-is will also bring in the 10894a fix. This is undesirable if we want to keep 10894a separate.
Options before merging 9846c to trunk:
- Merge 10894a first (recommended): no extra work, clean history
- Or, in the 9846c branch, forcefully revert rev. 16331: requires additional work (manual conflict resolution, testing)
#23 Updated by Hynek Cihlar 6 months ago
Vladimir, please make sure to check in any test cases that are still unchecked.
#26 Updated by Hynek Cihlar 5 months ago
- Status changed from Internal Test to Merge Pending
Vladimir, please merge 10894a in trunk.
#28 Updated by Hynek Cihlar 5 months ago
Vladimir Tsichevski wrote:
Hynek Cihlar wrote:
Vladimir, please merge 10894a in trunk.
WIP...
Do you mean there is more work needed?
#30 Updated by Hynek Cihlar 5 months ago
Vladimir Tsichevski wrote:
No, I mean update trunk, rebase, rebuild the branch and finally merge. This work is in progress...
I see :-)
#32 Updated by Alexandru Lungu 5 months ago
- Status changed from Merge Pending to Test