From 96deb272110a28ef48d585a84aea0ecda34fce8d Mon Sep 17 00:00:00 2001 From: Christoph Date: Wed, 6 Aug 2025 14:08:49 +0200 Subject: [PATCH] Make `type` in `ProblemDetail` nullable See gh-35294 Signed-off-by: Christoph Wagner Signed-off-by: Christoph --- .../java/org/springframework/http/ProblemDetail.java | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/spring-web/src/main/java/org/springframework/http/ProblemDetail.java b/spring-web/src/main/java/org/springframework/http/ProblemDetail.java index ed094ebbb86..3c58ba2a593 100644 --- a/spring-web/src/main/java/org/springframework/http/ProblemDetail.java +++ b/spring-web/src/main/java/org/springframework/http/ProblemDetail.java @@ -55,10 +55,8 @@ public class ProblemDetail implements Serializable { private static final long serialVersionUID = 3307761915842206538L; - private static final URI BLANK_TYPE = URI.create("about:blank"); - - private URI type = BLANK_TYPE; + private @Nullable URI type; private @Nullable String title; @@ -104,17 +102,17 @@ public class ProblemDetail implements Serializable { /** * Setter for the {@link #getType() problem type}. - *

By default, this is {@link #BLANK_TYPE}. + *

By default, this is not set. According to the spec, when not present, its value is assumed to be "about:blank" * @param type the problem type */ - public void setType(URI type) { + public void setType(@Nullable URI type) { this.type = type; } /** * Return the configured {@link #setType(URI) problem type}. */ - public URI getType() { + public @Nullable URI getType() { return this.type; }