Project

General

Profile

Bug #7175

substitute: incorrect handling of unknown longchar values

Added by Vladimir Tsichevski about 1 year ago. Updated about 1 year ago.

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

100%

billable:
No
vendor_id:
GCD
case_num:

History

#2 Updated by Vladimir Tsichevski about 1 year ago

An unknown lonchar value passed as an formatting parameter for substitute is formatted as null instead of expected ?:

DEFINE VARIABLE v AS LONGCHAR NO-UNDO.
v = ?.
MESSAGE SUBSTITUTE("Longchar '&1'", v).

Note: before OE 11.7 the formatted value in OE was empty string instead of ? :-(
Note: this bug was first mentioned in #7143-33.

#3 Updated by Vladimir Tsichevski about 1 year ago

  • % Done changed from 0 to 90
  • Status changed from New to WIP

This patch fixes this issue:

=== modified file 'src/com/goldencode/p2j/util/TextOps.java'
--- src/com/goldencode/p2j/util/TextOps.java    2023-01-18 13:51:25 +0000
+++ src/com/goldencode/p2j/util/TextOps.java    2023-03-06 22:04:10 +0000
@@ -6825,9 +6825,9 @@
                         // this is required because P4GL uses yes/no instead of true/false
                         sb.append(new logical(((Boolean) obj)));
                      }
-                     else if (obj instanceof character)
+                     else if (obj instanceof Text)
                      {
-                        character ch = (character) obj;
+                        Text ch = (Text) obj;
                         sb.append(ch.isUnknown() ? "?" : ch.getValue());
                      }
                      else if (obj instanceof object)

#4 Updated by Vladimir Tsichevski about 1 year ago

  • % Done changed from 90 to 100
  • Status changed from WIP to Review

Committed as 3827a rev. 14502.

Also available in: Atom PDF