[CONJ-716] correcting possible NPE when logging information
This commit is contained in:
Родитель
0c29431fce
Коммит
612c2fe9c3
|
@ -69,8 +69,8 @@ import org.mariadb.jdbc.internal.util.dao.ServerPrepareResult;
|
||||||
|
|
||||||
public class ProtocolLoggingProxy implements InvocationHandler {
|
public class ProtocolLoggingProxy implements InvocationHandler {
|
||||||
|
|
||||||
private static final NumberFormat numberFormat = DecimalFormat.getInstance();
|
|
||||||
private static final Logger logger = LoggerFactory.getLogger(ProtocolLoggingProxy.class);
|
private static final Logger logger = LoggerFactory.getLogger(ProtocolLoggingProxy.class);
|
||||||
|
private final NumberFormat numberFormat;
|
||||||
private final boolean profileSql;
|
private final boolean profileSql;
|
||||||
private final Long slowQueryThresholdNanos;
|
private final Long slowQueryThresholdNanos;
|
||||||
private final int maxQuerySizeToLog;
|
private final int maxQuerySizeToLog;
|
||||||
|
@ -89,11 +89,11 @@ public class ProtocolLoggingProxy implements InvocationHandler {
|
||||||
this.slowQueryThresholdNanos = options.slowQueryThresholdNanos;
|
this.slowQueryThresholdNanos = options.slowQueryThresholdNanos;
|
||||||
this.maxQuerySizeToLog = options.maxQuerySizeToLog;
|
this.maxQuerySizeToLog = options.maxQuerySizeToLog;
|
||||||
this.logQuery = new LogQueryTool(options);
|
this.logQuery = new LogQueryTool(options);
|
||||||
|
this.numberFormat = DecimalFormat.getInstance();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
|
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
|
||||||
long startTime = System.nanoTime();
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
switch (method.getName()) {
|
switch (method.getName()) {
|
||||||
|
@ -104,6 +104,7 @@ public class ProtocolLoggingProxy implements InvocationHandler {
|
||||||
case "executeBatchClient":
|
case "executeBatchClient":
|
||||||
case "executeBatchServer":
|
case "executeBatchServer":
|
||||||
|
|
||||||
|
final long startTime = System.nanoTime();
|
||||||
Object returnObj = method.invoke(protocol, args);
|
Object returnObj = method.invoke(protocol, args);
|
||||||
if (logger.isInfoEnabled() && (profileSql
|
if (logger.isInfoEnabled() && (profileSql
|
||||||
|| (slowQueryThresholdNanos != null
|
|| (slowQueryThresholdNanos != null
|
||||||
|
|
Загрузка…
Ссылка в новой задаче