New issue
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
NullPointerException occurred accidentally #2961
Comments
Hello @timandy , The stack trace looks incomplete. Or, provide a repro project that reproduces the NullPointerException. |
Hi @harawata Thans for your reply. The stack content has not been modified, it has only been translated. # The util for translate stacktrace
public final class ThrowableUtils {
/**
* 获取异常详细信息
*
* @param throwable
* @return
*/
public static String getString(Throwable throwable) {
if (throwable == null)
return StringUtils.EMPTY;
StringBuilder builder = new StringBuilder();
String clazzName = throwable.getClass().getName();
builder.append(clazzName).append(": ");
String message = throwable.getLocalizedMessage();
if (StringUtils.isEmpty(message))
builder.append("引发类型为“").append(clazzName).append("”的异常。");
else
builder.append(message);
Throwable innerThrowable = throwable.getCause();
if (innerThrowable != null)
builder.append(" ---> ").append(getString(innerThrowable)).append(Environment.NewLine).append(" --- 内部异常堆栈跟踪的结尾 ---");
StackTraceElement[] traces = throwable.getStackTrace();
if (traces != null)
for (StackTraceElement trace : traces)
builder.append(Environment.NewLine).append(" 在 ").append(trace);
return builder.toString();
}
/**
* 获取异常简略信息
*
* @param throwable
* @return
*/
public static String getMessage(Throwable throwable) {
if (throwable == null)
return StringUtils.EMPTY;
String message = throwable.getLocalizedMessage();
return StringUtils.isEmpty(message) ? "引发类型为“" + throwable.getClass().getName() + "”的异常。" : message;
}
} |
@timandy , That class basically removes the root causes deeper than the first level, I think. |
@harawata The ThrowableUtils print casuse first, not remove root causes. |
@timandy , Umm.... could you just exclude the class anyway? In that class, |
! |
The bug was in atomikos, see atomikos/transactions-essentials#36 (comment) |
Thank you for the update, @timandy ! |
Hi @harawata, I am not sure this bug is fiexed or not in the latest version of atomikos. |
@timandy , I see. Thanks for the info! |
Occasional errors do not always occur
mybatis version: 3.5.13
mybatis-spring: 2.1.1
mysql-connector-j: 8.1.0
atomikos-util: 4.0.6
The text was updated successfully, but these errors were encountered: