Skip to content

Add an instanceof test in the implementation of equals(Object obj).#298

Closed
Kui-Liu wants to merge 1 commit intoapache:masterfrom
Kui-Liu:trunk
Closed

Add an instanceof test in the implementation of equals(Object obj).#298
Kui-Liu wants to merge 1 commit intoapache:masterfrom
Kui-Liu:trunk

Conversation

@Kui-Liu
Copy link

@Kui-Liu Kui-Liu commented Oct 9, 2017

The equals(Object obj) method shouldn't make any assumptions about the type of obj. It should simply return false if obj is not the same type as this.
http://findbugs.sourceforge.net/bugDescriptions.html#BC_EQUALS_METHOD_SHOULD_WORK_FOR_ALL_OBJECTS

The equals(Object obj) method shouldn't make any assumptions about the type of obj. It should simply return false if obj is not the same type as this.
http://findbugs.sourceforge.net/bugDescriptions.html#BC_EQUALS_METHOD_SHOULD_WORK_FOR_ALL_OBJECTS
@coveralls
Copy link

coveralls commented Oct 9, 2017

Coverage Status

Coverage remained the same at 95.213% when pulling 0ee26c5 on BruceKuiLiu:trunk into 00feb98 on apache:master.

@kinow
Copy link
Member

kinow commented Oct 9, 2017

I think it makes sense. Any chance to include a unit test to protect against regressions in the future? Thanks

EDIT: thanks @PascalSchumacher hadn't seen the comment. Seen to be internal use only, so no need to change it. @brucekuiliu alternatively, we can just ignore that FindBugs error if necessary.

@PascalSchumacher
Copy link
Contributor

The comment above the statement explains why it is done this way.

In case this is merged the comment should be removed.

@Kui-Liu
Copy link
Author

Kui-Liu commented Oct 9, 2017

I am sorry, I cannot provide any test cases. We found it is a potential vulnerability.

@asfgit asfgit closed this in 758228f Oct 27, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants