Details
-
Enhancement
-
Resolution: Unresolved
-
Minor
-
None
-
None
Description
RFC
Currently `AbstractSourceInfoStructMaker#commonStruct(T sourceInfo)` and other places handle `io.debezium.connector.AbstractSourceInfo` returned null values from the outside.
(e.g. `final Instant timestamp = sourceInfo.timestamp() == null ? Instant.now() : sourceInfo.timestamp();`)
Instead we could move that null checks into `AbstractSourceInfo`.
For that we can make the current abstract methods having a default implementation on that interface that handles null safety, and let the implementations of the interface implement "internal" getters that don't require null-safety.
Furthermore AbstractSourceInfoStructMaker#commonStruct(T sourceInfo) gets `T extends AbstractSourceInfo` as method parameter. The method only reads the timestamp(), database() and snapshot() info from the passed `sourceInfo` variable. Passing it that way was causing NPE sometimes because of the fore-mentioned not being null-safe.
Instead of passing `T extends AbstractSourceInfo` here, we could change the signature to only accept the three variable parameters (timestamp, database, snapshot) which might bring more null safety.