Skip to content

Commit

Permalink
Minor clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
cowtowncoder committed Sep 15, 2015
1 parent 53c7c9d commit ac758c2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ public DateTimeFormatter createParser(DeserializationContext ctxt)
* @return true if TimeZone is specified by caller; false otherwise.
*/
public boolean isTimezoneExplicit() {
return _explicitTimezone;
return _explicitTimezone;
}

/*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,9 @@ public ReadableDateTime deserialize(JsonParser p, DeserializationContext ctxt)
throws IOException
{
JsonToken t = p.getCurrentToken();

DateTimeZone tz = _format.isTimezoneExplicit() ? _format.getTimeZone() : DateTimeZone.forTimeZone(ctxt.getTimeZone());

if (t == JsonToken.VALUE_NUMBER_INT) {
DateTimeZone tz = _format.isTimezoneExplicit() ? _format.getTimeZone() : DateTimeZone.forTimeZone(ctxt.getTimeZone());
return new DateTime(p.getLongValue(), tz);
}
if (t == JsonToken.VALUE_STRING) {
Expand All @@ -64,6 +63,7 @@ public ReadableDateTime deserialize(JsonParser p, DeserializationContext ctxt)
String tzId = (ix2 < ix)
? str.substring(ix+1)
: str.substring(ix+1, ix2);
DateTimeZone tz;
try {
tz = DateTimeZone.forID(tzId);
} catch (IllegalArgumentException e) {
Expand All @@ -85,8 +85,8 @@ public ReadableDateTime deserialize(JsonParser p, DeserializationContext ctxt)
.parseDateTime(str)
.withZone(tz);
}

// Not sure if it should use timezone or not...
// 15-Sep-2015, tatu: impl of 'createParser()' SHOULD handle all timezone/locale setup
return _format.createParser(ctxt).parseDateTime(str);
}
throw ctxt.mappingException(handledType());
Expand Down

0 comments on commit ac758c2

Please sign in to comment.