Commit 99e61555 authored by Matt Tucker's avatar Matt Tucker Committed by matt

Fixes for unzipping plugins.


git-svn-id: http://svn.igniterealtime.org/svn/repos/messenger/trunk@515 b35dd754-fafc-0310-a699-88a17e54d16e
parent fcd8f9a2
...@@ -21,7 +21,8 @@ import org.dom4j.io.SAXReader; ...@@ -21,7 +21,8 @@ import org.dom4j.io.SAXReader;
import java.io.*; import java.io.*;
import java.util.*; import java.util.*;
import java.util.zip.ZipEntry; import java.util.jar.JarFile;
import java.util.jar.JarEntry;
import java.util.zip.ZipFile; import java.util.zip.ZipFile;
import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.ScheduledThreadPoolExecutor; import java.util.concurrent.ScheduledThreadPoolExecutor;
...@@ -58,7 +59,7 @@ public class PluginManager { ...@@ -58,7 +59,7 @@ public class PluginManager {
*/ */
public void start() { public void start() {
executor = new ScheduledThreadPoolExecutor(1); executor = new ScheduledThreadPoolExecutor(1);
executor.scheduleWithFixedDelay(new PluginMonitor(), 0, 30, TimeUnit.SECONDS); executor.scheduleWithFixedDelay(new PluginMonitor(), 0, 10, TimeUnit.SECONDS);
} }
/** /**
...@@ -174,7 +175,7 @@ public class PluginManager { ...@@ -174,7 +175,7 @@ public class PluginManager {
// If the JAR hasn't been exploded, do so. // If the JAR hasn't been exploded, do so.
if (!dir.exists()) { if (!dir.exists()) {
try { try {
ZipFile zipFile = new ZipFile(jarFile); ZipFile zipFile = new JarFile(jarFile);
// Ensure that this JAR is a plugin. // Ensure that this JAR is a plugin.
if (zipFile.getEntry("plugin.xml") == null) { if (zipFile.getEntry("plugin.xml") == null) {
continue; continue;
...@@ -182,9 +183,13 @@ public class PluginManager { ...@@ -182,9 +183,13 @@ public class PluginManager {
dir.mkdir(); dir.mkdir();
Log.debug("Extracting plugin: " + jarName); Log.debug("Extracting plugin: " + jarName);
for (Enumeration e=zipFile.entries(); e.hasMoreElements(); ) { for (Enumeration e=zipFile.entries(); e.hasMoreElements(); ) {
ZipEntry entry = (ZipEntry)e.nextElement(); JarEntry entry = (JarEntry)e.nextElement();
File entryFile = new File(dir, entry.getName()); File entryFile = new File(dir, entry.getName());
if (!entryFile.isDirectory()) { // Ignore any manifest.mf entries.
if (entry.getName().toLowerCase().endsWith("manifest.mf")) {
continue;
}
if (!entry.isDirectory()) {
entryFile.getParentFile().mkdirs(); entryFile.getParentFile().mkdirs();
FileOutputStream out = new FileOutputStream(entryFile); FileOutputStream out = new FileOutputStream(entryFile);
InputStream zin = zipFile.getInputStream(entry); InputStream zin = zipFile.getInputStream(entry);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment