Add null-conditional operators on these 3 files (#6007)

* add null conditional operators on these 3 files . To aviod some agent exception of Oracle jdbc.

* Add a line in Java Agent section of CHANGES.md file

Co-authored-by: 吴晟 Wu Sheng <wu.sheng@foxmail.com>
This commit is contained in:
raybi-asus 2020-12-17 12:56:51 +08:00 committed by GitHub
parent 08b31adf60
commit 1297d2e1d2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 14 additions and 7 deletions

View File

@ -13,6 +13,7 @@ Release Notes.
* Fix jdk-http and okhttp-3.x plugin did not overwrite the old trace header.
* Support collecting logs of log4j, log4j2, and logback in the tracing context with a new `logger-plugin`.
* Fix the unexpected RunningContext recreation in the Tomcat plugin.
* Fix the potential NPE when trace_sql_parameters is enabled.
#### OAP-Backend
* Make meter receiver support MAL.

View File

@ -31,8 +31,10 @@ public class JDBCPreparedStatementIgnorableSetterInterceptor implements Instance
public final void beforeMethod(EnhancedInstance objInst, Method method, Object[] allArguments,
Class<?>[] argumentsTypes, MethodInterceptResult result) throws Throwable {
final StatementEnhanceInfos statementEnhanceInfos = (StatementEnhanceInfos) objInst.getSkyWalkingDynamicField();
final int index = (Integer) allArguments[0];
statementEnhanceInfos.setParameter(index, Constants.SQL_PARAMETER_PLACEHOLDER);
if (statementEnhanceInfos != null) {
final int index = (Integer) allArguments[0];
statementEnhanceInfos.setParameter(index, Constants.SQL_PARAMETER_PLACEHOLDER);
}
}
@Override

View File

@ -30,8 +30,10 @@ public class JDBCPreparedStatementNullSetterInterceptor implements InstanceMetho
public final void beforeMethod(EnhancedInstance objInst, Method method, Object[] allArguments,
Class<?>[] argumentsTypes, MethodInterceptResult result) throws Throwable {
final StatementEnhanceInfos statementEnhanceInfos = (StatementEnhanceInfos) objInst.getSkyWalkingDynamicField();
final int index = (Integer) allArguments[0];
statementEnhanceInfos.setParameter(index, "NULL");
if (statementEnhanceInfos != null) {
final int index = (Integer) allArguments[0];
statementEnhanceInfos.setParameter(index, "NULL");
}
}
@Override

View File

@ -30,9 +30,11 @@ public class JDBCPreparedStatementSetterInterceptor implements InstanceMethodsAr
public final void beforeMethod(EnhancedInstance objInst, Method method, Object[] allArguments,
Class<?>[] argumentsTypes, MethodInterceptResult result) throws Throwable {
final StatementEnhanceInfos statementEnhanceInfos = (StatementEnhanceInfos) objInst.getSkyWalkingDynamicField();
final int index = (Integer) allArguments[0];
final Object parameter = allArguments[1];
statementEnhanceInfos.setParameter(index, parameter);
if (statementEnhanceInfos != null) {
final int index = (Integer) allArguments[0];
final Object parameter = allArguments[1];
statementEnhanceInfos.setParameter(index, parameter);
}
}
@Override