Skip to content

Commit ab764a2

Browse files
committed
Update EnumerationDeserializerModule.scala
(cherry picked from commit e771a65)
1 parent 54af22e commit ab764a2

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/main/scala/com/fasterxml/jackson/module/scala/deser/EnumerationDeserializerModule.scala

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,17 @@ private class EnumerationDeserializer(theType:JavaType) extends JsonDeserializer
3333
ctxt.handleUnexpectedToken(theType, jp).asInstanceOf[Enumeration#Value]
3434
} else {
3535
jp.nextToken()
36-
Class.forName(eclassName + "$").getField("MODULE$").get(null).asInstanceOf[Enumeration].withName(valueValue)
36+
Class.forName(eclassName + "$").getField("MODULE$").get(None.orNull).asInstanceOf[Enumeration].withName(valueValue)
3737
}
3838
}
3939
}
4040
}
4141

42-
private def parsePair( jp:JsonParser ) = ({jp.nextToken; jp.getText}, {jp.nextToken; jp.getText})
42+
private def parsePair(jp: JsonParser): (String, String) = (nextToken(jp), nextToken(jp))
43+
private def nextToken(jp: JsonParser): String = {
44+
jp.nextToken
45+
jp.getText
46+
}
4347
}
4448

4549
private class AnnotatedEnumerationDeserializer(r: EnumResolver) extends JsonDeserializer[Enumeration#Value] with ContextualEnumerationDeserializer {

0 commit comments

Comments
 (0)