В 35-й строке кодом:
if(words == null || words.length == 1 && words[0].equals("")) return line;
выполняется это требование.