You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using "Load file content in memory" to read a JSON file and a "JavaScript" transform to parse it, changing "Trim type" from "None" to any other value (i.e. "left", "right" or "both" in the "Fields" tab of "Load file content in memory" transform) changes the output of a (whitespace-less!) value of a JSON attribute.
How to reproduce:
copy the two files to default project (the hpl file is zipped as hpl files cannot be uploaded)
preview "JavaScript" transform
If you change back "Trim type" to "none" everything is ok (last image).
Note that the difference in output depending on trim type is also the case when the metric attribute is nested inside a more complex JSON structure.
File content's data type "String" and "JSON" behave the same. Encoding set to UTF8, for both the stream field and the file written from disk.
Note that the wrong output also occurs even when "°" characer is not the first or last character in the string.
Using "JSON input" directly to read and parse the jSON does not show a difference in output when changing the trim type.
Seems to be a problem of "Load file content in memory"-"JavaScript" combination.
Did a little more testing:
seems to be an issue of "Load file content in memory" transform:
when "file_content" is read as String, and not sent to a "Java Script" transform but to a "JSON input", then the issue appears.
Using JSON input to directly read the file does not show the issue.
Apache Hop version?
2.12.0
Java version?
OpenJDK 17
Operating system
Windows
What happened?
When using "Load file content in memory" to read a JSON file and a "JavaScript" transform to parse it, changing "Trim type" from "None" to any other value (i.e. "left", "right" or "both" in the "Fields" tab of "Load file content in memory" transform) changes the output of a (whitespace-less!) value of a JSON attribute.
How to reproduce:
If you change back "Trim type" to "none" everything is ok (last image).
Note that the difference in output depending on trim type is also the case when the metric attribute is nested inside a more complex JSON structure.
File content's data type "String" and "JSON" behave the same. Encoding set to UTF8, for both the stream field and the file written from disk.
Note that the wrong output also occurs even when "°" characer is not the first or last character in the string.
Using "JSON input" directly to read and parse the jSON does not show a difference in output when changing the trim type.
Seems to be a problem of "Load file content in memory"-"JavaScript" combination.
Issue Priority
Priority: 3
Issue Component
Component: Hop Gui, Component: Transforms
trim_behaviour.json
trim_behaviour.hpl.zip
The text was updated successfully, but these errors were encountered: