Skip to content

Commit 1af6f56

Browse files
committed
fix: handle null values in Interval64Binding, IntervalBinding, TimestampBinding, and YsonBinding
1 parent 2ca7139 commit 1af6f56

File tree

4 files changed

+4
-10
lines changed

4 files changed

+4
-10
lines changed

jooq-dialect/src/main/java/tech/ydb/jooq/binding/Interval64Binding.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ private static class IntervalConverter implements Converter<ULong, Duration> {
4444

4545
@Override
4646
public Duration from(ULong databaseObject) {
47-
return Duration.of(databaseObject.longValue(), ChronoUnit.MICROS);
47+
return databaseObject == null ? null : Duration.of(databaseObject.longValue(), ChronoUnit.MICROS);
4848
}
4949

5050
@Override

jooq-dialect/src/main/java/tech/ydb/jooq/binding/IntervalBinding.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,7 @@ public void get(BindingGetResultSetContext<Duration> ctx) throws SQLException {
3939
private static class IntervalConverter implements Converter<YearToSecond, Duration> {
4040
@Override
4141
public Duration from(YearToSecond databaseObject) {
42-
if (databaseObject == null) {
43-
return null;
44-
}
45-
return databaseObject.toDuration();
42+
return databaseObject == null ? null : databaseObject.toDuration();
4643
}
4744

4845
@Override

jooq-dialect/src/main/java/tech/ydb/jooq/binding/TimestampBinding.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,7 @@ public void get(BindingGetResultSetContext<Instant> ctx) throws SQLException {
3939
private static class TimestampConverter implements Converter<LocalDateTime, Instant> {
4040
@Override
4141
public Instant from(LocalDateTime databaseObject) {
42-
if (databaseObject == null) {
43-
return null;
44-
}
45-
return databaseObject.toInstant(ZoneOffset.UTC);
42+
return databaseObject == null ? null : databaseObject.toInstant(ZoneOffset.UTC);
4643
}
4744

4845
@Override

jooq-dialect/src/main/java/tech/ydb/jooq/binding/YsonBinding.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public void get(BindingGetResultSetContext<YSON> ctx) throws SQLException {
3939
private static class YsonConverter implements Converter<Object, YSON> {
4040
@Override
4141
public YSON from(Object databaseObject) {
42-
return (YSON) databaseObject;
42+
return databaseObject == null ? null : (YSON) databaseObject;
4343
}
4444

4545
@Override

0 commit comments

Comments
 (0)