From 50d597eb417b5b7eb9a655a6bd08872d33c11ef8 Mon Sep 17 00:00:00 2001 From: Juergen Hoeller Date: Thu, 2 Sep 2021 22:52:14 +0200 Subject: [PATCH] Avoid unnecessary cause initialization in ResponseStatusException Closes gh-27196 --- .../web/server/ResponseStatusException.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/spring-web/src/main/java/org/springframework/web/server/ResponseStatusException.java b/spring-web/src/main/java/org/springframework/web/server/ResponseStatusException.java index 67c8d78391ea..c72d151f8b11 100644 --- a/spring-web/src/main/java/org/springframework/web/server/ResponseStatusException.java +++ b/spring-web/src/main/java/org/springframework/web/server/ResponseStatusException.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2020 the original author or authors. + * Copyright 2002-2021 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -47,7 +47,7 @@ public class ResponseStatusException extends NestedRuntimeException { * @param status the HTTP status (required) */ public ResponseStatusException(HttpStatus status) { - this(status, null, null); + this(status, null); } /** @@ -57,7 +57,10 @@ public ResponseStatusException(HttpStatus status) { * @param reason the associated reason (optional) */ public ResponseStatusException(HttpStatus status, @Nullable String reason) { - this(status, reason, null); + super(""); + Assert.notNull(status, "HttpStatus is required"); + this.status = status; + this.reason = reason; } /**