@Test public void testSerialize() throws Exception { String serialization = StackTraceSerializer.serialize(new IOException("Test message")); assertTrue(serialization.startsWith("java.io.IOException: Test message\n" + "\tat "+StackTraceSerializerTest.class.getName()+".")); }
public static String serialize(Throwable t) { ByteArrayOutputStream buff = new ByteArrayOutputStream(); PrintStream ps = new PrintStream(buff); t.printStackTrace(ps); try { return buff.toString("UTF-8"); } catch (UnsupportedEncodingException e) { throw new RuntimeException(e); } }
StackTraceSerializer { public static String serialize(Throwable t) { ByteArrayOutputStream buff = new ByteArrayOutputStream(); PrintStream ps = new PrintStream(buff); t.printStackTrace(ps); try { return buff.toString("UTF-8"); } catch (UnsupportedEncodingException e) { throw new RuntimeException(e); } } }
StackTraceSerializer { public static String serialize(Throwable t) { ByteArrayOutputStream buff = new ByteArrayOutputStream(); PrintStream ps = new PrintStream(buff); t.printStackTrace(ps); try { return buff.toString("UTF-8"); } catch (UnsupportedEncodingException e) { throw new RuntimeException(e); } }  }
StackTraceSerializer { public static String serialize(Throwable t) { ByteArrayOutputStream buff = new ByteArrayOutputStream(); PrintStream ps = new PrintStream(buff); t.printStackTrace(ps); try { return buff.toString("UTF-8"); } catch (UnsupportedEncodingException e) { throw new RuntimeException(e); } }  static String serialize(Throwable t); }
StackTraceSerializer { public static String serialize(Throwable t) { ByteArrayOutputStream buff = new ByteArrayOutputStream(); PrintStream ps = new PrintStream(buff); t.printStackTrace(ps); try { return buff.toString("UTF-8"); } catch (UnsupportedEncodingException e) { throw new RuntimeException(e); } }  static String serialize(Throwable t);  }