The current StorageParser implementation breaks when given some input.
I do not have a test case to reproduce this set of issues yet, but I can imagine some problematic situations:
Line breaks in user input
Imagine a Step with this description: "Do something\nDo something else"
When the Step is serialized with StorageParser.convertRecipeToString(Recipe), the output will contain a line break in the middle of a step description. When the application tries to parse the steps, the step will be split by the line break and parsing will fail.
Field keys in user input
Imagine a Step with "', mTime=" in its description. When the Step is serialized, the output will contain two occurrences of "', mTime=": One in the description, and one after the description. During parsing, the parser will find the first occurrence (in the description). That part of the description, and anything after it, will be lost. Even worse, the time parsing code will try to parse "', mTime=" as a number and will fail.
Resolution
The current serialization format has many issues. One way to resolve all of these would be to replace it with a standardized format that has thoroughly tested implementations, like JSON.
The current StorageParser implementation breaks when given some input.
I do not have a test case to reproduce this set of issues yet, but I can imagine some problematic situations:
Line breaks in user input
Imagine a Step with this description:
"Do something\nDo something else"
When the Step is serialized with
StorageParser.convertRecipeToString(Recipe)
, the output will contain a line break in the middle of a step description. When the application tries to parse the steps, the step will be split by the line break and parsing will fail.Field keys in user input
Imagine a Step with
"', mTime="
in its description. When the Step is serialized, the output will contain two occurrences of"', mTime="
: One in the description, and one after the description. During parsing, the parser will find the first occurrence (in the description). That part of the description, and anything after it, will be lost. Even worse, the time parsing code will try to parse"', mTime="
as a number and will fail.Resolution
The current serialization format has many issues. One way to resolve all of these would be to replace it with a standardized format that has thoroughly tested implementations, like JSON.