-
Notifications
You must be signed in to change notification settings - Fork 713
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
List converter for list of strings that contain comma aren't handled properly and result in a bad array #1301
Comments
As far as I know there's no way to escape a comma in this converter. (But in your example I expect you get an array with 3 elements Some time ago I created my own list fixture and list converter (and also a map fixture) since I found the default behaviour too limited. I did not see a way to change the default without breaking backward compatibility, unfortunately. Sample usage of ListFixture at: https://raw.githubusercontent.com/fhoeben/hsac-fitnesse-fixtures/master/wiki/FitNesseRoot/HsacExamples/SlimTests/UtilityFixtures/ListFixtureTest.wiki Sample usage of MapFixture: https://raw.githubusercontent.com/fhoeben/hsac-fitnesse-fixtures/master/wiki/FitNesseRoot/HsacExamples/SlimTests/UtilityFixtures/MapFixtureTest.wiki |
Thanks, I'll take a look at your samples. Also there is a typo in my bug report, I updated it to reflect what really happens in the array, based on your double quotes comment (the double quotes don't magically line up like I had, was just trying to illustrate a simple case, I guess poorly 😊). |
I agree this code is broken but I'm not clear what it's used for. I've only worked on .NET Slim not Java Slim, but the Slim protocol describes lists and strings with colon-delimited length prefixes. From http://fitnesse.org/FitNesse.UserGuide.WritingAcceptanceTests.SliM.SlimProtocol Strings and Lists A string is encoded as six or more digits followed by a colon, followed by the characters of the string. The six+ digits are the number of characters in the string, not including the digits themselves. Thus, the empty string is "000000:". This length encoding scheme is used in other places so we'll use the token to mean six digits followed by a colon. If a string is null, then the four character string null will replace it. A list is encoded as a string that begins with a '[', followed by a specifying the number of items in the list. This is followed by that many strings, each terminated by a colon, and then finally a ']' Thus, this list: [hello,world] is encoded as the following string: As you can see, each item of a list is a string. But since a string can encode a list, each item of a list can be another list. So we can have very deep recursive definitions. [0.4] For versions older than 0.4, the length part of an encoded string was exactly six digits. For version 0.4 the size can grow beyond 6 digits for really long messages. |
Describe the bug
fitnesse.slim.converters.ListConverterHelper::fromStringToArrayOfStrings
for list of strings that contain comma aren't handled properly and result in a bad array.To Reproduce
Steps to reproduce the behavior:
fitnesse.slim.converters.ListConverterHelper::fromStringToArrayOfStrings
), if your array of string contains a comma, this results in a bad array.["one,two,three"]
. This is an array with length 1. After the list converter runs on it, we result in an array with length 3["\"one","two","three\""]
which is not desired.Expected behavior
Give a way to escape strings that contain a comma so our lists are preserved. Maybe there is some other kind of workaround?
Additional context
fitnesse.slim.converters.ListConverterHelper::fromStringToArrayOfStrings
-- this strips the[
and]
then blindly splits on,
. Could this source code handle escaped commas before splitting?The text was updated successfully, but these errors were encountered: