ZipOutputStream out = new ZipOutputStream(buffDest);) { bar.setMinimum(0); bar.setMaximum(jfile.size()); byte data[] = new byte[1024]; DecompilerSettings settings = cloneSettings();
private boolean isDeploymentValidZipFile(File pluginFile) { boolean isValid; JarFile jarFile = null; try { // Try to access the plugin jar using the JarFile API. // Any weird errors usually mean the file is currently being written but isn't finished yet. // Errors could also mean the file is simply corrupted. jarFile = new JarFile(pluginFile); if (jarFile.size() <= 0) { throw new Exception("There are no entries in the plugin file"); } JarEntry entry = jarFile.entries().nextElement(); entry.getName(); isValid = true; } catch (Exception e) { log.info("File [" + pluginFile + "] is not a valid jarfile - " + " the file may not have been fully written yet. Cause: " + e); isValid = false; } finally { if (jarFile != null) { try { jarFile.close(); } catch (Exception e) { log.error("Failed to close jar file [" + pluginFile + "]"); } } } return isValid; }
try StringBuilder classes = new StringBuilder( jFile.size() );
double size = oldjarNames.size() + keys.length + jarDiff.size(); double currentEntry = 0;
SubMonitor subMonitor = SubMonitor.convert(monitor, jar.size()); Enumeration<JarEntry> enumEntries = jar.entries(); while (enumEntries.hasMoreElements()) {
double size = oldjarNames.size() + keys.length + jarDiff.size(); double currentEntry = 0;
Assert.assertEquals(ADDED_FILE_COUNT, outJarFile.size());
Assert.assertNotEquals("Entry for source " + it.getName() + " should have non-zero size", it.getSize()); }); Assert.assertNotEquals("output jar '" + outJarFile + "' should not be empty", 0, outJarFile.size());