Example usage for org.apache.commons.compress.archivers.ar ArArchiveEntry getName

List of usage examples for org.apache.commons.compress.archivers.ar ArArchiveEntry getName

Introduction

In this page you can find the example usage for org.apache.commons.compress.archivers.ar ArArchiveEntry getName.

Prototype

public String getName() 

Source Link

Usage

From source file:com.facebook.buck.cxx.ArchiveStepIntegrationTest.java

@Test
public void inputDirs() throws IOException, InterruptedException {
    assumeTrue(Platform.detect() == Platform.MACOS || Platform.detect() == Platform.LINUX);
    ProjectFilesystem filesystem = new ProjectFilesystem(tmp.getRoot());
    CxxPlatform platform = CxxPlatformUtils.build(new CxxBuckConfig(FakeBuckConfig.builder().build()));

    // Build up the paths to various files the archive step will use.
    SourcePathResolver sourcePathResolver = new SourcePathResolver(new SourcePathRuleFinder(
            new BuildRuleResolver(TargetGraph.EMPTY, new DefaultTargetNodeToBuildRuleTransformer())));
    Archiver archiver = platform.getAr();
    Path output = filesystem.getPath("output.a");
    Path input = filesystem.getPath("foo/blah.dat");
    filesystem.mkdirs(input.getParent());
    filesystem.writeContentsToPath("blah", input);

    // Build an archive step.
    ArchiveStep archiveStep = new ArchiveStep(filesystem, archiver.getEnvironment(),
            archiver.getCommandPrefix(sourcePathResolver), ImmutableList.of(), getArchiveOptions(false), output,
            ImmutableList.of(input.getParent()), archiver);

    // Execute the archive step and verify it ran successfully.
    ExecutionContext executionContext = TestExecutionContext.newInstance();
    TestConsole console = (TestConsole) executionContext.getConsole();
    int exitCode = archiveStep.execute(executionContext).getExitCode();
    assertEquals("archive step failed: " + console.getTextWrittenToStdErr(), 0, exitCode);

    // Now read the archive entries and verify that the timestamp, UID, and GID fields are
    // zero'd out.
    try (ArArchiveInputStream stream = new ArArchiveInputStream(
            new FileInputStream(filesystem.resolve(output).toFile()))) {
        ArArchiveEntry entry = stream.getNextArEntry();
        assertThat(entry.getName(), Matchers.equalTo("blah.dat"));
    }//  w  w w  . j a  v  a 2s .c o  m
}

From source file:com.facebook.buck.cxx.CxxLibraryIntegrationTest.java

@Test
public void thinArchivesDoNotContainAbsolutePaths() throws IOException {
    CxxPlatform cxxPlatform = CxxPlatformUtils.build(new CxxBuckConfig(FakeBuckConfig.builder().build()));
    assumeTrue(cxxPlatform.getAr().supportsThinArchives());
    ProjectWorkspace workspace = TestDataHelper.createProjectWorkspaceForScenario(this, "cxx_library", tmp);
    workspace.setUp();/*from  w  ww  . j  a va 2s.  co m*/
    Path archive = workspace.buildAndReturnOutput("-c", "cxx.archive_contents=thin", "//:foo#default,static");

    // NOTE: Replace the thin header with a normal header just so the commons compress parser
    // can parse the archive contents.
    try (OutputStream outputStream = Files.newOutputStream(workspace.getPath(archive),
            StandardOpenOption.WRITE)) {
        outputStream.write(ObjectFileScrubbers.GLOBAL_HEADER);
    }

    // Now iterate the archive and verify it contains no absolute paths.
    try (ArArchiveInputStream stream = new ArArchiveInputStream(
            new FileInputStream(workspace.getPath(archive).toFile()))) {
        ArArchiveEntry entry;
        while ((entry = stream.getNextArEntry()) != null) {
            if (!entry.getName().isEmpty()) {
                assertFalse("found absolute path: " + entry.getName(),
                        workspace.getDestPath().getFileSystem().getPath(entry.getName()).isAbsolute());
            }
        }
    }
}

From source file:com.facebook.buck.cxx.ArchiveStepIntegrationTest.java

@Test
public void thinArchives() throws IOException, InterruptedException {
    assumeTrue(Platform.detect() == Platform.MACOS || Platform.detect() == Platform.LINUX);
    ProjectFilesystem filesystem = new ProjectFilesystem(tmp.getRoot());
    CxxPlatform platform = CxxPlatformUtils.build(new CxxBuckConfig(FakeBuckConfig.builder().build()));
    assumeTrue(platform.getAr().supportsThinArchives());

    // Build up the paths to various files the archive step will use.
    SourcePathResolver sourcePathResolver = new SourcePathResolver(new SourcePathRuleFinder(
            new BuildRuleResolver(TargetGraph.EMPTY, new DefaultTargetNodeToBuildRuleTransformer())));
    Archiver archiver = platform.getAr();

    Path output = filesystem.getPath("foo/libthin.a");
    filesystem.mkdirs(output.getParent());

    // Create a really large input file so it's obvious that the archive is thin.
    Path input = filesystem.getPath("bar/blah.dat");
    filesystem.mkdirs(input.getParent());
    byte[] largeInputFile = new byte[1024 * 1024];
    byte[] fillerToRepeat = "hello\n".getBytes(StandardCharsets.UTF_8);
    for (int i = 0; i < largeInputFile.length; i++) {
        largeInputFile[i] = fillerToRepeat[i % fillerToRepeat.length];
    }/*from www .  j  a v  a  2 s . co m*/
    filesystem.writeBytesToPath(largeInputFile, input);

    // Build an archive step.
    ArchiveStep archiveStep = new ArchiveStep(filesystem, archiver.getEnvironment(),
            archiver.getCommandPrefix(sourcePathResolver), ImmutableList.of(), getArchiveOptions(true), output,
            ImmutableList.of(input), archiver);

    // Execute the archive step and verify it ran successfully.
    ExecutionContext executionContext = TestExecutionContext.newInstance();
    TestConsole console = (TestConsole) executionContext.getConsole();
    int exitCode = archiveStep.execute(executionContext).getExitCode();
    assertEquals("archive step failed: " + console.getTextWrittenToStdErr(), 0, exitCode);

    // Verify that the thin header is present.
    assertThat(filesystem.readFirstLine(output), Matchers.equalTo(Optional.of("!<thin>")));

    // Verify that even though the archived contents is really big, the archive is still small.
    assertThat(filesystem.getFileSize(output), Matchers.lessThan(1000L));

    // NOTE: Replace the thin header with a normal header just so the commons compress parser
    // can parse the archive contents.
    try (OutputStream outputStream = Files.newOutputStream(filesystem.resolve(output),
            StandardOpenOption.WRITE)) {
        outputStream.write(ObjectFileScrubbers.GLOBAL_HEADER);
    }

    // Now read the archive entries and verify that the timestamp, UID, and GID fields are
    // zero'd out.
    try (ArArchiveInputStream stream = new ArArchiveInputStream(
            new FileInputStream(filesystem.resolve(output).toFile()))) {
        ArArchiveEntry entry = stream.getNextArEntry();

        // Verify that the input names are relative paths from the outputs parent dir.
        assertThat(entry.getName(), Matchers.equalTo(output.getParent().relativize(input).toString()));
    }
}

From source file:com.codemarvels.ant.aptrepotask.AptRepoTask.java

public void execute() {
    if (repoDir == null) {
        log("repoDir attribute is empty !", LogLevel.ERR.getLevel());
        throw new RuntimeException("Bad attributes for apt-repo task");
    }//from  w w w  .  jav  a 2s .co m
    log("repo dir: " + repoDir);
    File repoFolder = new File(repoDir);
    if (!repoFolder.exists()) {
        repoFolder.mkdirs();
    }
    File[] files = repoFolder.listFiles(new FileFilter() {
        public boolean accept(File pathname) {
            if (pathname.getName().endsWith(FILE_DEB_EXT)) {
                return true;
            }
            return false;
        }
    });
    Packages packages = new Packages();
    for (int i = 0; i < files.length; i++) {
        File file = files[i];
        PackageEntry packageEntry = new PackageEntry();
        packageEntry.setSize(file.length());
        packageEntry.setSha1(Utils.getDigest("SHA-1", file));
        packageEntry.setSha256(Utils.getDigest("SHA-256", file));
        packageEntry.setMd5sum(Utils.getDigest("MD5", file));
        String fileName = file.getName();
        packageEntry.setFilename(fileName);
        log("found deb: " + fileName);
        try {
            ArchiveInputStream control_tgz;
            ArArchiveEntry entry;
            TarArchiveEntry control_entry;
            ArchiveInputStream debStream = new ArchiveStreamFactory().createArchiveInputStream("ar",
                    new FileInputStream(file));
            while ((entry = (ArArchiveEntry) debStream.getNextEntry()) != null) {
                if (entry.getName().equals("control.tar.gz")) {
                    ControlHandler controlHandler = new ControlHandler();
                    GZIPInputStream gzipInputStream = new GZIPInputStream(debStream);
                    control_tgz = new ArchiveStreamFactory().createArchiveInputStream("tar", gzipInputStream);
                    while ((control_entry = (TarArchiveEntry) control_tgz.getNextEntry()) != null) {
                        log("control entry: " + control_entry.getName(), LogLevel.DEBUG.getLevel());
                        if (control_entry.getName().trim().equals(CONTROL_FILE_NAME)) {
                            ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
                            IOUtils.copy(control_tgz, outputStream);
                            String content_string = outputStream.toString("UTF-8");
                            outputStream.close();
                            controlHandler.setControlContent(content_string);
                            log("control cont: " + outputStream.toString("utf-8"), LogLevel.DEBUG.getLevel());
                            break;
                        }
                    }
                    control_tgz.close();
                    if (controlHandler.hasControlContent()) {
                        controlHandler.handle(packageEntry);
                    } else {
                        throw new RuntimeException("no control content found for: " + file.getName());
                    }
                    break;
                }
            }
            debStream.close();
            packages.addPackageEntry(packageEntry);
        } catch (Exception e) {
            String msg = FAILED_TO_CREATE_APT_REPO + " " + file.getName();
            log(msg, e, LogLevel.ERR.getLevel());
            throw new RuntimeException(msg, e);
        }
    }
    try {
        File packagesFile = new File(repoDir, PACKAGES_GZ);
        packagesWriter = new BufferedWriter(
                new OutputStreamWriter(new GZIPOutputStream(new FileOutputStream(packagesFile))));
        packagesWriter.write(packages.toString());
        DefaultHashes hashes = Utils.getDefaultDigests(packagesFile);
        ReleaseInfo pinfo = new ReleaseInfo(PACKAGES_GZ, packagesFile.length(), hashes);
        Release release = new Release();
        release.addInfo(pinfo);
        final File releaseFile = new File(repoDir, RELEASE);
        FileUtils.fileWrite(releaseFile, release.toString());
    } catch (IOException e) {
        throw new RuntimeException("writing files failed", e);
    } finally {
        if (packagesWriter != null) {
            try {
                packagesWriter.close();
            } catch (IOException e) {
                throw new RuntimeException("writing files failed", e);
            }
        }
    }
}

From source file:com.espringtran.compressor4j.processor.ArProcessor.java

/**
 * Read from compressed file/*from w  ww .  j a  v a2  s  . com*/
 * 
 * @param srcPath
 *            path of compressed file
 * @param fileCompressor
 *            FileCompressor object
 * @throws Exception
 */
@Override
public void read(String srcPath, FileCompressor fileCompressor) throws Exception {
    long t1 = System.currentTimeMillis();
    byte[] data = FileUtil.convertFileToByte(srcPath);
    ByteArrayInputStream bais = new ByteArrayInputStream(data);
    ArArchiveInputStream ais = new ArArchiveInputStream(bais);
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    try {
        byte[] buffer = new byte[1024];
        int readByte;
        ArArchiveEntry entry = ais.getNextArEntry();
        while (entry != null && entry.getSize() > 0) {
            long t2 = System.currentTimeMillis();
            baos = new ByteArrayOutputStream();
            readByte = ais.read(buffer);
            while (readByte != -1) {
                baos.write(buffer, 0, readByte);
                readByte = ais.read(buffer);
            }
            BinaryFile binaryFile = new BinaryFile(entry.getName(), baos.toByteArray());
            fileCompressor.addBinaryFile(binaryFile);
            LogUtil.createAddFileLog(fileCompressor, binaryFile, t2, System.currentTimeMillis());
            entry = ais.getNextArEntry();
        }
    } catch (Exception e) {
        FileCompressor.LOGGER.error("Error on get compressor file", e);
    } finally {
        baos.close();
        ais.close();
        bais.close();
    }
    LogUtil.createReadLog(fileCompressor, srcPath, data.length, t1, System.currentTimeMillis());
}

From source file:org.m1theo.apt.repo.AptRepoMojo.java

public void execute() throws MojoExecutionException {
    getLog().info("repo dir: " + repoDir.getPath());
    if (!repoDir.exists()) {
        repoDir.mkdirs();//from   www . j a  v a 2 s. c  om
    }
    try {
        Collection<Artifact> artifacts = Utils.getAllArtifacts4Type(project, type, aggregate);
        // Collection<Artifact> artifacts =
        // Utils.getDebArtifacts(project, reactorProjects, type, aggregate, getLog());
        for (Artifact artifact : artifacts) {
            getLog().debug("Artifact: " + artifact);
            getLog().debug("Artifact type: " + artifact.getType());
            FileUtils.copyFileToDirectory(artifact.getFile(), repoDir);
        }
    } catch (IOException e) {
        getLog().error(FAILED_TO_CREATE_APT_REPO, e);
        throw new MojoExecutionException(FAILED_TO_CREATE_APT_REPO, e);
    }
    File[] files = repoDir.listFiles(new FileFilter() {
        private String ext = "." + type;

        public boolean accept(File pathname) {
            if (pathname.getName().endsWith(ext)) {
                return true;
            }
            return false;
        }
    });
    Packages packages = new Packages();
    for (int i = 0; i < files.length; i++) {
        File file = files[i];
        PackageEntry packageEntry = new PackageEntry();
        packageEntry.setSize(file.length());
        packageEntry.setSha1(Utils.getDigest("SHA-1", file));
        packageEntry.setSha256(Utils.getDigest("SHA-256", file));
        packageEntry.setMd5sum(Utils.getDigest("MD5", file));
        // String fileName = debFilesDir.getName() + File.separator + file.getName();
        String fileName = file.getName();
        packageEntry.setFilename(fileName);
        getLog().info("found deb: " + fileName);
        try {
            ArchiveInputStream control_tgz;
            ArArchiveEntry entry;
            TarArchiveEntry control_entry;
            ArchiveInputStream debStream = new ArchiveStreamFactory().createArchiveInputStream("ar",
                    new FileInputStream(file));
            while ((entry = (ArArchiveEntry) debStream.getNextEntry()) != null) {
                if (entry.getName().equals("control.tar.gz")) {
                    ControlHandler controlHandler = new ControlHandler();
                    GZIPInputStream gzipInputStream = new GZIPInputStream(debStream);
                    control_tgz = new ArchiveStreamFactory().createArchiveInputStream("tar", gzipInputStream);
                    while ((control_entry = (TarArchiveEntry) control_tgz.getNextEntry()) != null) {
                        getLog().debug("control entry: " + control_entry.getName());
                        if (control_entry.getName().equals(CONTROL_FILE_NAME)) {
                            ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
                            IOUtils.copy(control_tgz, outputStream);
                            String content_string = outputStream.toString("UTF-8");
                            outputStream.close();
                            controlHandler.setControlContent(content_string);
                            getLog().debug("control cont: " + outputStream.toString("utf-8"));
                            break;
                        }
                    }
                    control_tgz.close();
                    if (controlHandler.hasControlContent()) {
                        controlHandler.handle(packageEntry);
                    } else {
                        throw new MojoExecutionException("no control content found for: " + file.getName());
                    }
                    break;
                }
            }
            debStream.close();
            packages.addPackageEntry(packageEntry);
            if (attach) {
                getLog().info("Attaching file: " + file);
                projectHelper.attachArtifact(project, type, file.getName(), file);
                // projectHelper.attachArtifact(project, file, fileName);
            }
        } catch (MojoExecutionException e) {
            String msg = FAILED_TO_CREATE_APT_REPO + " " + file.getName();
            getLog().error(msg, e);
            throw new MojoExecutionException(msg, e);
        } catch (FileNotFoundException e) {
            String msg = FAILED_TO_CREATE_APT_REPO + " " + file.getName();
            getLog().error(msg, e);
            throw new MojoExecutionException(msg, e);
        } catch (ArchiveException e) {
            String msg = FAILED_TO_CREATE_APT_REPO + " " + file.getName();
            getLog().error(msg, e);
            throw new MojoExecutionException(msg, e);
        } catch (IOException e) {
            String msg = FAILED_TO_CREATE_APT_REPO + " " + file.getName();
            getLog().error(msg, e);
            throw new MojoExecutionException(msg, e);
        }
    }
    try {
        File packagesFile = new File(repoDir, PACKAGES_GZ);
        packagesWriter = new BufferedWriter(
                new OutputStreamWriter(new GZIPOutputStream(new FileOutputStream(packagesFile))));
        packagesWriter.write(packages.toString());
        // FileUtils.fileWrite(packagesFile, packages.toString());
        DefaultHashes hashes = Utils.getDefaultDigests(packagesFile);
        ReleaseInfo pinfo = new ReleaseInfo(PACKAGES_GZ, packagesFile.length(), hashes);
        Release release = new Release();
        release.addInfo(pinfo);
        final File releaseFile = new File(repoDir, RELEASE);
        FileUtils.fileWrite(releaseFile, release.toString());
        // if (attach) {
        // getLog().info("Attaching created apt-repo files: " + releaseFile + ", " + packagesFile);
        // projectHelper.attachArtifact(project, "gz", "Packages", packagesFile);
        // projectHelper.attachArtifact(project, "Release-File", "Release", packagesFile);
        // }
    } catch (IOException e) {
        throw new MojoExecutionException("writing files failed", e);
    } finally {
        if (packagesWriter != null) {
            try {
                packagesWriter.close();
            } catch (IOException e) {
                throw new MojoExecutionException("writing files failed", e);
            }
        }
    }
}

From source file:org.m1theo.apt.repo.builder.RepoBuilder.java

private void createPackagesFile() throws AptRepoException {
    //TODO implement copy file?
    Packages packages = new Packages();
    for (File file : debFiles) {
        PackageEntry packageEntry = new PackageEntry();
        packageEntry.setSize(file.length());
        packageEntry.setSha1(Utils.getDigest("SHA-1", file));
        packageEntry.setSha256(Utils.getDigest("SHA-256", file));
        packageEntry.setSha512(Utils.getDigest("SHA-512", file));
        packageEntry.setMd5sum(Utils.getDigest("MD5", file));
        String fileName = file.getName();
        packageEntry.setFilename(fileName);
        //getLog().info("found deb: " + fileName);
        try {/*  www .java 2 s.  c  o  m*/
            ArchiveInputStream control_tgz;
            ArArchiveEntry entry;
            TarArchiveEntry control_entry;
            ArchiveInputStream debStream = new ArchiveStreamFactory().createArchiveInputStream("ar",
                    new FileInputStream(file));
            while ((entry = (ArArchiveEntry) debStream.getNextEntry()) != null) {
                if (entry.getName().equals("control.tar.gz")) {
                    ControlHandler controlHandler = new ControlHandler();
                    GZIPInputStream gzipInputStream = new GZIPInputStream(debStream);
                    control_tgz = new ArchiveStreamFactory().createArchiveInputStream("tar", gzipInputStream);
                    while ((control_entry = (TarArchiveEntry) control_tgz.getNextEntry()) != null) {
                        //getLog().debug("control entry: " + control_entry.getName());
                        if (control_entry.getName().equals(CONTROL_FILE_NAME)) {
                            ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
                            IOUtils.copy(control_tgz, outputStream);
                            String content_string = outputStream.toString("UTF-8");
                            outputStream.close();
                            controlHandler.setControlContent(content_string);
                            //getLog().debug("control cont: " + outputStream.toString("utf-8"));
                            break;
                        }
                    }
                    control_tgz.close();
                    if (controlHandler.hasControlContent()) {
                        controlHandler.handle(packageEntry);
                    } else {
                        throw new AptRepoException("no control content found for: " + file.getName());
                    }
                    break;
                }
            }
            debStream.close();
            packages.addPackageEntry(packageEntry);

        } catch (UnsupportedEncodingException e) {
            throw new AptRepoException("Packages encoding exception", e);
        } catch (ArchiveException e) {
            throw new AptRepoException("Packages archive exception", e);
        } catch (IOException e) {
            throw new AptRepoException("Packages IOExeption", e);
        }
    }
    try {
        File packagesFile = new File(repoDir, PACKAGES);
        BufferedWriter packagesWriter = null;
        packagesWriter = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(packagesFile)));
        packagesWriter.write(packages.toString());
        packagesWriter.close();
        this.packagesFile = packagesFile;

        File packagesGzFile = new File(repoDir, PACKAGES_GZ);
        BufferedWriter packagesGzWriter = new BufferedWriter(
                new OutputStreamWriter(new GZIPOutputStream(new FileOutputStream(packagesGzFile))));
        packagesGzWriter.write(packages.toString());
        packagesGzWriter.close();
        this.packagesGzFile = packagesGzFile;
    } catch (FileNotFoundException e) {
        throw new AptRepoException("invalid repodir: " + repoDir, e);
    } catch (IOException e) {
        throw new AptRepoException("writing packages failed", e);
    }
}

From source file:org.vafer.jdeb.ant.DebAntTaskTestCase.java

public void testBZip2Compression() throws Exception {
    project.executeTarget("bzip2-compression");

    File deb = new File("target/test-classes/test.deb");
    assertTrue("package not build", deb.exists());

    final AtomicBoolean found = new AtomicBoolean(false);

    ArArchiveInputStream in = new ArArchiveInputStream(new FileInputStream(deb));
    ArchiveWalker.walk(in, new ArchiveVisitor<ArArchiveEntry>() {
        public void visit(ArArchiveEntry entry, byte[] content) throws IOException {
            if (entry.getName().equals("data.tar.bz2")) {
                found.set(true);/*from   ww  w.  j  a  va2 s. c  o m*/

                assertEquals("header 0", (byte) 'B', content[0]);
                assertEquals("header 1", (byte) 'Z', content[1]);

                TarInputStream tar = new TarInputStream(
                        new BZip2CompressorInputStream(new ByteArrayInputStream(content)));
                while ((tar.getNextEntry()) != null)
                    ;
                tar.close();
            }
        }
    });

    assertTrue("bz2 file not found", found.get());
}

From source file:org.vafer.jdeb.ant.DebAntTaskTestCase.java

public void testXZCompression() throws Exception {
    project.executeTarget("xz-compression");

    File deb = new File("target/test-classes/test.deb");
    assertTrue("package not build", deb.exists());

    final AtomicBoolean found = new AtomicBoolean(false);

    ArArchiveInputStream in = new ArArchiveInputStream(new FileInputStream(deb));
    ArchiveWalker.walk(in, new ArchiveVisitor<ArArchiveEntry>() {
        public void visit(ArArchiveEntry entry, byte[] content) throws IOException {
            if (entry.getName().equals("data.tar.xz")) {
                found.set(true);/* w w  w  .  jav  a  2  s. c  om*/

                assertEquals("header 0", (byte) 0xFD, content[0]);
                assertEquals("header 1", (byte) '7', content[1]);
                assertEquals("header 2", (byte) 'z', content[2]);
                assertEquals("header 3", (byte) 'X', content[3]);
                assertEquals("header 4", (byte) 'Z', content[4]);
                assertEquals("header 5", (byte) '\0', content[5]);

                TarInputStream tar = new TarInputStream(
                        new XZCompressorInputStream(new ByteArrayInputStream(content)));
                while ((tar.getNextEntry()) != null)
                    ;
                tar.close();
            }
        }
    });

    assertTrue("xz file not found", found.get());
}

From source file:org.vafer.jdeb.ar.ArInputStreamTestCase.java

public void testRead() throws Exception {
    final File archive = new File(getClass().getResource("data.ar").toURI());

    final ArArchiveInputStream ar = new ArArchiveInputStream(new FileInputStream(archive));
    final ArArchiveEntry entry1 = ar.getNextArEntry();

    assertEquals("data.tgz", entry1.getName());
    assertEquals(148, entry1.getLength());

    for (int i = 0; i < entry1.getLength(); i++) {
        ar.read();//from   ww  w .j  ava 2  s  .c o  m
    }

    final ArArchiveEntry entry2 = ar.getNextArEntry();

    assertNull(entry2);

    ar.close();
}