test_class.declarator: FACTORY = new ThreadDumpFactory().failOnErrors(true)
test_class.modifier: private static final
test_class.original_string: private static final ThreadDumpFactory FACTORY = new ThreadDumpFactory().failOnErrors(true);
test_class.type: ThreadDumpFactory
test_class.var_name: FACTORY
test_class.declarator: cleaner = new DisposeRule()
test_class.modifier: public @Rule
test_class.original_string: public @Rule DisposeRule cleaner = new DisposeRule();
test_class.type: DisposeRule
test_class.var_name: cleaner
test_class.declarator: syntheticId = 42
test_class.modifier: private static volatile
test_class.original_string: private static volatile int syntheticId = 42;
test_class.type: int
test_class.var_name: syntheticId
test_class.file: core/src/test/java/com/github/olivergondza/dumpling/factory/ThreadDumpFactoryTest.java
test_class.identifier: ThreadDumpFactoryTest
test_case.body: @Test
      public void failToParseWhatIsNotAThreaddump() throws IOException, URISyntaxException {
          try {
              runtimeFrom("unknown-chunks.log");
              fail();
          } catch (IllegalRuntimeStateException e) {
              assertThat(e.getMessage(), startsWith("Skipping unrecognized chunk: "));
          }
  
          try {
              runtimeFrom("no-threads.log");
              fail();
          } catch (IllegalRuntimeStateException e) {
              assertThat(e.getMessage(), startsWith("No threads found in threaddump"));
          }
  
          try {
              runtimeFrom("broken-synchronizers.log");
              fail();
          } catch (IllegalRuntimeStateException e) {
              assertThat(e.getMessage(), startsWith("Unable to parse ownable synchronizer: "));
          }
  
          // Should work if we ignore failures
          new ThreadDumpFactory().fromStream(Util.resource(getClass(), "unknown-chunks.log"));
      }
test_case.class_method_signature: ThreadDumpFactoryTest.failToParseWhatIsNotAThreaddump()
test_case.full_signature: @Test public void failToParseWhatIsNotAThreaddump()
test_case.identifier: failToParseWhatIsNotAThreaddump
test_case.invocations: runtimeFrom fail assertThat getMessage startsWith runtimeFrom fail assertThat getMessage startsWith runtimeFrom fail assertThat getMessage startsWith fromStream resource getClass
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void failToParseWhatIsNotAThreaddump()
focal_class.declarator: LOG = Logger.getLogger(ThreadDumpFactory.class.getName())
focal_class.modifier: private static final
focal_class.original_string: private static final Logger LOG = Logger.getLogger(ThreadDumpFactory.class.getName());
focal_class.type: Logger
focal_class.var_name: LOG
focal_class.declarator: WAIT_TRACE_ELEMENT = StackTrace.nativeElement("java.lang.Object", "wait")
focal_class.modifier: private static final
focal_class.original_string: private static final StackTraceElement WAIT_TRACE_ELEMENT = StackTrace.nativeElement("java.lang.Object", "wait");
focal_class.type: StackTraceElement
focal_class.var_name: WAIT_TRACE_ELEMENT
focal_class.declarator: NL = "(?:\\r\\n|\\n)"
focal_class.modifier: private static final
focal_class.original_string: private static final String NL = "(?:\\r\\n|\\n)";
focal_class.type: String
focal_class.var_name: NL
focal_class.declarator: LOCK_SUBPATTERN = "<(?:0x)?(\\w+)> \\(a ([^\\)]+)\\)"
focal_class.modifier: private static final
focal_class.original_string: private static final String LOCK_SUBPATTERN = "<(?:0x)?(\\w+)> \\(a ([^\\)]+)\\)";
focal_class.type: String
focal_class.var_name: LOCK_SUBPATTERN
focal_class.declarator: THREAD_DELIMITER = Pattern.compile(NL + "(?:" + NL + "(?!\\s)|(?=\"))")
focal_class.modifier: private static final
focal_class.original_string: private static final Pattern THREAD_DELIMITER = Pattern.compile(NL + "(?:" + NL + "(?!\\s)|(?=\"))");
focal_class.type: Pattern
focal_class.var_name: THREAD_DELIMITER
focal_class.declarator: STACK_TRACE_ELEMENT_LINE = Pattern.compile(" *at (\\S+)\\.(\\S+)\\((?:.+/)?([^:]+?)(\\:\\d+)?\\)")
focal_class.modifier: private static final
focal_class.original_string: private static final Pattern STACK_TRACE_ELEMENT_LINE = Pattern.compile(" *at (\\S+)\\.(\\S+)\\((?:.+/)?([^:]+?)(\\:\\d+)?\\)");
focal_class.type: Pattern
focal_class.var_name: STACK_TRACE_ELEMENT_LINE
focal_class.declarator: ACQUIRED_LINE = Pattern.compile("- locked " + LOCK_SUBPATTERN)
focal_class.modifier: private static final
focal_class.original_string: private static final Pattern ACQUIRED_LINE = Pattern.compile("- locked " + LOCK_SUBPATTERN);
focal_class.type: Pattern
focal_class.var_name: ACQUIRED_LINE
focal_class.declarator: WAITING_ON_LINE = Pattern.compile("- (?:waiting on|parking to wait for ?) " + LOCK_SUBPATTERN)
focal_class.modifier: private static final
focal_class.original_string: private static final Pattern WAITING_ON_LINE = Pattern.compile("- (?:waiting on|parking to wait for ?) " + LOCK_SUBPATTERN);
focal_class.type: Pattern
focal_class.var_name: WAITING_ON_LINE
focal_class.declarator: WAITING_TO_LOCK_LINE = Pattern.compile("- waiting to lock " + LOCK_SUBPATTERN)
focal_class.modifier: private static final
focal_class.original_string: private static final Pattern WAITING_TO_LOCK_LINE = Pattern.compile("- waiting to lock " + LOCK_SUBPATTERN);
focal_class.type: Pattern
focal_class.var_name: WAITING_TO_LOCK_LINE
focal_class.declarator: OWNABLE_SYNCHRONIZER_LINE = Pattern.compile("- " + LOCK_SUBPATTERN)
focal_class.modifier: private static final
focal_class.original_string: private static final Pattern OWNABLE_SYNCHRONIZER_LINE = Pattern.compile("- " + LOCK_SUBPATTERN);
focal_class.type: Pattern
focal_class.var_name: OWNABLE_SYNCHRONIZER_LINE
focal_class.declarator: THREAD_HEADER = Pattern.compile(
              "^\"(.*)\" ([^\\n\\r]+)(?:" + NL + "\\s+java.lang.Thread.State: ([^\\n\\r]+)(?:" + NL + "(.+))?)?",
              Pattern.DOTALL
      )
focal_class.modifier: private static final
focal_class.original_string: private static final Pattern THREAD_HEADER = Pattern.compile(
              "^\"(.*)\" ([^\\n\\r]+)(?:" + NL + "\\s+java.lang.Thread.State: ([^\\n\\r]+)(?:" + NL + "(.+))?)?",
              Pattern.DOTALL
      );
focal_class.type: Pattern
focal_class.var_name: THREAD_HEADER
focal_class.declarator: failOnErrors = false
focal_class.modifier: private
focal_class.original_string: private boolean failOnErrors = false;
focal_class.type: boolean
focal_class.var_name: failOnErrors
focal_class.declarator: traceElementCache = new WeakHashMap<String, StackTraceElement>()
focal_class.modifier: private static final
focal_class.original_string: private static final WeakHashMap<String, StackTraceElement> traceElementCache = new WeakHashMap<String, StackTraceElement>();
focal_class.type: WeakHashMap<String, StackTraceElement>
focal_class.var_name: traceElementCache
focal_class.file: core/src/main/java/com/github/olivergondza/dumpling/factory/ThreadDumpFactory.java
focal_class.identifier: ThreadDumpFactory
focal_class.class_method_signature: ThreadDumpFactory.failOnErrors(boolean failOnErrors)
focal_class.full_signature: public ThreadDumpFactory failOnErrors(boolean failOnErrors)
focal_class.identifier: failOnErrors
focal_class.modifiers: public
focal_class.parameters: (boolean failOnErrors)
focal_class.return: ThreadDumpFactory
focal_class.signature: ThreadDumpFactory failOnErrors(boolean failOnErrors)
focal_class.class_method_signature: ThreadDumpFactory.fromFile(@Nonnull File threadDump)
focal_class.full_signature: public @Nonnull ThreadDumpRuntime fromFile(@Nonnull File threadDump)
focal_class.identifier: fromFile
focal_class.modifiers: public @Nonnull
focal_class.parameters: (@Nonnull File threadDump)
focal_class.return: ThreadDumpRuntime
focal_class.signature: ThreadDumpRuntime fromFile(@Nonnull File threadDump)
focal_class.class_method_signature: ThreadDumpFactory.fromStream(@Nonnull InputStream stream)
focal_class.full_signature: public @Nonnull ThreadDumpRuntime fromStream(@Nonnull InputStream stream)
focal_class.identifier: fromStream
focal_class.modifiers: public @Nonnull
focal_class.parameters: (@Nonnull InputStream stream)
focal_class.return: ThreadDumpRuntime
focal_class.signature: ThreadDumpRuntime fromStream(@Nonnull InputStream stream)
focal_class.class_method_signature: ThreadDumpFactory.fromString(@Nonnull String runtime)
focal_class.full_signature: public @Nonnull ThreadDumpRuntime fromString(@Nonnull String runtime)
focal_class.identifier: fromString
focal_class.modifiers: public @Nonnull
focal_class.parameters: (@Nonnull String runtime)
focal_class.return: ThreadDumpRuntime
focal_class.signature: ThreadDumpRuntime fromString(@Nonnull String runtime)
focal_class.class_method_signature: ThreadDumpFactory.thread(String singleThread)
focal_class.full_signature: private ThreadDumpThread.Builder thread(String singleThread)
focal_class.identifier: thread
focal_class.modifiers: private
focal_class.parameters: (String singleThread)
focal_class.return: ThreadDumpThread.Builder
focal_class.signature: ThreadDumpThread.Builder thread(String singleThread)
focal_class.class_method_signature: ThreadDumpFactory.initStacktrace(Builder builder, String trace, String wholeThread)
focal_class.full_signature: private Builder initStacktrace(Builder builder, String trace, String wholeThread)
focal_class.identifier: initStacktrace
focal_class.modifiers: private
focal_class.parameters: (Builder builder, String trace, String wholeThread)
focal_class.return: Builder
focal_class.signature: Builder initStacktrace(Builder builder, String trace, String wholeThread)
focal_class.class_method_signature: ThreadDumpFactory.getMonitorJustAcquired(List<ThreadLock.Monitor> monitors)
focal_class.full_signature: private Monitor getMonitorJustAcquired(List<ThreadLock.Monitor> monitors)
focal_class.identifier: getMonitorJustAcquired
focal_class.modifiers: private
focal_class.parameters: (List<ThreadLock.Monitor> monitors)
focal_class.return: Monitor
focal_class.signature: Monitor getMonitorJustAcquired(List<ThreadLock.Monitor> monitors)
focal_class.class_method_signature: ThreadDumpFactory.traceElement(String line)
focal_class.full_signature: private StackTraceElement traceElement(String line)
focal_class.identifier: traceElement
focal_class.modifiers: private
focal_class.parameters: (String line)
focal_class.return: StackTraceElement
focal_class.signature: StackTraceElement traceElement(String line)
focal_class.class_method_signature: ThreadDumpFactory.filterMonitors(List<ThreadLock.Monitor> monitors, ThreadLock lock)
focal_class.full_signature: private void filterMonitors(List<ThreadLock.Monitor> monitors, ThreadLock lock)
focal_class.identifier: filterMonitors
focal_class.modifiers: private
focal_class.parameters: (List<ThreadLock.Monitor> monitors, ThreadLock lock)
focal_class.return: void
focal_class.signature: void filterMonitors(List<ThreadLock.Monitor> monitors, ThreadLock lock)
focal_class.class_method_signature: ThreadDumpFactory.createLock(Matcher matcher)
focal_class.full_signature: private @Nonnull ThreadLock createLock(Matcher matcher)
focal_class.identifier: createLock
focal_class.modifiers: private @Nonnull
focal_class.parameters: (Matcher matcher)
focal_class.return: ThreadLock
focal_class.signature: ThreadLock createLock(Matcher matcher)
focal_class.class_method_signature: ThreadDumpFactory.initHeader(ThreadDumpThread.Builder builder, String attrs)
focal_class.full_signature: private void initHeader(ThreadDumpThread.Builder builder, String attrs)
focal_class.identifier: initHeader
focal_class.modifiers: private
focal_class.parameters: (ThreadDumpThread.Builder builder, String attrs)
focal_class.return: void
focal_class.signature: void initHeader(ThreadDumpThread.Builder builder, String attrs)
focal_class.class_method_signature: ThreadDumpFactory.parseNid(String value)
focal_class.full_signature: private long parseNid(String value)
focal_class.identifier: parseNid
focal_class.modifiers: private
focal_class.parameters: (String value)
focal_class.return: long
focal_class.signature: long parseNid(String value)
focal_class.class_method_signature: ThreadDumpFactory.parseLong(String value)
focal_class.full_signature: static long parseLong(String value)
focal_class.identifier: parseLong
focal_class.modifiers: static
focal_class.parameters: (String value)
focal_class.return: long
focal_class.signature: long parseLong(String value)
focal_method.body: public @Nonnull ThreadDumpRuntime fromStream(@Nonnull InputStream stream) {
          Set<ThreadDumpThread.Builder> threads = new LinkedHashSet<ThreadDumpThread.Builder>();
          List<String> header = new ArrayList<String>();
  
          Scanner scanner = new Scanner(stream);
          scanner.useDelimiter(THREAD_DELIMITER);
          try {
              while (scanner.hasNext()) {
                  String singleChunk = scanner.next();
                  // Java until 8 vs. Java after 9
                  if (singleChunk.startsWith("JNI global references") || singleChunk.startsWith("JNI global refs")) {
                      // Nothing interesting is expected after this point. Also, this is a convenient way to eliminate the
                      // deadlock report that is spread over several chunks
                      break;
                  }
  
                  ThreadDumpThread.Builder thread = thread(singleChunk);
                  if (thread != null) {
                      threads.add(thread);
                      continue;
                  }
  
                  if (header.isEmpty()) { // Still reading header
                      header.addAll(Arrays.asList(singleChunk.split(NL)));
                      continue;
                  }
  
                  // New info in Java 9
                  if (singleChunk.startsWith("Threads class SMR info:")) {
                      continue;
                  }
  
                  String msg = "Skipping unrecognized chunk: >>>" + singleChunk + "<<<";
                  if (failOnErrors) {
                      throw new IllegalRuntimeStateException(msg);
                  } else {
                      LOG.warning(msg);
                  }
              }
          } finally {
              scanner.close();
          }
  
          if (threads.isEmpty()) throw new IllegalRuntimeStateException(
                  "No threads found in threaddump"
          );
  
          return new ThreadDumpRuntime(threads, header);
      }
focal_method.class_method_signature: ThreadDumpFactory.fromStream(@Nonnull InputStream stream)
focal_method.full_signature: public @Nonnull ThreadDumpRuntime fromStream(@Nonnull InputStream stream)
focal_method.identifier: fromStream
focal_method.invocations: useDelimiter hasNext next startsWith startsWith thread add isEmpty addAll asList split startsWith warning close isEmpty
focal_method.modifiers: public @Nonnull
focal_method.parameters: (@Nonnull InputStream stream)
focal_method.return: ThreadDumpRuntime
focal_method.signature: ThreadDumpRuntime fromStream(@Nonnull InputStream stream)