[java] How to store printStackTrace into a string