From 1703007127a33a9aee2e2cd7222333a9fc72ce84 Mon Sep 17 00:00:00 2001 From: May Date: Wed, 24 Jun 2020 15:03:14 +0800 Subject: [PATCH 1/2] condition is always true --- .../java/org/springframework/boot/web/server/ErrorPage.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/server/ErrorPage.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/server/ErrorPage.java index 295140588415..c8a2e5efe44e 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/server/ErrorPage.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/server/ErrorPage.java @@ -115,7 +115,7 @@ public boolean equals(Object obj) { if (obj instanceof ErrorPage) { ErrorPage other = (ErrorPage) obj; boolean rtn = true; - rtn = rtn && ObjectUtils.nullSafeEquals(getExceptionName(), other.getExceptionName()); + rtn = ObjectUtils.nullSafeEquals(getExceptionName(), other.getExceptionName()); rtn = rtn && ObjectUtils.nullSafeEquals(this.path, other.path); rtn = rtn && this.status == other.status; return rtn; From 9d2793e6699630af9a5f955cd282be8f2d19765e Mon Sep 17 00:00:00 2001 From: May Date: Wed, 24 Jun 2020 16:22:32 +0800 Subject: [PATCH 2/2] Simplify code: Incorporate Boolean conditions appropriately --- .../java/org/springframework/boot/web/server/ErrorPage.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/server/ErrorPage.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/server/ErrorPage.java index c8a2e5efe44e..00ed358622ad 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/server/ErrorPage.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/server/ErrorPage.java @@ -114,8 +114,7 @@ public boolean equals(Object obj) { } if (obj instanceof ErrorPage) { ErrorPage other = (ErrorPage) obj; - boolean rtn = true; - rtn = ObjectUtils.nullSafeEquals(getExceptionName(), other.getExceptionName()); + boolean rtn = ObjectUtils.nullSafeEquals(getExceptionName(), other.getExceptionName()); rtn = rtn && ObjectUtils.nullSafeEquals(this.path, other.path); rtn = rtn && this.status == other.status; return rtn;