Skip to content

Commit 92eb6bc

Browse files
committed
Revert "Update BeanAdapter."
This reverts commit 4876407.
1 parent 4876407 commit 92eb6bc

File tree

3 files changed

+2
-10
lines changed

3 files changed

+2
-10
lines changed

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
subprojects {
1616
group = 'org.httprpc'
17-
version = '4.9.5'
17+
version = '4.9.4'
1818

1919
apply plugin: 'java-library'
2020

kilo-client/src/main/java/org/httprpc/kilo/beans/BeanAdapter.java

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@
3434
import java.time.LocalDateTime;
3535
import java.time.LocalTime;
3636
import java.time.Period;
37-
import java.time.format.DateTimeParseException;
3837
import java.time.temporal.TemporalAccessor;
3938
import java.time.temporal.TemporalAmount;
4039
import java.util.AbstractList;
@@ -1019,13 +1018,7 @@ private static Object toRawType(Object value, Class<?> type) {
10191018
} else if (type == LocalTime.class) {
10201019
return LocalTime.parse(value.toString());
10211020
} else if (type == LocalDateTime.class) {
1022-
var text = value.toString();
1023-
1024-
try {
1025-
return LocalDateTime.parse(text);
1026-
} catch (DateTimeParseException exception) {
1027-
return LocalDateTime.of(LocalDate.parse(text), LocalTime.MIDNIGHT);
1028-
}
1021+
return LocalDateTime.parse(value.toString());
10291022
} else if (type == Duration.class) {
10301023
if (value instanceof Number number) {
10311024
return Duration.ofMillis(number.longValue());

kilo-client/src/test/java/org/httprpc/kilo/beans/BeanAdapterTest.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,6 @@ public void testTemporalAccessorCoercion() {
239239
assertEquals(LocalDate.parse("2018-06-28"), BeanAdapter.coerce("2018-06-28", LocalDate.class));
240240
assertEquals(LocalTime.parse("10:45"), BeanAdapter.coerce("10:45", LocalTime.class));
241241
assertEquals(LocalDateTime.parse("2018-06-28T10:45"), BeanAdapter.coerce("2018-06-28T10:45", LocalDateTime.class));
242-
assertEquals(LocalDateTime.of(LocalDate.of(2018, 6, 28), LocalTime.MIDNIGHT), BeanAdapter.coerce("2018-06-28", LocalDateTime.class));
243242
}
244243

245244
@Test

0 commit comments

Comments
 (0)