Skip to content

Fix method usage in MappingRedisConverter.java #2446

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@
import org.springframework.util.Assert;
import org.springframework.util.ClassUtils;
import org.springframework.util.CollectionUtils;
import org.springframework.util.ObjectUtils;
import org.springframework.util.StringUtils;
import org.springframework.util.comparator.NullSafeComparator;

Expand Down Expand Up @@ -109,6 +108,7 @@
* @author Greg Turnquist
* @author Mark Paluch
* @author Golam Mazid Sajib
* @author Zhixuan Wu
* @since 1.7
*/
public class MappingRedisConverter implements RedisConverter, InitializingBean {
Expand Down Expand Up @@ -317,7 +317,7 @@ protected Object readProperty(String path, RedisData source, RedisPersistentProp
return null;
}

if (persistentProperty.isIdProperty() && ObjectUtils.isEmpty(path.isEmpty())) {
if (persistentProperty.isIdProperty() && !StringUtils.hasText(path.isEmpty())) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is still wrong as we want to check whether path is empty, not whether isEmpty returns an empty result.

return sourceBytes != null ? fromBytes(sourceBytes, typeInformation.getType()) : source.getId();
}

Expand Down