Skip to content

Commit e771a65

Browse files
committed
Update EnumerationDeserializerModule.scala
1 parent bb6f679 commit e771a65

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

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

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

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

0 commit comments

Comments
 (0)