How can i know in which method i am?

I would like to know ( for debugging reasons ) in which Method the execution code is!
Like the printStackTrace() which indicates:
- package
- class
- method
- line
at mypackage.myclass.mymethod4(MyClass.java:40)
at mypackage.myclass.mymethod3(MyClass.java:30)
at mypackage.myclass.mymethod2(MyClass.java:20)
at mypackage.myclass.mymethod1(MyClass.java:10)
at java.lang.Thread.run(Thread.java:484)
Does anybody knows how to do this?
Bye
Emiliano

This will return the calling class.method() of a class.
public static String getCallingClassMethod() {
     try {
          Exception e = new Exception();
          // make a buffer to store the stack trace       
          java.io.ByteArrayOutputStream buffer = new java.io.ByteArrayOutputStream();
          java.io.PrintStream stackInfo = new java.io.PrintStream(buffer);
          e.printStackTrace(stackInfo);
          // create the tokenizer to get each line       
          java.util.StringTokenizer stackInfoParser =
               new java.util.StringTokenizer(buffer.toString(), "\n");
          int n = 4;
          // *nix system only need 4 tokens windows has 2 extra
          if (System.getProperty("os.name").startsWith("Windows"))
               n = 6;
          // loop through all the crap that comes before our calling method
          for (int i = 1; i < n ; i++){
               stackInfoParser.nextToken();
          // get our calling class.method
          String returnString = stackInfoParser.nextToken().trim();
          // get rid of the garbage
          returnString = returnString.substring(returnString.indexOf(" ") + 1,
               returnString.indexOf("("));
          return returnString;
     } catch (Exception e) {
     return "";
}

Similar Messages

  • How can anyone know on which Xi server one is working ...

    Hi Folks,
    How can anyone know on which Xi server one is working i.e..whether it is DEV/TEST/PROD system....where we can find these tech details???
    Waiting for your responses...
    Cheers...
    Ram.

    hey all..
    i guess, i was unclear wit my question..
    i very well understand the transport of objects frm dev to prod..
    what i wanna knw is...,
    if i hav three diff systtems..i.e prod, dev, n quality..
    wit hittin the tcode: scc4, i get to knw the system id, name n short text..
    n now based on the short text, i identify my system details....(i.e it bein prod or dev)
    but if the short text is missin in the tcode mentioned, then do i hav any other method to knw which system is which Xi System? (prod, dev or qua )...
    regards,
    Ram

  • How can I know in which Tables are the fields stored

    Hi,
    In transaction FSE3 Display Financial Version
    Statement Version, if I drilldown in details, I can
    see Item No, Chart of Acc, From Accountm To Account D,
    C.
    when I do a F1 on the fields, I can see that it is a
    structure. How can I know in which Tables are the
    fields store?

    Hi Ankit,
    There are no rules or guidelines for finding the table but i will share some of the tips used generally.........but i am not sure if we can do it for a tree structure..but try anyways....
    Double click on the structure name seen on the F1 pop up window...
    in the structure screen, try to analyse the field which is very important something like a key in that set of fields or do the same for the fields which we feel are more important,then click on the domain for that field....once in the domain..click on the "where used list for the domain" on the top...
    it will display a pop up -> select only "table" and then press "Tick/OK"..A list will be displayed with the data element and table name ..from this we need to find out the right one we need either by going for text of the table or going through each and every one
    It takes time but does the job.....
    Regards
    Byju

  • How can I know from which page a user came??

    Hi.
    There is a way to know what was the previous page in the usrs browsers, but I don't know how.
    Can you help me?
    The problem is:
    I have an error page that writes exception info on the screen:
    StringWriter sw = new StringWriter();
    PrintWriter pw = new PrintWriter(sw);
    exception.printStackTrace(pw);
    String msg = sw.toString();
    It works fine, and usualy in the msg I have all info about the page that the exception ocured in.
    But when it is an SQL exception, I don't know what jsp page made that SQL call.
    So I want to print the path of the page previous to the error page.
    Thanks for Help.
    Vadim.

    Greetings,
    There is a way to know what was the previous page in
    the usrs browsers, but I don't know how.
    Can you help me?Get the HTTP request header 'Referer':
    <a href='<%= request.getHeader( "Referer" ) %>'>Return to main page</a>I hope this helps.
    Thanks for Help.
    Vadim.Regards,
    Tony "Vee Schade" Cook

  • When apps quit, how can i know ViewControler of there

    Hi,
    I have completed one application but how can we store current status of application when apps quit.
    I have tabBar application and i have 4 tab bar item.
    I have 3 view with each tab bar item.
    when my apps quit and that time i was in 3 view so how can i know that which view has apps quit?
    Thanks.

    There's no single way. If your view controllers are different classes, you can key on the class name (\[\[tabBarController.selectedViewController class\] description\]), or you could implement a view controller method that returns a piece of data unique to that view controller. If you don't want to do any of that, you can store a unique integer in each managed view's tag and access it with tabBarController.selectedViewController.view.tag.

  • How can I know which photos are in the library was used in each album I have created before.

    How can I know which photos are in the library was used in each album I have created before?
    I have many photos in the library folder of iPhoto, but actually I don't know which photos were used in my album.
    Is there any method to find this?
    Thanks.

    Album or Book?
    If Album you can find the ones not already used:
    File -> New Smart Album
    Album -> is not -> Any
    Regards
    TD

  • How can I know a class which implements Runnable interface has terminated?

    Hello! I have a class which has implements Runnable interface, while I want to execute some operation when the thread has terminate in multithread enviroment.How can I know the thread has terminated?Does it give out some signal?Cant I just call my operation at the end of the run() method?

    I want to execute some operation when
    the thread has terminate in multithread enviroment....
    Cant I just call my operation at the end
    of the run() method?Sure. Before run() ends, invoke that other operation.
    How
    can I know the thread has terminated?Does it give out
    some signal?Not that I'm aware of, but you can do what you described above, or I believe a different object can call isAlive on the thread.

  • How can I know which model of K9A2VM I have?

    I have a K9A2VM motherboard with an Athlon 64 x2 3600+ AM2 CPU. I would now like to upgrade to an AM3 Phenom II CPU with lots and lots of cores.
    However, I have a problem. I don't know if I have K9A2VM-FD or K9A2VM-FIH and I don't know how to find out. I've opened my box and looked at the card, but it only says K9A2VM. By reading the specs and looking at pictures, I know it has to be one of them, or at least that it is not K9A2VM-F V2 since it only has two RAM slots and I have four of them installed. There are other obvious differences too, which I can easily spot by looking at the picture.
    Now, looking at the CPU support page for -FD and -FIH, they seem to have differences in what CPUs they support:
    -FD at least supports an X6: http://www.msi.com/product/mb/K9A2VM-FD.html#/?div=CPUSupport
    Phenom II X6    Thuban    HDT90ZFBK6DGR    1090T    200    3.20    3M    6M    E0    125    7501v1B.zip
    But the -FIH CPU support page is different: http://www.msi.com/product/mb/K9A2VM-FIH.html#/?div=CPUSupport
    If I can use that processor, I'm really happy. But -FIH doesn't seem to support Phenom II at all. So provided that the information in the CPU support page is correct, it's fairly important to me to know which model I have. But in case nobody knows how I can distinguish between them; if I buy a Phenom II X6 CPU and it turns out that my motherboard doesn't support it; what is the worst thing that can happen? Will I break the CPU or motherboard, or will it simply not work, but the hardware will still be fine?
    Thanks.

    So this is a MS-7501 Version 1.0 card, in addition to being a K9A2VM. The entire web refers to it as "K9A2VM-FD / FHI". One will work, and the other will go up in smoke. And there is no easy way to know which is which. So how can I know? The reason I bought this card was so I could upgrade the CPU at a later time. Now it seems that's not possible, because the available information is so very poor. I've never had to gamble when purchasing hardware from other vendors. Is this common for MSI?

  • How can I know which clients are connected to my network through express and which are connected through extreme?

    I have an airport express extending, through wireless, a network provided by an airport extreme. How can I know which clients are connected to my network through express and which are connected through extreme?
    Here you can see both routers:
    I would expect to some clients connected to the express, other than the extreme. And that's all I see: only the airport extreme appears as client of the airport express.
    Below, one can see the summary of the config for both routers.
    Would somebody explain it?
    Thanks,
    Marcelo
    Message was edited by: Marcelão

    please disregard this answer.
    Message was edited by: Marcelão

  • How can I know which link was clicked in the link list

    Hi everyone
    I'm using list of links in my page to display list of the files in some directory.
    How can I know which link user was clicked. There are some code:
    <%
    String dir = "..//files//";
    File fin = new File(dir);
    File files[]=fin.listFiles();
    for(int i=0;i<files.length;i++)
    File x = files;
    %>
    <%=x.getName()%><br>
    <%
    %>
    Please help

    You need to pass some data on the querystring to the page you are linking to.
    <a href="Main_Work.jsp?file=<%=x.getName()%>"><%=x.getName()%></a><br>
    This will send a parameter called "file" with the value of the file name that the user clicked.
    Now in Main_Work.jsp you can access this data as follows:
    <%
    String s = request.getParameter("file");
    File f = new File("..//files//"+s);
    %>

  • How can i know which version of Smartview is installed on my system ?

    Hi All,
    How can i know which version of Smartview is installed on my system ?

    Do you know what version of Essbase you are running? that could help. You can find that in EAS. Right click on the server name and select edit ptoperties, then look on the environment tab. As a final measure, find the smartview.exe on yout machine right click and select properties. in one of the tabs there might be a version number

  • How can i know which index will be used when executing the query ?

    1 ) I have query in which i have 3-4 tables but there multiple index on one column .
    so how can i know which index will be used when executing the query ?
    2) I have a query which ia taking too much time . how can i know which table is taking too much time ?
    3) Please Provide me some document of EXplain plan ?

    Hi Jimmy,
    Consider the below example
    /* Formatted on 2011/02/04 21:59 (Formatter Plus v4.8.8) */
    CREATE TABLE FIRST AS
    SELECT * FROM all_objects;
    UPDATE FIRST
    SET object_name = 'TEST'
    WHERE owner != 'SCOTT';
    CREATE INDEX idx_first ON FIRST(object_name);
    SELECT *
    FROM FIRST
    WHERE object_name = 'TEST';
    It has not used index
    Execution Plan
    Plan hash value: 2265626682
    | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
    | 0 | SELECT STATEMENT | | 58678 | 7334K| 163 (4)| 00:00:02 |
    |* 1 | TABLE ACCESS FULL| FIRST | 58678 | 7334K| 163 (4)| 00:00:02 |
    /* Formatted on 2011/02/04 21:59 (Formatter Plus v4.8.8) */
    SELECT *
    FROM FIRST
    WHERE object_name = 'emp';
    This has used the index
    Execution Plan
    Plan hash value: 1184810458
    | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
    | 0 | SELECT STATEMENT | | 1 | 128 | 1 (0)| 00:00:01 |
    | 1 | TABLE ACCESS BY INDEX ROWID| FIRST | 1 | 128 | 1 (0)| 00:00:01 |
    |* 2 | INDEX RANGE SCAN | IDX_FIRST | 1 | | 1 (0)| 00:00:01 |
    From this we can come to the conclusion that, whether to use one index or not by oracle
    would also depend on the data which is present in the table. This has to be this way as
    we see in the bind peeking, if oracle sticks to only one plan, say only use the full table
    scan, it would be a performance hit when it searches for the second query ie where object_name
    ='emp';
    2.
    If we have a query like below.
    select * from emp
    where upper(ename) = upper(:p_ename);
    Evenif we have the index on ename column, oracle wouldn't be able to use the index, as there is a function in the predicate column. If you need oracle to use the index, we need to create a function based index as below.
    Create index idx_ename on emp(upper(ename));
    Regards,
    Cool

  • How can I know which screen-group is?

    Hi experts!!
    I don't know how can I know which screen-group is associaciate to the values...for example, how can I associate  this block to a screen-group for after do this?  IF SCREEN-GROUP1 EQ 'DAT'.
    SELECTION-SCREEN BEGIN OF BLOCK B9 WITH FRAME TITLE TEXT-017.
    SELECTION-SCREEN SKIP.
    SELECT-OPTIONS: FECHA FOR P0001-BEGDA MODIF ID DAT.
    SELECTION-SCREEN END OF BLOCK B9.
    Thanks and regards,
    Rebeca

    Hi,
    Check out this code.
    REPORT  Z94406_TEST_123                         .
    TABLES: pa0001,t549a.
    DATA: n(6) TYPE c.
    SELECTION-SCREEN BEGIN OF BLOCK za2 WITH FRAME.
    PARAMETERS:p1  RADIOBUTTON GROUP grp1 user-command a DEFAULT 'X'.
    SELECT-OPTIONS: s_prd1 FOR n NO-EXTENSION modif id G1.
    PARAMETERS:p2  RADIOBUTTON GROUP grp1.
    SELECT-OPTIONS: s_period FOR pa0001-begda NO-EXTENSION modif id G2.
    SELECTION-SCREEN END OF BLOCK za2.
    AT SELECTION-SCREEN OUTPUT.
    if p1 = 'X'.
    LOOP AT SCREEN.
        IF screen-group1 = 'G2' or screen-group1 = 'G2'.
                screen-input = '0'.
          MODIFY SCREEN.
       ENDIF.
      ENDLOOP.
    ELSE.
      IF screen-group1 = 'G2' or screen-group1 = 'G2'.
          screen-input = '1'.
          MODIFY SCREEN.
       ENDIF.
      ENDLOOP.
       ENDIF.
    Regards,
    Syed

  • How can I know about the latest updates / versions which when available for all the CC products, without having to install and check it with the Desktoip Creative Cloud Application ?

    How can I know about the latest updates / versions which when available for all the CC products, without having to install and check it with the Desktoip Creative Cloud Application ?

    Thanks for looking into this Jeff!
    I work with an Inventory module software and is responsible for software detection across several computers. Once an updated version comes up, I update our database with latest software details to get it detected if installed on any machines.
    The problem tracking updates with Desktop Creative Cloud Software are;
    1)We have to have it installed with the CC applications in-order to get the notification of the latest updates and have to check everyday.
    2)Only relates to the latest updates, so in-between we may miss a prior update unknowingly.Hence, the remote machines having those updates may not get  detected with the software version update which would create problem in reporting.
    3)For all CC products, there is no base or previous updates available for installation if we miss one.
    I went through the Adobe Products Update pages [Product updates] which holds good when it comes to Acrobat and Reader software which I follow to track down any newer updates but this is inconsistent when it comes to CC products like in After Effects CC, Dreamweaver CC etc...
    So overall to be very specific, is there any one channel I can follow to get the notifications only for the updates on CC products and then may be I can rely on Desktop Creative Cloud for installation if not available anywhere like in product update pages of Adobe ?
    Regards,
    Subrat

  • How can we know which index is triggered

    hi all ,
    how can we know which index is triggered in perticular select statement ? is that just based on the fields which used in the select statement or can we know from ST05 ?
    thanks,
    ram

    Hi Ram,
    You can go to transaction ST04(if you are authorised)...
    Now select 'Detail analysis menu' button.
    Now select SQL Request button under 'Resource consumption by' section.
    Now in the ' SQL statement pattern by ' field , give the part of the select statement you want to check.
    Now press execute.
    Now select the line item displayed and goto menu option <b>Goto->Explain SQL</b>.
    It will give you the execution plan for the particular SQL statement.
    From here you can get the index values from INDEX RANGE SCAN statement in this output.
    Hope this has been of some help to you...
    Regards,
    SP.

Maybe you are looking for