fixing findbugs warnings: added default for switch an changed redundant
null check with !isEmpty