Skip to content

Commit 96deb27

Browse files
cw-dimedisrstoyanchev
authored andcommitted
Make type in ProblemDetail nullable
See gh-35294 Signed-off-by: Christoph Wagner <[email protected]> Signed-off-by: Christoph <[email protected]>
1 parent a0542f0 commit 96deb27

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

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

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,8 @@ public class ProblemDetail implements Serializable {
5555

5656
private static final long serialVersionUID = 3307761915842206538L;
5757

58-
private static final URI BLANK_TYPE = URI.create("about:blank");
5958

60-
61-
private URI type = BLANK_TYPE;
59+
private @Nullable URI type;
6260

6361
private @Nullable String title;
6462

@@ -104,17 +102,17 @@ protected ProblemDetail() {
104102

105103
/**
106104
* Setter for the {@link #getType() problem type}.
107-
* <p>By default, this is {@link #BLANK_TYPE}.
105+
* <p>By default, this is not set. According to the spec, when not present, its value is assumed to be "about:blank"
108106
* @param type the problem type
109107
*/
110-
public void setType(URI type) {
108+
public void setType(@Nullable URI type) {
111109
this.type = type;
112110
}
113111

114112
/**
115113
* Return the configured {@link #setType(URI) problem type}.
116114
*/
117-
public URI getType() {
115+
public @Nullable URI getType() {
118116
return this.type;
119117
}
120118

0 commit comments

Comments
 (0)