CID-1256277 use StringBuffer in loop