Skip the call to String.format when annotating, if there are no values

This commit is contained in:
Ben Gruver 2013-12-12 01:35:29 -08:00
parent fce4cc0c42
commit 029ad25c66

View File

@ -124,7 +124,12 @@ public class AnnotatedBytes {
throw new ExceptionWithContext("Annotating outside the parent bounds");
}
String formattedMsg = String.format(msg, formatArgs);
String formattedMsg;
if (formatArgs != null && formatArgs.length > 0) {
formattedMsg = String.format(msg, formatArgs);
} else {
formattedMsg = msg;
}
int exclusiveEndOffset = cursor + length;
AnnotationEndpoint endPoint = null;