-
Notifications
You must be signed in to change notification settings - Fork 7
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
Issue 52072: Text choice field values to handle | character within values #6374
base: develop
Are you sure you want to change the base?
Conversation
…g pipe character in validValues
…ns() and getTextChoiceValidatorExpression()
String[] valueTokens = str.split("(?<!\\\\)" + escapedDelimiter); | ||
|
||
// trim values and replace escaped delimiter | ||
List<String> valueList = Arrays.stream(valueTokens).map(String::trim) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need to go from list to stream to list to stream to list. Skip the toList()
step on this line... keep it Stream<String>
and then the steps below each become something simple like:
valueStream = valueStream.distinct();
valueStream = valueStream.sorted();
Then call .toList()
on the return line.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Prefect. That makes sense. Change made.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See comment about simplifying the stream handling in splitStringToValues()
|
||
values = PageFlowUtil.splitStringToValues("b|a|c| b | |", "|", false, false, false); | ||
Assert.assertEquals(List.of("b", "a", "c", "b", ""), values); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 for junit tests!
Rationale
https://www.labkey.org/home/Developer/issues/issues-details.view?issueId=52072
Text choice values are stored with a domain field as a regex validator as a concatenated string of values using the "|" delimiter. This PR updates this to account for values that contain the delimiter value.
Related Pull Requests
Changes