@Test public void testMultipleStackTraces() { String input = "org.apache.commons.lang3.SerializationException: ClassNotFoundException " + "while reading cloned object data\n" + "\tat org.apache.commons.lang3.SerializationUtils.clone(SerializationUtils.java:99)\n" + "java.lang.ClassNotFoundException: byte\n" + "\tat org.apache.tools.ant.AntClassLoader.findClassInComponents(AntClassLoader.java:1365)\n" + "\tat java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1613)\n"; String first = "org.apache.commons.lang3.SerializationException: ClassNotFoundException " + "while reading cloned object data\n" + "\tat org.apache.commons.lang3.SerializationUtils.clone(SerializationUtils.java:99)\n"; String second = "java.lang.ClassNotFoundException: byte\n" + "\tat org.apache.tools.ant.AntClassLoader.findClassInComponents(AntClassLoader.java:1365)\n" + "\tat java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1613)\n"; List<CrashStackTrace> stackTraces = StackTracesParsing.parseStackTraces(input); assertThat(stackTraces, hasSize(2)); CrashStackTrace firstSt = StackTracesParsing.parseStackTraces(first).get(0); CrashStackTrace secondSt = StackTracesParsing.parseStackTraces(second).get(0); assertThat(stackTraces.get(0), equalTo(firstSt)); assertThat(stackTraces.get(1), equalTo(secondSt)); }
public static List<CrashStackTrace> parseStackTraces(String input){ CharStream text = CharStreams.fromString(input); StackTracesLexer lexer = new StackTracesLexer(text); CommonTokenStream tokens = new CommonTokenStream(lexer); StackTracesParser parser = new StackTracesParser(tokens); StackTracesParser.StackTracesContext tree = parser.stackTraces(); StackTracesCollectorListener listener = new StackTracesCollectorListener(); ParseTreeWalker walker = new ParseTreeWalker(); walker.walk(listener, tree); return listener.getStackTraces(); }
StackTracesParsing { public static List<CrashStackTrace> parseStackTraces(String input){ CharStream text = CharStreams.fromString(input); StackTracesLexer lexer = new StackTracesLexer(text); CommonTokenStream tokens = new CommonTokenStream(lexer); StackTracesParser parser = new StackTracesParser(tokens); StackTracesParser.StackTracesContext tree = parser.stackTraces(); StackTracesCollectorListener listener = new StackTracesCollectorListener(); ParseTreeWalker walker = new ParseTreeWalker(); walker.walk(listener, tree); return listener.getStackTraces(); } }
StackTracesParsing { public static List<CrashStackTrace> parseStackTraces(String input){ CharStream text = CharStreams.fromString(input); StackTracesLexer lexer = new StackTracesLexer(text); CommonTokenStream tokens = new CommonTokenStream(lexer); StackTracesParser parser = new StackTracesParser(tokens); StackTracesParser.StackTracesContext tree = parser.stackTraces(); StackTracesCollectorListener listener = new StackTracesCollectorListener(); ParseTreeWalker walker = new ParseTreeWalker(); walker.walk(listener, tree); return listener.getStackTraces(); }  }
StackTracesParsing { public static List<CrashStackTrace> parseStackTraces(String input){ CharStream text = CharStreams.fromString(input); StackTracesLexer lexer = new StackTracesLexer(text); CommonTokenStream tokens = new CommonTokenStream(lexer); StackTracesParser parser = new StackTracesParser(tokens); StackTracesParser.StackTracesContext tree = parser.stackTraces(); StackTracesCollectorListener listener = new StackTracesCollectorListener(); ParseTreeWalker walker = new ParseTreeWalker(); walker.walk(listener, tree); return listener.getStackTraces(); }  static List<CrashStackTrace> parseStackTraces(String input); }
StackTracesParsing { public static List<CrashStackTrace> parseStackTraces(String input){ CharStream text = CharStreams.fromString(input); StackTracesLexer lexer = new StackTracesLexer(text); CommonTokenStream tokens = new CommonTokenStream(lexer); StackTracesParser parser = new StackTracesParser(tokens); StackTracesParser.StackTracesContext tree = parser.stackTraces(); StackTracesCollectorListener listener = new StackTracesCollectorListener(); ParseTreeWalker walker = new ParseTreeWalker(); walker.walk(listener, tree); return listener.getStackTraces(); }  static List<CrashStackTrace> parseStackTraces(String input);  }