You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by GitBox <gi...@apache.org> on 2019/10/23 16:00:23 UTC
[GitHub] [skywalking] kezhenxu94 commented on a change in pull request
#3695: Add postgresql agent sql query param show
kezhenxu94 commented on a change in pull request #3695: Add postgresql agent sql query param show
URL: https://github.com/apache/skywalking/pull/3695#discussion_r338133302
##########
File path: apm-sniffer/apm-sdk-plugin/jdbc-commons/src/main/java/org/apache/skywalking/apm/plugin/jdbc/define/StatementEnhanceInfos.java
##########
@@ -55,29 +54,14 @@ public String getStatementName() {
}
public void setParameter(int index, final Object parameter) {
- maxIndex = maxIndex > index ? maxIndex : index;
- index--; // start from 1
- if (parameters == null) {
- final int initialSize = Math.max(20, maxIndex);
- parameters = new Object[initialSize];
- Arrays.fill(parameters, null);
- }
- int length = parameters.length;
- if (index >= length) {
- int newSize = Math.max(index + 1, length * 2);
- Object[] newParameters = new Object[newSize];
- System.arraycopy(parameters, 0, newParameters, 0, length);
- Arrays.fill(newParameters, length, newSize, null);
- parameters = newParameters;
+ // start from 1
+ index--;
+ if (index >= 0) {
+ parameters.set(index, parameter);
Review comment:
Wondering whether this works or not, can you simply try the following codes?
```java
import java.util.ArrayList;
import java.util.List;
public class Scratch {
public static void main(String[] args) {
List<Object> parameters = new ArrayList<Object>();
parameters.set(0, "abc");
}
}
```
I remember it would throw
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services