IsoInstantTypeAdapter: Enable parsing of 'offset' date times in profile response
This commit is contained in:
parent
a336f6be89
commit
f500cc7ebf
|
@ -25,10 +25,21 @@ public class IsoInstantTypeAdapter extends TypeAdapter<Instant>{
|
|||
in.nextNull();
|
||||
return null;
|
||||
}
|
||||
try{
|
||||
return DateTimeFormatter.ISO_INSTANT.parse(in.nextString(), Instant::from);
|
||||
}catch(DateTimeParseException x){
|
||||
String nextString;
|
||||
try {
|
||||
nextString = in.nextString();
|
||||
}catch(Exception e){
|
||||
return null;
|
||||
}
|
||||
|
||||
try{
|
||||
return DateTimeFormatter.ISO_INSTANT.parse(nextString, Instant::from);
|
||||
}catch(DateTimeParseException x){}
|
||||
|
||||
try{
|
||||
return DateTimeFormatter.ISO_OFFSET_DATE_TIME.parse(nextString, Instant::from);
|
||||
}catch(DateTimeParseException x){}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue