61
61
import org .springframework .util .Assert ;
62
62
import org .springframework .util .ClassUtils ;
63
63
import org .springframework .util .CollectionUtils ;
64
+ import org .springframework .util .ObjectUtils ;
64
65
import org .springframework .util .StringUtils ;
65
66
import org .springframework .util .comparator .NullSafeComparator ;
66
67
@@ -289,22 +290,22 @@ protected Object readProperty(String path, RedisData source, RedisPersistentProp
289
290
if (!source .getBucket ().hasValue (currentPath ) && isByteArray (typeInformation )) {
290
291
291
292
return readCollectionOrArray (currentPath , typeInformation .getType (),
292
- typeInformation .getRequiredComponentType ().getActualType (). getType (), source .getBucket ());
293
+ typeInformation .getRequiredComponentType ().getType (), source .getBucket ());
293
294
}
294
295
} else {
295
296
return readCollectionOrArray (currentPath , typeInformation .getType (),
296
- typeInformation .getRequiredComponentType ().getActualType (). getType (), source .getBucket ());
297
+ typeInformation .getRequiredComponentType ().getType (), source .getBucket ());
297
298
}
298
299
}
299
300
300
301
if (persistentProperty .isEntity ()
301
- && !conversionService .canConvert (byte [].class , typeInformation .getActualType ().getType ())) {
302
+ && !conversionService .canConvert (byte [].class , typeInformation .getRequiredActualType ().getType ())) {
302
303
303
304
Bucket bucket = source .getBucket ().extract (currentPath + "." );
304
305
305
306
RedisData newBucket = new RedisData (bucket );
306
307
TypeInformation <?> typeToRead = typeMapper .readType (bucket .getPropertyPath (currentPath ),
307
- typeInformation . getActualType () );
308
+ typeInformation );
308
309
309
310
return readInternal (currentPath , typeToRead .getType (), newBucket );
310
311
}
@@ -315,8 +316,12 @@ protected Object readProperty(String path, RedisData source, RedisPersistentProp
315
316
return null ;
316
317
}
317
318
318
- if (persistentProperty .isIdProperty () && StringUtils .isEmpty (path .isEmpty ())) {
319
- return sourceBytes == null ? fromBytes (sourceBytes , typeInformation .getActualType ().getType ()) : source .getId ();
319
+ if (persistentProperty .isIdProperty () && ObjectUtils .isEmpty (path .isEmpty ())) {
320
+ return sourceBytes != null ? fromBytes (sourceBytes , typeInformation .getType ()) : source .getId ();
321
+ }
322
+
323
+ if (sourceBytes == null ) {
324
+ return null ;
320
325
}
321
326
322
327
Class <?> typeToUse = getTypeHint (currentPath , source .getBucket (), persistentProperty .getType ());
0 commit comments