static void unTarUsingJava(File inFile, File untarDir,
      boolean gzipped) throws IOException {
    InputStream inputStream = null;
    TarArchiveInputStream tis = null;
    try {
      if (gzipped) {
        inputStream =
            new GZIPInputStream(Files.newInputStream(inFile.toPath()));
      } else {
        inputStream = Files.newInputStream(inFile.toPath());
      }

      inputStream = new BufferedInputStream(inputStream);

      tis = new TarArchiveInputStream(inputStream);

      for (TarArchiveEntry entry = tis.getNextTarEntry(); entry != null;) {
        unpackEntries(tis, entry, untarDir);
        entry = tis.getNextTarEntry();
      }
    } finally {
      IOUtils.cleanupWithLogger(LOG, tis, inputStream);
    }
  }
@Test(timeout = 30000)
  public void testUntarMissingFileThroughJava() throws Throwable {
    File dataDir = GenericTestUtils.getTestDir();
    File tarFile = new File(dataDir, "missing; true");
    File untarDir = new File(dataDir, "untarDir");
    // java8 on unix throws java.nio.file.NoSuchFileException here;
    // leaving as an IOE intercept in case windows throws something
    // else.
    intercept(IOException.class, () ->
        FileUtil.unTarUsingJava(tarFile, untarDir, false));
  }