IsoInstantTypeAdapter: Enable parsing of 'offset' date times in profile response

This commit is contained in:
Jeff Bowen 2022-11-16 19:00:11 -05:00
parent a336f6be89
commit f500cc7ebf
No known key found for this signature in database
GPG Key ID: 2743796118658EBB
1 changed files with 14 additions and 3 deletions

View File

@ -25,10 +25,21 @@ public class IsoInstantTypeAdapter extends TypeAdapter<Instant>{
in.nextNull(); in.nextNull();
return null; return null;
} }
try{ String nextString;
return DateTimeFormatter.ISO_INSTANT.parse(in.nextString(), Instant::from); try {
}catch(DateTimeParseException x){ nextString = in.nextString();
}catch(Exception e){
return null; 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;
} }
} }