#1019 - Avoid exceptions on HAL link title rendering.
HalLinkRelation now implements MessageSourceResolvable.getDefaultMessage() returning an empty String to avoid NoSuchMessageExceptions for every resolution not backed by an actual translation. Tweaked serialization configuration for HalLink to not render empty title strings.
This commit is contained in:
@@ -174,6 +174,16 @@ public class HalLinkRelation implements LinkRelation, MessageSourceResolvable {
|
||||
.toArray(String[]::new);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see org.springframework.context.MessageSourceResolvable#getDefaultMessage()
|
||||
*/
|
||||
@Override
|
||||
@org.springframework.lang.NonNull
|
||||
public String getDefaultMessage() {
|
||||
return "";
|
||||
}
|
||||
|
||||
/**
|
||||
* Simple builder interface to easily create multiple {@link HalLinkRelation}s for a single curie.
|
||||
*
|
||||
|
||||
@@ -965,8 +965,8 @@ public class Jackson2HalModule extends SimpleModule {
|
||||
return link;
|
||||
}
|
||||
|
||||
@JsonInclude(Include.NON_NULL)
|
||||
@Nullable
|
||||
@JsonInclude(Include.NON_EMPTY)
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user