DATACMNS-867 - ReflectionEntityInformation getId(Object) considers potential null values.

This commit is contained in:
Christoph Strobl
2017-01-24 08:24:13 +01:00
committed by Oliver Gierke
parent 6e0596694d
commit bab5ddade9
2 changed files with 6 additions and 1 deletions

View File

@@ -76,7 +76,7 @@ public class ReflectionEntityInformation<T, ID extends Serializable> extends Abs
*/
@SuppressWarnings("unchecked")
public Optional<ID> getId(Object entity) {
return entity == null ? null : Optional.of((ID) ReflectionUtils.getField(field, entity));
return entity == null ? null : Optional.ofNullable((ID) ReflectionUtils.getField(field, entity));
}
/*