未验证 提交 1297d2e1 编写于 作者: R raybi-asus 提交者: GitHub

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's avatar吴晟 Wu Sheng <wu.sheng@foxmail.com>
上级 08b31adf
......@@ -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.
......
......@@ -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
......
......@@ -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
......
......@@ -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
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册