Get stack trace in Java -


how exception stack trace in java? can use thread.currentthread().getstacktrace().but error linenumber

correctly:

java.lang.arithmeticexception: / 0 @ me.edagarli.main.main(main.java:32) 

wrongly:

java.lang.arithmeticexception: / 0 java.lang.thread.getstacktrace(thread.java:1589)     me.edagarli.main.main(main.java:54)  

public string getfullerrordescription(exception exceptionobj ) {     string textmsg = "";      if (exceptionobj != null) {         stacktraceelement[] ste = exceptionobj.getstacktrace();         textmsg += "\nin file : " + ste[index].getclassname() + " ";         textmsg += "\nin method : " + ste[index].getmethodname() + "() ";         textmsg += "\nat line :" + ste[index].getlinenumber() + " ";     }     system.err.println(textmsg);     return textmsg; } 

Comments

Popular posts from this blog

amazon web services - S3 Pre-signed POST validate file type? -

c# - Check Keyboard Input Winforms -