int levelMax = -1;
int bid = 0;
int lastLevel = -1;
for(Iterator it = all.iterator(); it.hasNext(); ) {
Bundle b = (Bundle)it.next();
String loc = b.getLocation();
bid++;
URL srcURL = new URL(loc);
String name = Util.shortLocation(loc);
ZipEntry entry = new ZipEntry(base + "/" + name);
int level = -1;
try {
level = sl.getBundleStartLevel(b);
} catch (Exception ignored) { }
levelMax = Math.max(level, levelMax);
if(level != -1 && level != lastLevel) {
xargs.append("-initlevel " + level + "\n");
lastLevel = level;
}
xargs.append("-install file:" + name + "\n");
out.putNextEntry(entry);
InputStream in = null;
try {
in = srcURL.openStream();
int n = 0;
while ((n = in.read(buf)) != -1) {
out.write(buf, 0, n);
}
} finally {
try {
in.close();
} catch (Exception ignored) { }
}
}
bid = 0;
for(Iterator it = all.iterator(); it.hasNext(); ) {
Bundle b = (Bundle)it.next();
bid++;
if(b.getState() == Bundle.ACTIVE) {
xargs.append("-start " + bid + "\n");
}
}
if(levelMax != -1) {