Skip to content

Commit 4b6fc55

Browse files
committed
JDBC: Make MessageRowMapper as non-nullable
Even if `ResultSet.getBytes()` contract says that value might be null, that is not waht is possible according to the message stores logic. The vale for serialized `MESSAGE_BYTES` is never null.
1 parent a7f930d commit 4b6fc55

File tree

1 file changed

+2
-7
lines changed
  • spring-integration-jdbc/src/main/java/org/springframework/integration/jdbc/store/channel

1 file changed

+2
-7
lines changed

spring-integration-jdbc/src/main/java/org/springframework/integration/jdbc/store/channel/MessageRowMapper.java

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
import java.sql.ResultSet;
2020
import java.sql.SQLException;
21+
import java.util.Objects;
2122

2223
import org.springframework.integration.support.converter.AllowListDeserializingConverter;
2324
import org.springframework.jdbc.core.RowMapper;
@@ -51,15 +52,9 @@ public MessageRowMapper(AllowListDeserializingConverter deserializer) {
5152
}
5253

5354
@Override
54-
@SuppressWarnings("NullAway") // See https://github.com/uber/NullAway/issues/1075
5555
public Message<?> mapRow(ResultSet rs, int rowNum) throws SQLException {
5656
byte[] blobAsBytes = rs.getBytes("MESSAGE_BYTES");
57-
if (blobAsBytes == null) {
58-
return null;
59-
}
60-
else {
61-
return (Message<?>) this.deserializer.convert(blobAsBytes);
62-
}
57+
return (Message<?>) this.deserializer.convert(Objects.requireNonNull(blobAsBytes));
6358
}
6459

6560
}

0 commit comments

Comments
 (0)