Project

General

Profile

Bug #5240

BROWSE:SELECT-ROW(1) error on client

Added by Vladimir Tsichevski about 3 years ago. Updated about 3 years ago.

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

100%

billable:
No
vendor_id:
GCD
case_num:
version_reported:
version_resolved:

History

#1 Updated by Vladimir Tsichevski about 3 years ago

1. The following code works as expected in OE, and causes the error number 4078 (Unable to set attribute SCREEN-VALUE...) in FWD:

DEF TEMP-TABLE tt FIELD f1 AS CHARACTER FORMAT "x(32)".
CREATE tt.

OPEN QUERY q FOR EACH tt.

DEFINE BROWSE brws
   QUERY q DISPLAY tt.f1
   ENABLE ALL
   WITH TITLE "Browse" 
   SIZE 70 BY 7.

DEF FRAME fr brws WITH TITLE "Frame" SIZE 70 BY 15 NO-LABELS.
ENABLE ALL WITH FRAME fr.

brws:SELECT-ROW(1).
tt.f1:SCREEN-VALUE IN BROWSE brws = "16122021".
WAIT-FOR CLOSE OF THIS-PROCEDURE.

The origin of the problem is in that the SELECT-ROW does not work correctly at the client side in case the first row is selected. The code in the Browse class:

public boolean selectRow(int rowIndex)
{
   int row = getCachedRowNumber(rowIndex);
   if (isSelectionMultiple())
   {
      ...
   }
   else if (getCurrentRow() != row)
            ^^^^^^^^^^^^^^^^^^^^^^
   {
      ...
      setCurrentRow(row);
      ...
   }

does nothing in the case getCurrentRow() == row, which is the case just after the browse has been created, and setCurrentRow() is not called, and
the currRowSelected flag remains false.

2. Another difference: OE displays error 382 (FWD displays error 4078).

FWD throws the correct error 382 first, but this exception is not displayed as alert box.

#2 Updated by Vladimir Tsichevski about 3 years ago

  • Start date deleted (04/05/2021)

#3 Updated by Greg Shah about 3 years ago

  • Assignee set to Stanislav Lomany

#4 Updated by Vladimir Tsichevski about 3 years ago

  • Assignee deleted (Stanislav Lomany)

As a workaround: the line 1726 in Browse:

   else if (getCurrentRow() != row)

can be replaced by:

      else if (!currRowSelected || (getCurrentRow() != row))

#5 Updated by Vladimir Tsichevski about 3 years ago

  • Assignee set to Stanislav Lomany

#6 Updated by Stanislav Lomany about 3 years ago

  • Status changed from New to WIP

I wish all tasks would contain a solution inside, like this one:) The change is good, I'll take a look into #5245 and then commit here.

#7 Updated by Stanislav Lomany about 3 years ago

  • Status changed from WIP to Review

2. Another difference: OE displays error 382 (FWD displays error 4078).
FWD throws the correct error 382 first, but this exception is not displayed as alert box.

Vladimir, this is caused by your recent change where exception is caught in GenericWidget and therefore not handled in BrowseColumnWidget. I extracted error handling to a separate function.

Committed 3821c rev 12267.

#8 Updated by Vladimir Tsichevski about 3 years ago

Stanislav Lomany wrote:

Vladimir, this is caused by your recent change where exception is caught in GenericWidget and therefore not handled in BrowseColumnWidget. I extracted error handling to a separate function.

This change of yours looks artificial and hence a bit suspicious to me. I will see at it more thoroughly on Monday.

#9 Updated by Vladimir Tsichevski about 3 years ago

Vladimir Tsichevski wrote:

Stanislav Lomany wrote:

Vladimir, this is caused by your recent change where exception is caught in GenericWidget and therefore not handled in BrowseColumnWidget. I extracted error handling to a separate function.

This change of yours looks artificial and hence a bit suspicious to me. I will see at it more thoroughly on Monday.

You added the setScreenValueNoErrorHandling() method to artificially change the error handling control flow. I did not analyze all the implications, but may be, it would be better to handle errors where they arise: use ErrorManager.recordOrThrowError(382, ...) methods instead of just throwing the exception with throw new ErrorConditionException(382, "")?

#10 Updated by Stanislav Lomany about 3 years ago

may be, it would be better to handle errors where they arise: use ErrorManager.recordOrThrowError(382, ...) methods instead of just throwing the exception with throw new ErrorConditionException(382, "")?

That's just a convenient way to return control to server and write to server log. I'm not sure if ever use ErrorManager.recordOrThrowError on the client side.

I thought you would ask if we want to handle error 382 in GenericWidget (that may be an option).

Greg, please review 3821c rev 12267 to close this off.

#11 Updated by Greg Shah about 3 years ago

That's just a convenient way to return control to server and write to server log. I'm not sure if ever use ErrorManager.recordOrThrowError on the client side.

Correct, we generally should not use ErrorManager.recordOrThrowError() on the client side. In addition to the issue with the server.log we have the problem with recording error state in the ERROR-STATUS handle. Although the RemoteErrorData does allow some of the state to be redirected to the server, this is inefficient (very slow) and it may not be complete.

Throwing real exceptions on the clinet shifts the control flow to the server, where the error handling is properly managed.

#12 Updated by Greg Shah about 3 years ago

  • % Done changed from 0 to 100
  • Status changed from Review to Closed

Code Review Task Branch 3821c Revisin 12267

I'm OK with the changes.

Also available in: Atom PDF