提交 be3e14bf authored 作者: Thomas Mueller's avatar Thomas Mueller

Improved error message formatting.

上级 6ed6f192
......@@ -705,14 +705,19 @@ public class DataUtils {
}
private static String formatMessage(int errorCode, String message, Object... arguments) {
return MessageFormat.format(message, arguments) + " " + getVersionAndCode(errorCode);
// convert arguments to strings, to avoid locale specific formatting
for (int i = 0; i < arguments.length; i++) {
Object a = arguments[i];
if (!(a instanceof Exception)) {
arguments[i] = a == null ? "null" : a.toString();
}
}
return MessageFormat.format(message, arguments) +
" [" + Constants.VERSION_MAJOR + "." +
Constants.VERSION_MINOR + "." + Constants.BUILD_ID +
"/" + errorCode + "]";
}
private static String getVersionAndCode(int errorCode) {
return "[" + Constants.VERSION_MAJOR + "." +
Constants.VERSION_MINOR + "." + Constants.BUILD_ID + "/" + errorCode + "]";
}
/**
* Get the error code from an exception message.
*
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论