Handled null pointer exceptions in stringUtil.java file