@Test public void testDoCtags() throws Exception { Definitions result = getDefs("bug16070/arguments.c"); assertEquals(13, result.numberOfSymbols()); }
public Definitions doCtags(String file) throws IOException, InterruptedException { if (file.length() < 1 || "\n".equals(file)) { return null; } if (ctags != null) { try { int exitValue = ctags.exitValue(); LOGGER.log(Level.WARNING, "Ctags process exited with exit value {0}", exitValue); throw new InterruptedException("ctags process died"); } catch (IllegalThreadStateException exp) { } } else { initialize(); run(); } CtagsReader rdr = new CtagsReader(); rdr.setSplitterSupplier(() -> trySplitSource(file)); rdr.setTabSize(tabSize); Definitions ret = null; try { ctagsIn.write(file + "\n"); if (Thread.interrupted()) { throw new InterruptedException("write()"); } ctagsIn.flush(); if (Thread.interrupted()) { throw new InterruptedException("flush()"); } IndexerParallelizer parallelizer = env.getIndexerParallelizer(); ExecutorService executor = parallelizer.getCtagsWatcherExecutor(); Future<Definitions> future = executor.submit(() -> { readTags(rdr); return rdr.getDefinitions(); }); try { ret = future.get(getTimeout(), TimeUnit.SECONDS); } catch (ExecutionException ex) { LOGGER.log(Level.WARNING, "execution exception", ex); } catch (TimeoutException ex) { LOGGER.log(Level.WARNING, String.format("Terminating ctags process for file '%s' " + "due to timeout %d seconds", file, getTimeout())); close(); throw new InterruptedException("ctags timeout"); } } catch (IOException ex) { if (Thread.interrupted()) { throw new InterruptedException("I/O"); } throw ex; } return ret; }
Ctags implements Resettable { public Definitions doCtags(String file) throws IOException, InterruptedException { if (file.length() < 1 || "\n".equals(file)) { return null; } if (ctags != null) { try { int exitValue = ctags.exitValue(); LOGGER.log(Level.WARNING, "Ctags process exited with exit value {0}", exitValue); throw new InterruptedException("ctags process died"); } catch (IllegalThreadStateException exp) { } } else { initialize(); run(); } CtagsReader rdr = new CtagsReader(); rdr.setSplitterSupplier(() -> trySplitSource(file)); rdr.setTabSize(tabSize); Definitions ret = null; try { ctagsIn.write(file + "\n"); if (Thread.interrupted()) { throw new InterruptedException("write()"); } ctagsIn.flush(); if (Thread.interrupted()) { throw new InterruptedException("flush()"); } IndexerParallelizer parallelizer = env.getIndexerParallelizer(); ExecutorService executor = parallelizer.getCtagsWatcherExecutor(); Future<Definitions> future = executor.submit(() -> { readTags(rdr); return rdr.getDefinitions(); }); try { ret = future.get(getTimeout(), TimeUnit.SECONDS); } catch (ExecutionException ex) { LOGGER.log(Level.WARNING, "execution exception", ex); } catch (TimeoutException ex) { LOGGER.log(Level.WARNING, String.format("Terminating ctags process for file '%s' " + "due to timeout %d seconds", file, getTimeout())); close(); throw new InterruptedException("ctags timeout"); } } catch (IOException ex) { if (Thread.interrupted()) { throw new InterruptedException("I/O"); } throw ex; } return ret; } }
Ctags implements Resettable { public Definitions doCtags(String file) throws IOException, InterruptedException { if (file.length() < 1 || "\n".equals(file)) { return null; } if (ctags != null) { try { int exitValue = ctags.exitValue(); LOGGER.log(Level.WARNING, "Ctags process exited with exit value {0}", exitValue); throw new InterruptedException("ctags process died"); } catch (IllegalThreadStateException exp) { } } else { initialize(); run(); } CtagsReader rdr = new CtagsReader(); rdr.setSplitterSupplier(() -> trySplitSource(file)); rdr.setTabSize(tabSize); Definitions ret = null; try { ctagsIn.write(file + "\n"); if (Thread.interrupted()) { throw new InterruptedException("write()"); } ctagsIn.flush(); if (Thread.interrupted()) { throw new InterruptedException("flush()"); } IndexerParallelizer parallelizer = env.getIndexerParallelizer(); ExecutorService executor = parallelizer.getCtagsWatcherExecutor(); Future<Definitions> future = executor.submit(() -> { readTags(rdr); return rdr.getDefinitions(); }); try { ret = future.get(getTimeout(), TimeUnit.SECONDS); } catch (ExecutionException ex) { LOGGER.log(Level.WARNING, "execution exception", ex); } catch (TimeoutException ex) { LOGGER.log(Level.WARNING, String.format("Terminating ctags process for file '%s' " + "due to timeout %d seconds", file, getTimeout())); close(); throw new InterruptedException("ctags timeout"); } } catch (IOException ex) { if (Thread.interrupted()) { throw new InterruptedException("I/O"); } throw ex; } return ret; } Ctags(); }
Ctags implements Resettable { public Definitions doCtags(String file) throws IOException, InterruptedException { if (file.length() < 1 || "\n".equals(file)) { return null; } if (ctags != null) { try { int exitValue = ctags.exitValue(); LOGGER.log(Level.WARNING, "Ctags process exited with exit value {0}", exitValue); throw new InterruptedException("ctags process died"); } catch (IllegalThreadStateException exp) { } } else { initialize(); run(); } CtagsReader rdr = new CtagsReader(); rdr.setSplitterSupplier(() -> trySplitSource(file)); rdr.setTabSize(tabSize); Definitions ret = null; try { ctagsIn.write(file + "\n"); if (Thread.interrupted()) { throw new InterruptedException("write()"); } ctagsIn.flush(); if (Thread.interrupted()) { throw new InterruptedException("flush()"); } IndexerParallelizer parallelizer = env.getIndexerParallelizer(); ExecutorService executor = parallelizer.getCtagsWatcherExecutor(); Future<Definitions> future = executor.submit(() -> { readTags(rdr); return rdr.getDefinitions(); }); try { ret = future.get(getTimeout(), TimeUnit.SECONDS); } catch (ExecutionException ex) { LOGGER.log(Level.WARNING, "execution exception", ex); } catch (TimeoutException ex) { LOGGER.log(Level.WARNING, String.format("Terminating ctags process for file '%s' " + "due to timeout %d seconds", file, getTimeout())); close(); throw new InterruptedException("ctags timeout"); } } catch (IOException ex) { if (Thread.interrupted()) { throw new InterruptedException("I/O"); } throw ex; } return ret; } Ctags(); boolean isClosed(); void setLangMap(LangMap langMap); int getTabSize(); void setTabSize(int tabSize); void setCTagsExtraOptionsFile(String CTagsExtraOptionsFile); void setTimeout(long timeout); long getTimeout(); @Override void reset(); void close(); List<String> getArgv(); Definitions doCtags(String file); }
Ctags implements Resettable { public Definitions doCtags(String file) throws IOException, InterruptedException { if (file.length() < 1 || "\n".equals(file)) { return null; } if (ctags != null) { try { int exitValue = ctags.exitValue(); LOGGER.log(Level.WARNING, "Ctags process exited with exit value {0}", exitValue); throw new InterruptedException("ctags process died"); } catch (IllegalThreadStateException exp) { } } else { initialize(); run(); } CtagsReader rdr = new CtagsReader(); rdr.setSplitterSupplier(() -> trySplitSource(file)); rdr.setTabSize(tabSize); Definitions ret = null; try { ctagsIn.write(file + "\n"); if (Thread.interrupted()) { throw new InterruptedException("write()"); } ctagsIn.flush(); if (Thread.interrupted()) { throw new InterruptedException("flush()"); } IndexerParallelizer parallelizer = env.getIndexerParallelizer(); ExecutorService executor = parallelizer.getCtagsWatcherExecutor(); Future<Definitions> future = executor.submit(() -> { readTags(rdr); return rdr.getDefinitions(); }); try { ret = future.get(getTimeout(), TimeUnit.SECONDS); } catch (ExecutionException ex) { LOGGER.log(Level.WARNING, "execution exception", ex); } catch (TimeoutException ex) { LOGGER.log(Level.WARNING, String.format("Terminating ctags process for file '%s' " + "due to timeout %d seconds", file, getTimeout())); close(); throw new InterruptedException("ctags timeout"); } } catch (IOException ex) { if (Thread.interrupted()) { throw new InterruptedException("I/O"); } throw ex; } return ret; } Ctags(); boolean isClosed(); void setLangMap(LangMap langMap); int getTabSize(); void setTabSize(int tabSize); void setCTagsExtraOptionsFile(String CTagsExtraOptionsFile); void setTimeout(long timeout); long getTimeout(); @Override void reset(); void close(); List<String> getArgv(); Definitions doCtags(String file);  }