提交 6a0beab2 authored 作者: Thomas Mueller's avatar Thomas Mueller

SQL statements in the exception message are no longer included if they contain '--hide--'.

上级 da30c87b
...@@ -33,16 +33,19 @@ public class JdbcSQLException extends SQLException { ...@@ -33,16 +33,19 @@ public class JdbcSQLException extends SQLException {
private volatile Object payload; private volatile Object payload;
/** /**
* Creates a SQLException a message, sqlstate and cause. * Creates a SQLException.
* *
* @param message the reason * @param message the reason
* @param sql the SQL statement
* @param state the SQL state * @param state the SQL state
* @param errorCode the error code
* @param cause the exception that was the reason for this exception * @param cause the exception that was the reason for this exception
* @param stackTrace the stack trace
*/ */
public JdbcSQLException(String message, String sql, String state, int errorCode, Throwable cause, String stackTrace) { public JdbcSQLException(String message, String sql, String state, int errorCode, Throwable cause, String stackTrace) {
super(message, state, errorCode); super(message, state, errorCode);
this.originalMessage = message; this.originalMessage = message;
this.sql = sql; setSQL(sql);
this.cause = cause; this.cause = cause;
this.stackTrace = stackTrace; this.stackTrace = stackTrace;
buildMessage(); buildMessage();
...@@ -152,9 +155,10 @@ public class JdbcSQLException extends SQLException { ...@@ -152,9 +155,10 @@ public class JdbcSQLException extends SQLException {
*/ */
public void setSQL(String sql) { public void setSQL(String sql) {
if (sql.indexOf(HIDE_SQL) < 0) { if (sql.indexOf(HIDE_SQL) < 0) {
this.sql = sql; sql = "-";
buildMessage();
} }
this.sql = sql;
buildMessage();
} }
private void buildMessage() { private void buildMessage() {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论