Remove redundant "else" statement and redundant condition in factory
method.

Change-Id: I4a3bb387e4f63c5aa70519923ad3680c8ae5e5b0