Looks like this if statement is the beef. Please avoid changing so much indenting. Using Util.fixEmptyAndTrim here would make the check much more robust.

@skottler