This discussion is archived
1 Reply Latest reply: Aug 27, 2012 12:23 PM by 822292 RSS

Creating a method breakpoint on javax.crypto.Cipher

822292 Newbie
Currently Being Moderated
Typically when creating a method breakpoint, I would iterate through all classes returned by VirtualMachine.allClasses(), find the one I want, then iterate through the methods, find the one I want, and finally create the breakpoint with EventRequestManager.createBreakpointRequest(Method.location()). When attempting to do this on javax.crypto.Cipher, the class is not shown in the list of VirtalMachine.allClasses() and in turn I cannot create the breakpoint. My questions:

- Is it possible to create a breakpoint by just knowing the class name and method name? Or obtain a Method or Location object by just knowing the method name? For example: javax.crypto.Cipher.doFinal().
- Is there a reason why the Cipher class is not showing up in the VirtalMachine.allClasses() method? I am debugging a simple app I wrote that just does AES encryption/decryption on a string - so I know it uses that class.

Thanks.
  • 1. Re: Creating a method breakpoint on javax.crypto.Cipher
    822292 Newbie
    Currently Being Moderated
    What I ended up doing is:


    EventRequestManager mgr = vm.eventRequestManager();
    MethodExitRequest req = mgr.createMethodExitRequest();
    req.addClassFilter("javax.crypto.Cipher");
    req.enable();


    Then when the breakpoint hit, ended up doing an 'if' on the method string. I am sure there is an easier/faster way, because now all methods get breaked upon, however that is all I could find based on documentation.

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points