Partially revert change from StringBuffer to StringBuilder. This patch reverts the aforementioned change to avoid breakages due to changing public APIs. Change-Id: I58c12b77d69d0c56fdf775d4e3871e86ea9731d4