Skip to content

Missing a return in BsonUtils.simpleToBsonValue()? #5072

@markusjevringflowers

Description

@markusjevringflowers

I was just debugging some stuff related to timestamps in mongo, and I saw this method: org.springframework.data.mongodb.util.BsonUtils#simpleToBsonValue(java.lang.Object, org.bson.codecs.configuration.CodecRegistry) (in version 4.5.4).
We can see that in this branch, it seems like a return is missing

		if (source instanceof Date date) {
			new BsonDateTime(date.getTime());
		}

It's here: https://github.com/spring-projects/spring-data-mongodb/blob/main/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/util/BsonUtils.java#L396

All the other branches above it return a value.
Is that missing return intentional? If so, why? Should it have a comment saying why it's different?

Or is this a bug or an oversight?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions