xLog
xLog copied to clipboard
XLog formatArgs method maybe make app crash if format error!
return String.format(format, args); // this not try-catch maybe make app crash if format error!
/**
* Format a string with arguments.
*
* @param format the format string, null if just to concat the arguments
* @param args the arguments
* @return the formatted string
*/
private String formatArgs(String format, Object... args) {
if (format != null) {
return String.format(format, args); // this not try-catch maybe make app crash if format error!
} else {
StringBuilder sb = new StringBuilder();
for (int i = 0, N = args.length; i < N; i++) {
if (i != 0) {
sb.append(", ");
}
sb.append(args[i]);
}
return sb.toString();
}
}
Currently won't fix, you should take care of your format, just as you were calling String.format directly.