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

Improved error message formatting.

上级 6ed6f192
...@@ -705,12 +705,17 @@ public class DataUtils { ...@@ -705,12 +705,17 @@ public class DataUtils {
} }
private static String formatMessage(int errorCode, String message, Object... arguments) { 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();
} }
}
private static String getVersionAndCode(int errorCode) { return MessageFormat.format(message, arguments) +
return "[" + Constants.VERSION_MAJOR + "." + " [" + Constants.VERSION_MAJOR + "." +
Constants.VERSION_MINOR + "." + Constants.BUILD_ID + "/" + errorCode + "]"; Constants.VERSION_MINOR + "." + Constants.BUILD_ID +
"/" + errorCode + "]";
} }
/** /**
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论