#594 - Protect against Spring 5 non-null inputs.

Spring 5 has adopted a "no nulls" policy that causes certain methods to throw exceptions instead of returning a null. This updates Spring HATEOAS to handle it suitably.

Original pull request: #595.
This commit is contained in:
Greg Turnquist
2017-06-07 09:30:26 -05:00
committed by Oliver Gierke
parent 82fb6ef9d2
commit 14a5a79490

View File

@@ -108,7 +108,11 @@ public class AnnotationMappingDiscoverer implements MappingDiscoverer {
private String[] getMappingFrom(Annotation annotation) {
Object value = mappingAttributeName == null ? getValue(annotation) : getValue(annotation, mappingAttributeName);
Object value = null;
if (annotation != null) {
value = mappingAttributeName == null ? getValue(annotation) : getValue(annotation, mappingAttributeName);
}
if (value instanceof String) {
return new String[] { (String) value };