Fix a number of potential exceptions in debugger (EA-119717)

This commit is contained in:
Yan Zhulanow
2018-05-24 00:47:08 +03:00
parent 0f15dfdfdc
commit d851c8679a
7 changed files with 78 additions and 31 deletions
+13 -3
View File
@@ -357,7 +357,17 @@ class JDIEval(
}
private fun shouldInvokeMethodWithReflection(method: Method, args: List<com.sun.jdi.Value?>): Boolean {
return !method.isVarArgs && args.zip(method.argumentTypes()).any { isArrayOfInterfaces(it.first?.type(), it.second) }
if (method.isVarArgs) {
return false
}
val argumentTypes = try {
method.argumentTypes()
} catch (e: ClassNotLoadedException) {
return false
}
return args.zip(argumentTypes).any { isArrayOfInterfaces(it.first?.type(), it.second) }
}
private fun isArrayOfInterfaces(valueType: jdi_Type?, expectedType: jdi_Type?): Boolean {
@@ -413,8 +423,8 @@ class JDIEval(
}
private fun mapArguments(arguments: List<Value>, expecetedTypes: List<jdi_Type>): List<jdi_Value?> {
return arguments.zip(expecetedTypes).map {
private fun mapArguments(arguments: List<Value>, expectedTypes: List<jdi_Type>): List<jdi_Value?> {
return arguments.zip(expectedTypes).map {
val (arg, expectedType) = it
arg.asJdiValue(vm, expectedType.asType())
}