Skip to content

Commit 91f2c25

Browse files
committed
Make type in ProblemDetail nullable
Signed-off-by: Christoph Wagner <[email protected]> Signed-off-by: Christoph <[email protected]>
1 parent 4ad9396 commit 91f2c25

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

spring-web/src/main/java/org/springframework/http/ProblemDetail.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -107,15 +107,14 @@ protected ProblemDetail() {
107107
* <p>By default, this is {@link #BLANK_TYPE}.
108108
* @param type the problem type
109109
*/
110-
public void setType(URI type) {
111-
Assert.notNull(type, "'type' is required");
110+
public void setType(@Nullable URI type) {
112111
this.type = type;
113112
}
114113

115114
/**
116115
* Return the configured {@link #setType(URI) problem type}.
117116
*/
118-
public URI getType() {
117+
public @Nullable URI getType() {
119118
return this.type;
120119
}
121120

@@ -245,7 +244,7 @@ public void setProperties(@Nullable Map<String, Object> properties) {
245244
@Override
246245
public boolean equals(@Nullable Object other) {
247246
return (this == other || (other instanceof ProblemDetail that &&
248-
getType().equals(that.getType()) &&
247+
ObjectUtils.nullSafeEquals(getType(), that.getType()) &&
249248
ObjectUtils.nullSafeEquals(getTitle(), that.getTitle()) &&
250249
this.status == that.status &&
251250
ObjectUtils.nullSafeEquals(this.detail, that.detail) &&

0 commit comments

Comments
 (0)