We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
如果参数是Number类型就没法强制转换为String,那么错误信息就没法准确定位了
public static String getSubErrorCode(SubErrorType subErrorType, Object... params) { String subErrorCode = subErrorType.value(); if (params.length > 0) { if (params.length == 1) { subErrorCode = subErrorCode.replace(PARAM_1, (String) params[0]); } else { subErrorCode = subErrorCode.replace(PARAM_1, (String) params[0]); if (params[1] != null) { subErrorCode = subErrorCode.replace(PARAM_2, (String) params[1]); } } } return subErrorCode; }
目前是修改为
public static String getSubErrorCode(SubErrorType subErrorType, Object... params) { String subErrorCode = subErrorType.value(); if (params.length > 0) { String replaceStr=params[0] instanceof Number?String.valueOf(params[0]):(String) params[0]; if (params.length == 1) { subErrorCode = subErrorCode.replace(PARAM_1, replaceStr); } else { subErrorCode = subErrorCode.replace(PARAM_1, replaceStr); if (params[1] != null) { subErrorCode = subErrorCode.replace(PARAM_2, params[0] instanceof Number?String.valueOf(params[1]):(String) params[1]); } } } return subErrorCode; }
The text was updated successfully, but these errors were encountered:
这样不好吧,如果是多少参数呢?在传入参数时自己转一下不是更好吗?
Sorry, something went wrong.
No branches or pull requests
如果参数是Number类型就没法强制转换为String,那么错误信息就没法准确定位了
public static String getSubErrorCode(SubErrorType subErrorType, Object... params) {
String subErrorCode = subErrorType.value();
if (params.length > 0) {
if (params.length == 1) {
subErrorCode = subErrorCode.replace(PARAM_1, (String) params[0]);
} else {
subErrorCode = subErrorCode.replace(PARAM_1, (String) params[0]);
if (params[1] != null) {
subErrorCode = subErrorCode.replace(PARAM_2, (String) params[1]);
}
}
}
return subErrorCode;
}
目前是修改为
public static String getSubErrorCode(SubErrorType subErrorType, Object... params) {
String subErrorCode = subErrorType.value();
if (params.length > 0) {
String replaceStr=params[0] instanceof Number?String.valueOf(params[0]):(String) params[0];
if (params.length == 1) {
subErrorCode = subErrorCode.replace(PARAM_1, replaceStr);
} else {
subErrorCode = subErrorCode.replace(PARAM_1, replaceStr);
if (params[1] != null) {
subErrorCode = subErrorCode.replace(PARAM_2, params[0] instanceof Number?String.valueOf(params[1]):(String) params[1]);
}
}
}
return subErrorCode;
}
The text was updated successfully, but these errors were encountered: