Skip to content
Closed
Changes from 1 commit
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
Prev Previous commit
Consistent name
  • Loading branch information
HyukjinKwon committed Oct 3, 2016
commit cb5ece70bc840820697fa73943bc28bd63c96b41
Original file line number Diff line number Diff line change
Expand Up @@ -354,14 +354,14 @@ class JacksonParser(
parser: JsonParser,
dataType: DataType,
nullable: Boolean = true)(f: PartialFunction[JsonToken, Any]): Any = {
val nullParser = makeNullConverter(nullable)
val nullConverter = makeNullConverter(nullable)
parser.getCurrentToken match {
case FIELD_NAME =>
// There are useless FIELD_NAMEs between START_OBJECT and END_OBJECT tokens
parser.nextToken()
parseJsonToken(parser, dataType, nullable)(f)

case null | VALUE_NULL => nullParser.apply(parser)
case null | VALUE_NULL => nullConverter.apply(parser)

case other => f.applyOrElse(other, failedConversion(parser, dataType, nullable))
}
Expand All @@ -375,13 +375,13 @@ class JacksonParser(
parser: JsonParser,
dataType: DataType,
nullable: Boolean): PartialFunction[JsonToken, Any] = {
val nullParser = makeNullConverter(nullable)
val nullConverter = makeNullConverter(nullable)

{
case VALUE_STRING if parser.getTextLength < 1 =>
// If conversion is failed, this produces `null` rather than throwing exception.
// This will protect the mismatch of types.
nullParser.apply(parser)
nullConverter.apply(parser)

case token =>
// We cannot parse this token based on the given data type. So, we throw a
Expand Down