Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,12 @@ protected Deserializer(T[] values, EnumSet<JsonParser.Event> acceptedEvents) {
for (T member : values) {
String jsonValue = member.jsonValue();
if (jsonValue != null) { // _Custom enum members have a null jsonValue
this.lookupTable.put(jsonValue, member);
this.lookupTable.put(jsonValue.toLowerCase(), member); // lookup must be case-insensitive
}
String[] aliases = member.aliases();
if (aliases != null) {
for (String alias: aliases) {
this.lookupTable.put(alias, member);
this.lookupTable.put(alias.toLowerCase(), member);
}
}
}
Expand All @@ -79,7 +79,7 @@ public T deserialize(JsonParser parser, JsonpMapper mapper, JsonParser.Event eve
* @throws JsonParsingException if no matching enum was found
*/
public T deserialize(String value, JsonParser parser) {
T result = this.lookupTable.get(value);
T result = this.lookupTable.get(value.toLowerCase());
if (result == null) {
throw new JsonpMappingException("Invalid enum '" + value + "'", parser.getLocation());
}
Expand All @@ -94,7 +94,7 @@ public T deserialize(String value, JsonParser parser) {
* @throws IllegalArgumentException if no matching enum was found
*/
public T parse(String value) {
T result = this.lookupTable.get(value);
T result = this.lookupTable.get(value.toLowerCase());
if (result == null) {
throw new NoSuchElementException("Invalid enum '" + value + "'");
}
Expand Down
Loading