Changeset 32270

Show
Ignore:
Timestamp:
12.07.2018 18:52:25 (9 days ago)
Author:
ak19
Message:

Adding in a handy utility function to see the call stack by printing out the stacktrace even when there's no exception object

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • main/trunk/gli/src/org/greenstone/gatherer/util/Utility.java

    r31582 r32270  
    9595    } 
    9696 
     97    /**  
     98     * Handy function to display the list of calling functions by 
     99     * printing out the stack trace even when you don't have an exception 
     100     */ 
     101    static public void printStackTrace() { 
     102    // https://stackoverflow.com/questions/1069066/get-current-stack-trace-in-java 
     103    //new Exception().printStackTrace(); 
     104    //StackTraceElement[] el = Thread.currentThread().getStackTrace(); 
     105    System.err.println("\n@@@@ stacktrace:\n" + Arrays.toString(Thread.currentThread().getStackTrace()) + "\n"); 
     106    } 
     107     
    97108    /**  
    98109     * Reads in a text file and returns the contents as a String