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

Change-Id: Idf4802f8735a2333d927f5c6989e124c048e7854