wrangler icon indicating copy to clipboard operation
wrangler copied to clipboard

[WIP] Fix the null identifier issue in MigrateToV2

Open GnsP opened this issue 1 year ago • 0 comments

In case of optional arguments to directives, when the optional argument(s) is/are not provided, the parser parses these as null identifiers (incorrectly).

This was because of a bug in the MigrateToV2 class. In Java, the value null is stringified as "null" instead of "" when used in String.format . Therefore, when the method getNextToken returns null (this happens when we are trying to get an optional argument and there are no tokens left), and we use the null value in String.format to create the transformed / migrated directive string, we get a string with null substrings in it.

Example:

Consider the set-type directive. It expects 2 optional arguments scale and rounding-mode. When the directive set-type :col decimal is given, it should be transformed to set-type :col decimal (no change). But it incorrectly gets transformed to set-type :col decimal null null because of this issue.

JIRA: CDAP-20576

GnsP avatar Apr 17 '23 07:04 GnsP