You might want to check if it is not blank, you can use apache commons' StringUtils.isNotBlank(shortedtNameVar)