Polishing contribution

Closes gh-30294
This commit is contained in:
rstoyanchev
2023-04-12 15:22:57 +01:00
parent a8f31f5b9e
commit 5f2264816a
3 changed files with 20 additions and 14 deletions

View File

@@ -38,11 +38,11 @@ import org.springframework.util.ObjectUtils;
* additional properties. Subclasses can use the protected copy constructor to
* re-create an existing {@code ProblemDetail} instance as the subclass, e.g.
* from an {@code @ControllerAdvice} such as
* {@link org.springframework.web.servlet.mvc.method.annotation.ResponseEntityExceptionHandler}.
* {@link org.springframework.web.servlet.mvc.method.annotation.ResponseEntityExceptionHandler} or
* {@link org.springframework.web.reactive.result.method.annotation.ResponseEntityExceptionHandler}.
*
* @author Rossen Stoyanchev
* @author Juergen Hoeller
* @author Yanming Zhou
* @since 6.0
* @see <a href="https://datatracker.ietf.org/doc/html/rfc7807">RFC 7807</a>
* @see org.springframework.web.ErrorResponse
@@ -239,8 +239,8 @@ public class ProblemDetail {
if (!(other instanceof ProblemDetail otherDetail)) {
return false;
}
return (this.type.equals(otherDetail.type) &&
ObjectUtils.nullSafeEquals(this.getTitle(), otherDetail.getTitle()) &&
return (getType().equals(otherDetail.getType()) &&
ObjectUtils.nullSafeEquals(getTitle(), otherDetail.getTitle()) &&
this.status == otherDetail.status &&
ObjectUtils.nullSafeEquals(this.detail, otherDetail.detail) &&
ObjectUtils.nullSafeEquals(this.instance, otherDetail.instance) &&
@@ -250,7 +250,7 @@ public class ProblemDetail {
@Override
public int hashCode() {
int result = this.type.hashCode();
result = 31 * result + ObjectUtils.nullSafeHashCode(this.getTitle());
result = 31 * result + ObjectUtils.nullSafeHashCode(getTitle());
result = 31 * result + this.status;
result = 31 * result + ObjectUtils.nullSafeHashCode(this.detail);
result = 31 * result + ObjectUtils.nullSafeHashCode(this.instance);

View File

@@ -102,8 +102,7 @@ public interface ErrorResponse {
/**
* Return a code to use to resolve the problem "title" for this exception
* through a {@link MessageSource}.
* <p>By default this is initialized via
* {@link #getDefaultTitleMessageCode(Class, String)}.
* <p>By default this is initialized via {@link #getDefaultTitleMessageCode(Class)}.
*/
default String getTitleMessageCode() {
return getDefaultTitleMessageCode(getClass());