title: Printing Stack trace element exception
body: <p>The dangerousMethodHandler() prints the stack trace of the error from a StackTraceElement array when an illegal argument exception is caught.  For any other types of exceptions, the dangerousMethodHandler() prints "Exception!"</p>
  
  <p>I currently have sorted out the other exception but can't seem to implement my code using the StackTraceElemen array </p>
  
  <pre><code>public void dangerousMethod() {
      Character.toChars(~0);
  }
  
  public void dangerousMethodHandler() {
          try {
          this.dangerousMethod();
          }catch(IllegalArgumentException e){
  
            StackTraceElement[] trace = e.getStackTrace();
              e.getStackTrace();
              System.err.println(trace[0].toString());
  
         }    catch (Exception e){
              System.out.print("Exception!");
          }
  
      }
  </code></pre>
  
  <p>When I print out the following I get </p>
  
  <pre><code>java.lang.Character.toChars(Character.java:4982)
  </code></pre>
  
  <p>My output should be :</p>
  
  <pre><code>java\.lang\.Character\.toChars\(Character\.java:\d+\)[\s\n]+Main\.dangerousMethod\(Main\.java:\d+\)[\s\n]+Main\.dangerousMethodHandler\(Main\.java:\d+\)[\s\n]+Main\.runTests\(Main\.java:\d+\)[\s\n]+Main\.main\(Main\.java:\d+\)
  </code></pre>