Skip to content

Conversation

@ghost
Copy link

@ghost ghost commented Jun 24, 2020

rtn variables in class ErrorPage is always true:

boolean rtn = true;
rtn = rtn && ObjectUtils.nullSafeEquals(getExceptionName(), other.getExceptionName());

so it is reduced the following code:

boolean rtn = true;
rtn = ObjectUtils.nullSafeEquals(getExceptionName(), other.getExceptionName());

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Jun 24, 2020
ErrorPage other = (ErrorPage) obj;
boolean rtn = true;
rtn = rtn && ObjectUtils.nullSafeEquals(getExceptionName(), other.getExceptionName());
rtn = ObjectUtils.nullSafeEquals(getExceptionName(), other.getExceptionName());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the suggestion. Rather than assigning rtn on 117 and then again on line 118, the two could be combined:

boolean rtn = ObjectUtils.nullSafeEquals(getExceptionName(), other.getExceptionName());

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@wilkinsona Thank you for your instruction. I have resubmitted it:
9d2793e

@wilkinsona wilkinsona changed the title condition is always true Simplify logic in ErrorPage's equals method Jun 25, 2020
@mbhave mbhave added type: task A general task and removed status: waiting-for-triage An issue we've not yet triaged labels Jun 30, 2020
@mbhave mbhave added this to the 2.2.x milestone Jun 30, 2020
mbhave pushed a commit that referenced this pull request Jun 30, 2020
@mbhave mbhave closed this in 9c732fa Jun 30, 2020
@mbhave
Copy link
Contributor

mbhave commented Jun 30, 2020

@thenx-wei Thanks for making your first contribution to Spring Boot. This has now been merged into 2.2.x, 2.3.x and master.

@mbhave mbhave modified the milestones: 2.2.x, 2.2.9 Jun 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: task A general task

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants