예제 #1
0
 private static ArrayReference mirrorOf(
     byte[] bytes, EvaluationContext context, DebugProcess process)
     throws EvaluateException, InvalidTypeException, ClassNotLoadedException {
   ArrayType arrayClass =
       (ArrayType) process.findClass(context, "byte[]", context.getClassLoader());
   ArrayReference reference = process.newInstance(arrayClass, bytes.length);
   keep(reference, context);
   for (int i = 0; i < bytes.length; i++) {
     reference.setValue(
         i, ((VirtualMachineProxyImpl) process.getVirtualMachineProxy()).mirrorOf(bytes[i]));
   }
   return reference;
 }
예제 #2
0
 private static ArrayReference createURLArray(EvaluationContext context)
     throws EvaluateException, InvocationException, InvalidTypeException, ClassNotLoadedException,
         IncompatibleThreadStateException {
   DebugProcess process = context.getDebugProcess();
   ArrayType arrayType =
       (ArrayType) process.findClass(context, "java.net.URL[]", context.getClassLoader());
   ArrayReference arrayRef = arrayType.newInstance(1);
   keep(arrayRef, context);
   ClassType classType =
       (ClassType) process.findClass(context, "java.net.URL", context.getClassLoader());
   VirtualMachineProxyImpl proxy = (VirtualMachineProxyImpl) process.getVirtualMachineProxy();
   StringReference url = proxy.mirrorOf("file:a");
   keep(url, context);
   ObjectReference reference =
       process.newInstance(
           context,
           classType,
           classType.concreteMethodByName("<init>", "(Ljava/lang/String;)V"),
           Collections.singletonList(url));
   keep(reference, context);
   arrayRef.setValues(Collections.singletonList(reference));
   return arrayRef;
 }