}
encoded = sb.toString();
} else {
// encoding a single entity
EntityData toEncode = entities.get(0);
if (toEncode == null) {
throw new EntityEncodingException("Failed to encode data for entity (" + ref
+ "), entity object to encode could not be found (null object in list)", ref.toString());
} else {
try {