#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:
Oliver Drotbohm
2019-07-15 22:39:10 +02:00
parent 4c434aab2b
commit ff6380063c
3 changed files with 32 additions and 1 deletions

View File

@@ -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.
*

View File

@@ -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;
}