Skip to content

Commit

Permalink
Make StringComparator deserialization case-insensitive (apache#3356)
Browse files Browse the repository at this point in the history
  • Loading branch information
jon-wei authored and fjy committed Aug 12, 2016
1 parent 18af480 commit 4545878
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public abstract class StringComparator implements Comparator<String>
@JsonCreator
public static StringComparator fromString(String type)
{
switch (type) {
switch (type.toLowerCase()) {
case StringComparators.LEXICOGRAPHIC_NAME:
return StringComparators.LEXICOGRAPHIC;
case StringComparators.ALPHANUMERIC_NAME:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -207,5 +207,9 @@ public void testNumericComparatorSerdeTest() throws IOException
String makeFromJsonSpec = "\"numeric\"";
Assert.assertEquals(StringComparators.NUMERIC
, jsonMapper.readValue(makeFromJsonSpec, StringComparator.class));

makeFromJsonSpec = "\"NuMeRiC\"";
Assert.assertEquals(StringComparators.NUMERIC
, jsonMapper.readValue(makeFromJsonSpec, StringComparator.class));
}
}

0 comments on commit 4545878

Please sign in to comment.