GitHub user sachinbhalekar opened a pull request:
https://github.com/apache/kafka/pull/4225
KAFKA-6218 : Optimize condition in if statement to reduce the number of
comparisons
Changed the condition in **if** statement
**(schema.name() == null || !(schema.name().equals(LOGICAL_NAME)))** which
requires two comparisons in worst case with
**(!LOGICAL_NAME.equals(schema.name()))** which requires single comparison
in all cases and _avoids null pointer exception.

_
### Committer Checklist (excluded from commit message)
- [+ ] Verify design and implementation
- [+ ] Verify test coverage and CI build status
- [+ ] Verify documentation (including upgrade notes)
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/sachinbhalekar/kafka trunk
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/kafka/pull/4225.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #4225
----
commit 0a0058cb680ce319794d26dcabc8c6c4415d2684
Author: sachinbhalekar <[email protected]>
Date: 2017-11-16T02:40:59Z
Merge pull request #2 from apache/trunk
get latest code
commit 2281e2fbab8d0ff65f56414d0bbb1d0cb2a2a9ad
Author: sachinbhalekar <[email protected]>
Date: 2017-11-16T02:49:42Z
Changed the condition in if statement
(schema.name() == null || !(schema.name().equals(LOGICAL_NAME))) which
requires two comparisons in worst case with
(!LOGICAL_NAME.equals(schema.name())) which requires single comparison
in all cases and avoids null pointer exception.
----
---