== Compliant Solution [source,text] ---- str = cont.substring(pos1, pos2); if (str.isEmpty()) { //... ----