Skip to content

Commit e484c3c

Browse files
committed
format fix
1 parent 5718eac commit e484c3c

1 file changed

Lines changed: 28 additions & 27 deletions

File tree

lithic-java-core/src/main/kotlin/com/lithic/api/core/ObjectMappers.kt

Lines changed: 28 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -125,33 +125,6 @@ private object InputStreamSerializer : BaseSerializer<InputStream>(InputStream::
125125
}
126126
}
127127

128-
/**
129-
* A deserializer that can deserialize [OffsetDateTime], assuming UTC when a timezone isn't given.
130-
*/
131-
private class LenientOffsetDateTimeDeserializer : StdDeserializer<OffsetDateTime>(OffsetDateTime::class.java) {
132-
override fun logicalType(): LogicalType = LogicalType.DateTime
133-
134-
override fun deserialize(p: JsonParser, context: DeserializationContext?): OffsetDateTime {
135-
val exceptions = mutableListOf<Exception>()
136-
137-
try {
138-
return OffsetDateTime.parse(p.text)
139-
} catch (e: DateTimeException) {
140-
exceptions.add(e)
141-
}
142-
143-
try {
144-
return OffsetDateTime.parse(p.text + 'Z')
145-
} catch (e: DateTimeException) {
146-
exceptions.add(e)
147-
}
148-
149-
throw JsonParseException(p, "Cannot parse `OffsetDateTime` from value: ${p.text}").apply {
150-
exceptions.forEach { addSuppressed(it) }
151-
}
152-
}
153-
}
154-
155128
/**
156129
* A deserializer that can deserialize [LocalDateTime] from datetimes, dates, and zoned datetimes.
157130
*/
@@ -194,3 +167,31 @@ private class LenientLocalDateTimeDeserializer :
194167
}
195168
}
196169
}
170+
171+
/**
172+
* A deserializer that can deserialize [OffsetDateTime], assuming UTC when a timezone isn't given.
173+
*/
174+
private class LenientOffsetDateTimeDeserializer :
175+
StdDeserializer<OffsetDateTime>(OffsetDateTime::class.java) {
176+
override fun logicalType(): LogicalType = LogicalType.DateTime
177+
178+
override fun deserialize(p: JsonParser, context: DeserializationContext?): OffsetDateTime {
179+
val exceptions = mutableListOf<Exception>()
180+
181+
try {
182+
return OffsetDateTime.parse(p.text)
183+
} catch (e: DateTimeException) {
184+
exceptions.add(e)
185+
}
186+
187+
try {
188+
return OffsetDateTime.parse(p.text + 'Z')
189+
} catch (e: DateTimeException) {
190+
exceptions.add(e)
191+
}
192+
193+
throw JsonParseException(p, "Cannot parse `OffsetDateTime` from value: ${p.text}").apply {
194+
exceptions.forEach { addSuppressed(it) }
195+
}
196+
}
197+
}

0 commit comments

Comments
 (0)