only allow to capture object params - IDEA-188405

This commit is contained in:
Egor Ushakov
2018-03-16 16:17:04 +03:00
parent 07bb850860
commit d05cdd4975
@@ -157,6 +157,7 @@ public class CaptureAgent {
return bytes;
}
catch (Exception e) {
System.out.println("Capture agent: failed to instrument " + className);
e.printStackTrace();
}
}
@@ -485,6 +486,11 @@ public class CaptureAgent {
throw new IllegalStateException(
"Argument with id " + myIdx + " is not available, method " + methodDisplayName + " has only " + argumentTypes.length);
}
int sort = argumentTypes[myIdx].getSort();
if (sort != Type.OBJECT && sort != Type.ARRAY) {
throw new IllegalStateException(
"Argument with id " + myIdx + " in method " + methodDisplayName + " must be an object");
}
for (int i = 0; i < myIdx; i++) {
index += argumentTypes[i].getSize();
}