Code example for JarFile

Methods: getJarEntry

0
        JarFile attrJar = null;
        File file = null;
 
        Support_Resources.copyFile(resources, null, "Broken_manifest.jar");
        try { 
            attrJar = new JarFile(new File(resources, "Broken_manifest.jar"));
            jarEntry = attrJar.getJarEntry("META-INF/");
            jarEntry.getAttributes();
            fail("IOException expected");
        } catch (IOException e) {
            // expected. 
        } 
    } 
 
    public void test_ConstructorLjava_lang_String() { 
        assertNotNull("Jar file is null", jarFile);
        zipEntry = jarFile.getEntry(entryName);
        assertNotNull("Zip entry is null", zipEntry);
        jarEntry = new JarEntry(entryName);
        assertNotNull("Jar entry is null", jarEntry);
        assertEquals("Wrong entry constructed--wrong name", entryName, jarEntry