[WIP] Fix the null identifier issue in MigrateToV2 #632
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 inString.format
. Therefore, when the methodgetNextToken
returnsnull
(this happens when we are trying to get an optional argument and there are no tokens left), and we use thenull
value inString.format
to create the transformed / migrated directive string, we get a string withnull
substrings in it.Example:
Consider the
set-type
directive. It expects 2 optional argumentsscale
androunding-mode
. When the directiveset-type :col decimal
is given, it should be transformed toset-type :col decimal
(no change). But it incorrectly gets transformed toset-type :col decimal null null
because of this issue.JIRA: CDAP-20576