Just a quick hacked-together test: public class test { public static void main(String[] args) { m1(); } private static void m1() { m2(); } private static void m2() { Throwable t = new Throwable(); t.fillInStackTrace(); StackTraceElement[] ste = t.getStackTrace(); for (int i = 0; i < ste.length; i++) { System.out.println(i + " - " + ste[i]); } } }
I think that will do the trick. -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com AIM: fzammetti Yahoo: fzammetti MSN: [EMAIL PROTECTED] On Thu, February 16, 2006 3:37 pm, Frank W. Zammetti said: > Hey yeah, I think your right! It *still* may be a little heavy, but one > would definitely think less so. Off to play for a few minutes... > > -- > Frank W. Zammetti > Founder and Chief Software Architect > Omnytex Technologies > http://www.omnytex.com > AIM: fzammetti > Yahoo: fzammetti > MSN: [EMAIL PROTECTED] > > On Thu, February 16, 2006 3:29 pm, [EMAIL PROTECTED] said: >> Michael Jouravlev replied >>> On 2/16/06, Frank W. Zammetti <[EMAIL PROTECTED]> wrote: >>> > In the method you want to "protect", immediately throw an exception >>> > and catch it. Then, parse the stack trace and see who the >>> caller was. >>> > If it's not a class you want to have access to the method, throw an >>> > IllegalAccessException. >>> >>> I guess it can be costly if the callers are mostly the ones >>> that you want to allow access to. On the other hand, I don't >>> know the metrics on how costly is to create and throw an exception. >> >> I don't think you'd have to throw and catch it. I think it's sufficient >> to create an instance of Throwable to check the stack trace. >> >> - George >> http://www.idiacomputing.com >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: [EMAIL PROTECTED] >> For additional commands, e-mail: [EMAIL PROTECTED] >> >> > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]