bugged
stringlengths
6
599k
fixed
stringlengths
6
40.8M
__index_level_0__
int64
0
3.24M
private static Color getColor(Channel channel) { int emWave = channel.getLogicalChannel().getEmissionWave().intValue(); if (rangeBlue(emWave)) return BLUE_COLOR; if (rangeGreen(emWave)) return GREEN_COLOR; if (rangeRed(emWave)) return RED_COLOR; return null; }
private static Color getColor(Channel channel) { Integer emWave = channel.getLogicalChannel().getEmissionWave(); if (emWave == null) return null; if (rangeBlue(emWave)) return BLUE_COLOR; if (rangeGreen(emWave)) return GREEN_COLOR; if (rangeRed(emWave)) return RED_COLOR; return null; }
3,239,747
public void executeCompiler() throws Exception { // Usefull variables int i; String str; InputStream inStream; // We get the XML data tree XMLElement data = getXMLTree(); // We get the Packager Packager packager = getPackager(); // We add the variable declaration packager.setVariables(getVariables(data)); // We add the info packager.setInfo(getInfo(data)); // We add the GUIPrefs packager.setGUIPrefs(getGUIPrefs(data)); // We add the language packs ArrayList langpacks = getLangpacksCodes(data); Iterator iter = langpacks.iterator(); while (iter.hasNext()) { str = (String) iter.next(); // The language pack inStream = new FileInputStream(Compiler.IZPACK_HOME + "bin" + File.separator + "langpacks" + File.separator + "installer" + File.separator + str + ".xml"); packager.addLangPack(str, inStream); // The flag inStream = new FileInputStream(Compiler.IZPACK_HOME + "bin" + File.separator + "langpacks" + File.separator + "flags" + File.separator + str + ".gif"); packager.addResource("flag." + str, inStream); } // We add the resources ArrayList resources = getResources(data); iter = resources.iterator(); while (iter.hasNext()) { Resource res = (Resource) iter.next(); if (res.parse) { if (null != varMap) { File resFile = new File(res.src); FileInputStream inFile = new FileInputStream(resFile); BufferedInputStream bin = new BufferedInputStream(inFile, 5120); File parsedFile = File.createTempFile("izpp", null, resFile.getParentFile()); FileOutputStream outFile = new FileOutputStream(parsedFile); BufferedOutputStream bout = new BufferedOutputStream(outFile, 5120); VariableSubstitutor vs = new VariableSubstitutor(varMap); vs.substitute(bin, bout, res.type, res.encoding); bin.close(); bout.close(); inFile = new FileInputStream(parsedFile); packager.addResource(res.id, inFile); inFile.close(); parsedFile.delete(); } else { System.err.println("ERROR: no variable is defined. " + res.src + " is not parsed."); inStream = new FileInputStream(res.src); packager.addResource(res.id, inStream); } } else { inStream = new FileInputStream(res.src); packager.addResource(res.id, inStream); } } // We add the native libraries ArrayList natives = getNativeLibraries(data); iter = natives.iterator(); while (iter.hasNext()) { NativeLibrary nat = (NativeLibrary) iter.next(); inStream = new FileInputStream(nat.path); packager.addNativeLibrary(nat.name, inStream); } // We add the additionnal jar files content ArrayList jars = getJars(data); iter = jars.iterator(); while (iter.hasNext()) packager.addJarContent((String) iter.next()); // We add the panels ArrayList panels = getPanels(data); ArrayList panelsOrder = new ArrayList(panels.size()); TreeSet panelsCache = new TreeSet(); iter = panels.iterator(); while (iter.hasNext()) { // We locate the panel classes directory str = (String) iter.next(); File dir = new File(Compiler.IZPACK_HOME + "bin" + File.separator + "panels" + File.separator + str); if (!dir.exists()) throw new Exception(str + " panel does not exist"); // We add the panel in the order array panelsOrder.add(str); // We add each file in the panel folder if (panelsCache.contains(str)) continue; panelsCache.add(str); File[] files = dir.listFiles(); int nf = files.length; for (int j = 0; j < nf; j++) { if (files[j].isDirectory()) continue; FileInputStream inClass = new FileInputStream(files[j]); packager.addPanelClass(files[j].getName(), inClass); } } // We set the panels order packager.setPanelsOrder(panelsOrder); // We add the packs i = 0; ArrayList packs = getPacks(data); iter = packs.iterator(); while (iter.hasNext()) { Pack pack = (Pack) iter.next(); ZipOutputStream zipOut = packager.addPack(i++, pack.name, pack.required, pack.description); ObjectOutputStream objOut = new ObjectOutputStream(zipOut); // We write the pack data objOut.writeInt(pack.packFiles.size()); Iterator iter2 = pack.packFiles.iterator(); long packageBytes = 0; while (iter2.hasNext()) { // Initialisations PackSource p = (PackSource) iter2.next(); File f = new File(p.src); FileInputStream in = new FileInputStream(f); long nbytes = f.length(); String targetFilename = p.targetdir + "/" + f.getName(); // Writing objOut.writeObject(new PackFile(targetFilename, p.os, nbytes, p.override)); byte[] buffer = new byte[5120]; long bytesWritten = 0; int bytesInBuffer; while ((bytesInBuffer = in.read(buffer)) != -1) { objOut.write(buffer, 0, bytesInBuffer); bytesWritten += bytesInBuffer; } if (bytesWritten != nbytes) throw new IOException ("File size mismatch when reading " + f); packageBytes += bytesWritten; in.close(); } packager.packAdded(i - 1, packageBytes); // Write out information about parsable files objOut.writeInt(pack.parsables.size()); iter2 = pack.parsables.iterator(); while (iter2.hasNext()) objOut.writeObject(iter2.next()); // Write out information about executable files objOut.writeInt(pack.executables.size()); iter2 = pack.executables.iterator(); while (iter2.hasNext()) { objOut.writeObject(iter2.next()); } // Cleanup objOut.flush(); zipOut.closeEntry(); } // We ask the packager to finish packager.finish(); }
public void executeCompiler() throws Exception { // Usefull variables int i; String str; InputStream inStream; // We get the XML data tree XMLElement data = getXMLTree(); // We get the Packager Packager packager = getPackager(); // We add the variable declaration packager.setVariables(getVariables(data)); // We add the info packager.setInfo(getInfo(data)); // We add the GUIPrefs packager.setGUIPrefs(getGUIPrefs(data)); // We add the language packs ArrayList langpacks = getLangpacksCodes(data); Iterator iter = langpacks.iterator(); while (iter.hasNext()) { str = (String) iter.next(); // The language pack inStream = new FileInputStream(Compiler.IZPACK_HOME + "bin" + File.separator + "langpacks" + File.separator + "installer" + File.separator + str + ".xml"); packager.addLangPack(str, inStream); // The flag inStream = new FileInputStream(Compiler.IZPACK_HOME + "bin" + File.separator + "langpacks" + File.separator + "flags" + File.separator + str + ".gif"); packager.addResource("flag." + str, inStream); } // We add the resources ArrayList resources = getResources(data); iter = resources.iterator(); while (iter.hasNext()) { Resource res = (Resource) iter.next(); if (res.parse) { if (null != varMap) { File resFile = new File(res.src); FileInputStream inFile = new FileInputStream(resFile); BufferedInputStream bin = new BufferedInputStream(inFile, 5120); File parsedFile = File.createTempFile("izpp", null, resFile.getParentFile()); FileOutputStream outFile = new FileOutputStream(parsedFile); BufferedOutputStream bout = new BufferedOutputStream(outFile, 5120); VariableSubstitutor vs = new VariableSubstitutor(varMap); vs.substitute(bin, bout, res.type, res.encoding); bin.close(); bout.close(); inFile = new FileInputStream(parsedFile); packager.addResource(res.id, inFile); inFile.close(); parsedFile.delete(); } else { System.err.println("ERROR: no variable is defined. " + res.src + " is not parsed."); inStream = new FileInputStream(res.src); packager.addResource(res.id, inStream); } } else { inStream = new FileInputStream(res.src); packager.addResource(res.id, inStream); } } // We add the native libraries ArrayList natives = getNativeLibraries(data); iter = natives.iterator(); while (iter.hasNext()) { NativeLibrary nat = (NativeLibrary) iter.next(); inStream = new FileInputStream(nat.path); packager.addNativeLibrary(nat.name, inStream); } // We add the additionnal jar files content ArrayList jars = getJars(data); iter = jars.iterator(); while (iter.hasNext()) packager.addJarContent((String) iter.next()); // We add the panels ArrayList panels = getPanels(data); ArrayList panelsOrder = new ArrayList(panels.size()); TreeSet panelsCache = new TreeSet(); iter = panels.iterator(); while (iter.hasNext()) { // We locate the panel classes directory str = (String) iter.next(); File dir = new File(Compiler.IZPACK_HOME + "bin" + File.separator + "panels" + File.separator + str); if (!dir.exists()) throw new Exception(str + " panel does not exist"); // We add the panel in the order array panelsOrder.add(str); // We add each file in the panel folder if (panelsCache.contains(str)) continue; panelsCache.add(str); File[] files = dir.listFiles(); int nf = files.length; for (int j = 0; j < nf; j++) { if (files[j].isDirectory()) continue; FileInputStream inClass = new FileInputStream(files[j]); packager.addPanelClass(files[j].getName(), inClass); } } // We set the panels order packager.setPanelsOrder(panelsOrder); // We add the packs i = 0; ArrayList packs = getPacks(data); iter = packs.iterator(); while (iter.hasNext()) { Pack pack = (Pack) iter.next(); ZipOutputStream zipOut = packager.addPack(i++, pack.name, pack.os, pack.required, pack.description); ObjectOutputStream objOut = new ObjectOutputStream(zipOut); // We write the pack data objOut.writeInt(pack.packFiles.size()); Iterator iter2 = pack.packFiles.iterator(); long packageBytes = 0; while (iter2.hasNext()) { // Initialisations PackSource p = (PackSource) iter2.next(); File f = new File(p.src); FileInputStream in = new FileInputStream(f); long nbytes = f.length(); String targetFilename = p.targetdir + "/" + f.getName(); // Writing objOut.writeObject(new PackFile(targetFilename, p.os, nbytes, p.override)); byte[] buffer = new byte[5120]; long bytesWritten = 0; int bytesInBuffer; while ((bytesInBuffer = in.read(buffer)) != -1) { objOut.write(buffer, 0, bytesInBuffer); bytesWritten += bytesInBuffer; } if (bytesWritten != nbytes) throw new IOException ("File size mismatch when reading " + f); packageBytes += bytesWritten; in.close(); } packager.packAdded(i - 1, packageBytes); // Write out information about parsable files objOut.writeInt(pack.parsables.size()); iter2 = pack.parsables.iterator(); while (iter2.hasNext()) objOut.writeObject(iter2.next()); // Write out information about executable files objOut.writeInt(pack.executables.size()); iter2 = pack.executables.iterator(); while (iter2.hasNext()) { objOut.writeObject(iter2.next()); } // Cleanup objOut.flush(); zipOut.closeEntry(); } // We ask the packager to finish packager.finish(); }
3,239,748
protected ArrayList getPacks(XMLElement data) throws Exception { // Initialisation ArrayList packs = new ArrayList(); XMLElement root = data.getFirstChildNamed("packs"); // We process each pack markup int npacks = root.getChildrenCount(); for (int i = 0; i < npacks; i++) { XMLElement el = root.getChildAtIndex(i); // Trivial initialisations Pack pack = new Pack(); pack.number = i; pack.name = el.getAttribute("name"); pack.required = el.getAttribute("required").equalsIgnoreCase("yes"); pack.description = el.getFirstChildNamed("description").getContent(); // We get the parsables list Iterator iter = null; Vector children = el.getChildrenNamed("parsable"); if (null != children && !children.isEmpty()) { iter = children.iterator(); while (iter.hasNext()) { XMLElement p = (XMLElement) iter.next(); pack.parsables.add (new ParsableFile(p.getAttribute("targetfile"), p.getAttribute("type", "plain"), p.getAttribute("encoding", null))); } } // We get the executables list children = el.getChildrenNamed("executable"); if (null != children && !children.isEmpty()) { iter = children.iterator(); while (iter.hasNext()) { XMLElement e = (XMLElement) iter.next(); // when to execute this executable int executeOn = ExecutableFile.NEVER; String val = e.getAttribute("stage", "never"); if ("postinstall".compareToIgnoreCase(val) == 0) executeOn = ExecutableFile.POSTINSTALL; else if ("uninstall".compareToIgnoreCase(val) == 0) executeOn = ExecutableFile.UNINSTALL; // main class of this executable String executeClass = e.getAttribute("class"); // type of this executable int executeType = ExecutableFile.BIN; val = e.getAttribute("type", "bin"); if ("jar".compareToIgnoreCase(val) == 0) executeType = ExecutableFile.JAR; // what to do if execution fails int onFailure = ExecutableFile.ASK; val = e.getAttribute("failure", "ask"); if ("abort".compareToIgnoreCase(val) == 0) onFailure = ExecutableFile.ABORT; else if ("warn".compareToIgnoreCase(val) == 0) onFailure = ExecutableFile.WARN; // get arguments for this executable ArrayList argList = new ArrayList(); XMLElement args = e.getFirstChildNamed("args"); if (null != args) { argList = new ArrayList(); Iterator argIterator = args.getChildrenNamed("arg").iterator(); while (argIterator.hasNext()) { XMLElement arg = (XMLElement) argIterator.next(); argList.add(arg.getAttribute("value")); } } // get os info on this executable ArrayList osList = new ArrayList(); Iterator osIterator = e.getChildrenNamed("os").iterator(); while (osIterator.hasNext()) { XMLElement os = (XMLElement) osIterator.next(); osList.add (new com.izforge.izpack.util.Os(os.getAttribute("family", null), os.getAttribute("name", null), os.getAttribute("version", null), os.getAttribute("arch", null))); } pack.executables.add(new ExecutableFile(e.getAttribute("targetfile"), executeType, executeClass, executeOn, onFailure, argList, osList)); } } // We get the files list iter = el.getChildrenNamed("file").iterator(); while (iter.hasNext()) { XMLElement f = (XMLElement) iter.next(); String path = basedir + File.separator + f.getAttribute("src"); File file = new File(path); boolean override = true; if (f.getAttribute("override") != null) override = f.getAttribute("override").equalsIgnoreCase("true"); addFile(file, f.getAttribute("targetdir"), f.getAttribute("os"), override, pack.packFiles); } // We get the fileset list iter = el.getChildrenNamed("fileset").iterator(); while (iter.hasNext()) { XMLElement f = (XMLElement) iter.next(); String path = basedir + File.separator + f.getAttribute("dir"); String casesensitive = f.getAttribute("casesensitive"); // get includes and excludes Vector xcludesList = f.getChildrenNamed("include"); String[] includes = null; XMLElement xclude = null; if (xcludesList.size() > 0) { includes = new String[xcludesList.size()]; for (int j = 0; j < xcludesList.size(); j++) { xclude = (XMLElement) xcludesList.get(j); includes[j] = xclude.getAttribute("name"); } } xcludesList = f.getChildrenNamed("exclude"); String[] excludes = null; xclude = null; if (xcludesList.size() > 0) { excludes = new String[xcludesList.size()]; for (int j = 0; j < xcludesList.size(); j++) { xclude = (XMLElement) xcludesList.get(j); excludes[j] = xclude.getAttribute("name"); } } addFileSet(path, includes, excludes, f.getAttribute("targetdir"), f.getAttribute("os"), pack.packFiles, casesensitive); } // We add the pack packs.add(pack); } // We return the ArrayList return packs; }
protected ArrayList getPacks(XMLElement data) throws Exception { // Initialisation ArrayList packs = new ArrayList(); XMLElement root = data.getFirstChildNamed("packs"); // We process each pack markup int npacks = root.getChildrenCount(); for (int i = 0; i < npacks; i++) { XMLElement el = root.getChildAtIndex(i); // Trivial initialisations Pack pack = new Pack(); pack.number = i; pack.name = el.getAttribute("name"); pack.required = el.getAttribute("required").equalsIgnoreCase("yes"); pack.description = el.getFirstChildNamed("description").getContent(); // We get the parsables list Iterator iter = null; Vector children = el.getChildrenNamed("parsable"); if (null != children && !children.isEmpty()) { iter = children.iterator(); while (iter.hasNext()) { XMLElement p = (XMLElement) iter.next(); pack.parsables.add (new ParsableFile(targetFile, p.getAttribute("type", "plain"), p.getAttribute("encoding", null))); } } // We get the executables list children = el.getChildrenNamed("executable"); if (null != children && !children.isEmpty()) { iter = children.iterator(); while (iter.hasNext()) { XMLElement e = (XMLElement) iter.next(); // when to execute this executable int executeOn = ExecutableFile.NEVER; String val = e.getAttribute("stage", "never"); if ("postinstall".compareToIgnoreCase(val) == 0) executeOn = ExecutableFile.POSTINSTALL; else if ("uninstall".compareToIgnoreCase(val) == 0) executeOn = ExecutableFile.UNINSTALL; // main class of this executable String executeClass = e.getAttribute("class"); // type of this executable int executeType = ExecutableFile.BIN; val = e.getAttribute("type", "bin"); if ("jar".compareToIgnoreCase(val) == 0) executeType = ExecutableFile.JAR; // what to do if execution fails int onFailure = ExecutableFile.ASK; val = e.getAttribute("failure", "ask"); if ("abort".compareToIgnoreCase(val) == 0) onFailure = ExecutableFile.ABORT; else if ("warn".compareToIgnoreCase(val) == 0) onFailure = ExecutableFile.WARN; // get arguments for this executable ArrayList argList = new ArrayList(); XMLElement args = e.getFirstChildNamed("args"); if (null != args) { argList = new ArrayList(); Iterator argIterator = args.getChildrenNamed("arg").iterator(); while (argIterator.hasNext()) { XMLElement arg = (XMLElement) argIterator.next(); argList.add(arg.getAttribute("value")); } } // get os info on this executable ArrayList osList = new ArrayList(); Iterator osIterator = e.getChildrenNamed("os").iterator(); while (osIterator.hasNext()) { XMLElement os = (XMLElement) osIterator.next(); osList.add (new com.izforge.izpack.util.Os(os.getAttribute("family", null), os.getAttribute("name", null), os.getAttribute("version", null), os.getAttribute("arch", null))); } pack.executables.add(new ExecutableFile(e.getAttribute("targetfile"), executeType, executeClass, executeOn, onFailure, argList, osList)); } } // We get the files list iter = el.getChildrenNamed("file").iterator(); while (iter.hasNext()) { XMLElement f = (XMLElement) iter.next(); String path = basedir + File.separator + f.getAttribute("src"); File file = new File(path); boolean override = true; if (f.getAttribute("override") != null) override = f.getAttribute("override").equalsIgnoreCase("true"); addFile(file, f.getAttribute("targetdir"), f.getAttribute("os"), override, pack.packFiles); } // We get the fileset list iter = el.getChildrenNamed("fileset").iterator(); while (iter.hasNext()) { XMLElement f = (XMLElement) iter.next(); String path = basedir + File.separator + f.getAttribute("dir"); String casesensitive = f.getAttribute("casesensitive"); // get includes and excludes Vector xcludesList = f.getChildrenNamed("include"); String[] includes = null; XMLElement xclude = null; if (xcludesList.size() > 0) { includes = new String[xcludesList.size()]; for (int j = 0; j < xcludesList.size(); j++) { xclude = (XMLElement) xcludesList.get(j); includes[j] = xclude.getAttribute("name"); } } xcludesList = f.getChildrenNamed("exclude"); String[] excludes = null; xclude = null; if (xcludesList.size() > 0) { excludes = new String[xcludesList.size()]; for (int j = 0; j < xcludesList.size(); j++) { xclude = (XMLElement) xcludesList.get(j); excludes[j] = xclude.getAttribute("name"); } } addFileSet(path, includes, excludes, f.getAttribute("targetdir"), f.getAttribute("os"), pack.packFiles, casesensitive); } // We add the pack packs.add(pack); } // We return the ArrayList return packs; }
3,239,749
protected ArrayList getPacks(XMLElement data) throws Exception { // Initialisation ArrayList packs = new ArrayList(); XMLElement root = data.getFirstChildNamed("packs"); // We process each pack markup int npacks = root.getChildrenCount(); for (int i = 0; i < npacks; i++) { XMLElement el = root.getChildAtIndex(i); // Trivial initialisations Pack pack = new Pack(); pack.number = i; pack.name = el.getAttribute("name"); pack.required = el.getAttribute("required").equalsIgnoreCase("yes"); pack.description = el.getFirstChildNamed("description").getContent(); // We get the parsables list Iterator iter = null; Vector children = el.getChildrenNamed("parsable"); if (null != children && !children.isEmpty()) { iter = children.iterator(); while (iter.hasNext()) { XMLElement p = (XMLElement) iter.next(); pack.parsables.add (new ParsableFile(p.getAttribute("targetfile"), p.getAttribute("type", "plain"), p.getAttribute("encoding", null))); } } // We get the executables list children = el.getChildrenNamed("executable"); if (null != children && !children.isEmpty()) { iter = children.iterator(); while (iter.hasNext()) { XMLElement e = (XMLElement) iter.next(); // when to execute this executable int executeOn = ExecutableFile.NEVER; String val = e.getAttribute("stage", "never"); if ("postinstall".compareToIgnoreCase(val) == 0) executeOn = ExecutableFile.POSTINSTALL; else if ("uninstall".compareToIgnoreCase(val) == 0) executeOn = ExecutableFile.UNINSTALL; // main class of this executable String executeClass = e.getAttribute("class"); // type of this executable int executeType = ExecutableFile.BIN; val = e.getAttribute("type", "bin"); if ("jar".compareToIgnoreCase(val) == 0) executeType = ExecutableFile.JAR; // what to do if execution fails int onFailure = ExecutableFile.ASK; val = e.getAttribute("failure", "ask"); if ("abort".compareToIgnoreCase(val) == 0) onFailure = ExecutableFile.ABORT; else if ("warn".compareToIgnoreCase(val) == 0) onFailure = ExecutableFile.WARN; // get arguments for this executable ArrayList argList = new ArrayList(); XMLElement args = e.getFirstChildNamed("args"); if (null != args) { argList = new ArrayList(); Iterator argIterator = args.getChildrenNamed("arg").iterator(); while (argIterator.hasNext()) { XMLElement arg = (XMLElement) argIterator.next(); argList.add(arg.getAttribute("value")); } } // get os info on this executable ArrayList osList = new ArrayList(); Iterator osIterator = e.getChildrenNamed("os").iterator(); while (osIterator.hasNext()) { XMLElement os = (XMLElement) osIterator.next(); osList.add (new com.izforge.izpack.util.Os(os.getAttribute("family", null), os.getAttribute("name", null), os.getAttribute("version", null), os.getAttribute("arch", null))); } pack.executables.add(new ExecutableFile(e.getAttribute("targetfile"), executeType, executeClass, executeOn, onFailure, argList, osList)); } } // We get the files list iter = el.getChildrenNamed("file").iterator(); while (iter.hasNext()) { XMLElement f = (XMLElement) iter.next(); String path = basedir + File.separator + f.getAttribute("src"); File file = new File(path); boolean override = true; if (f.getAttribute("override") != null) override = f.getAttribute("override").equalsIgnoreCase("true"); addFile(file, f.getAttribute("targetdir"), f.getAttribute("os"), override, pack.packFiles); } // We get the fileset list iter = el.getChildrenNamed("fileset").iterator(); while (iter.hasNext()) { XMLElement f = (XMLElement) iter.next(); String path = basedir + File.separator + f.getAttribute("dir"); String casesensitive = f.getAttribute("casesensitive"); // get includes and excludes Vector xcludesList = f.getChildrenNamed("include"); String[] includes = null; XMLElement xclude = null; if (xcludesList.size() > 0) { includes = new String[xcludesList.size()]; for (int j = 0; j < xcludesList.size(); j++) { xclude = (XMLElement) xcludesList.get(j); includes[j] = xclude.getAttribute("name"); } } xcludesList = f.getChildrenNamed("exclude"); String[] excludes = null; xclude = null; if (xcludesList.size() > 0) { excludes = new String[xcludesList.size()]; for (int j = 0; j < xcludesList.size(); j++) { xclude = (XMLElement) xcludesList.get(j); excludes[j] = xclude.getAttribute("name"); } } addFileSet(path, includes, excludes, f.getAttribute("targetdir"), f.getAttribute("os"), pack.packFiles, casesensitive); } // We add the pack packs.add(pack); } // We return the ArrayList return packs; }
protected ArrayList getPacks(XMLElement data) throws Exception { // Initialisation ArrayList packs = new ArrayList(); XMLElement root = data.getFirstChildNamed("packs"); // We process each pack markup int npacks = root.getChildrenCount(); for (int i = 0; i < npacks; i++) { XMLElement el = root.getChildAtIndex(i); // Trivial initialisations Pack pack = new Pack(); pack.number = i; pack.name = el.getAttribute("name"); pack.required = el.getAttribute("required").equalsIgnoreCase("yes"); pack.description = el.getFirstChildNamed("description").getContent(); // We get the parsables list Iterator iter = null; Vector children = el.getChildrenNamed("parsable"); if (null != children && !children.isEmpty()) { iter = children.iterator(); while (iter.hasNext()) { XMLElement p = (XMLElement) iter.next(); pack.parsables.add (new ParsableFile(p.getAttribute("targetfile"), p.getAttribute("type", "plain"), p.getAttribute("encoding", null))); } } // We get the executables list children = el.getChildrenNamed("executable"); if (null != children && !children.isEmpty()) { iter = children.iterator(); while (iter.hasNext()) { XMLElement e = (XMLElement) iter.next(); // when to execute this executable int executeOn = ExecutableFile.NEVER; String val = e.getAttribute("stage", "never"); if ("postinstall".compareToIgnoreCase(val) == 0) executeOn = ExecutableFile.POSTINSTALL; else if ("uninstall".compareToIgnoreCase(val) == 0) executeOn = ExecutableFile.UNINSTALL; // main class of this executable String executeClass = e.getAttribute("class"); // type of this executable int executeType = ExecutableFile.BIN; val = e.getAttribute("type", "bin"); if ("jar".compareToIgnoreCase(val) == 0) executeType = ExecutableFile.JAR; // what to do if execution fails int onFailure = ExecutableFile.ASK; val = e.getAttribute("failure", "ask"); if ("abort".compareToIgnoreCase(val) == 0) onFailure = ExecutableFile.ABORT; else if ("warn".compareToIgnoreCase(val) == 0) onFailure = ExecutableFile.WARN; // get arguments for this executable ArrayList argList = new ArrayList(); XMLElement args = e.getFirstChildNamed("args"); if (null != args) { argList = new ArrayList(); Iterator argIterator = args.getChildrenNamed("arg").iterator(); while (argIterator.hasNext()) { XMLElement arg = (XMLElement) argIterator.next(); argList.add(arg.getAttribute("value")); } } // get os info on this executable ArrayList osList = new ArrayList(); Iterator osIterator = e.getChildrenNamed("os").iterator(); while (osIterator.hasNext()) { XMLElement os = (XMLElement) osIterator.next(); osList.add (new com.izforge.izpack.util.Os(os.getAttribute("family", null), os.getAttribute("name", null), os.getAttribute("version", null), os.getAttribute("arch", null))); } String targetFile = e.getAttribute("targetfile"); pack.executables.add(new ExecutableFile(targetFile, executeType, executeClass, executeOn, onFailure, argList, osList)); } } // We get the files list iter = el.getChildrenNamed("file").iterator(); while (iter.hasNext()) { XMLElement f = (XMLElement) iter.next(); String path = basedir + File.separator + f.getAttribute("src"); File file = new File(path); boolean override = true; if (f.getAttribute("override") != null) override = f.getAttribute("override").equalsIgnoreCase("true"); addFile(file, f.getAttribute("targetdir"), f.getAttribute("os"), override, pack.packFiles); } // We get the fileset list iter = el.getChildrenNamed("fileset").iterator(); while (iter.hasNext()) { XMLElement f = (XMLElement) iter.next(); String path = basedir + File.separator + f.getAttribute("dir"); String casesensitive = f.getAttribute("casesensitive"); // get includes and excludes Vector xcludesList = f.getChildrenNamed("include"); String[] includes = null; XMLElement xclude = null; if (xcludesList.size() > 0) { includes = new String[xcludesList.size()]; for (int j = 0; j < xcludesList.size(); j++) { xclude = (XMLElement) xcludesList.get(j); includes[j] = xclude.getAttribute("name"); } } xcludesList = f.getChildrenNamed("exclude"); String[] excludes = null; xclude = null; if (xcludesList.size() > 0) { excludes = new String[xcludesList.size()]; for (int j = 0; j < xcludesList.size(); j++) { xclude = (XMLElement) xcludesList.get(j); excludes[j] = xclude.getAttribute("name"); } } addFileSet(path, includes, excludes, f.getAttribute("targetdir"), f.getAttribute("os"), pack.packFiles, casesensitive); } // We add the pack packs.add(pack); } // We return the ArrayList return packs; }
3,239,750
protected ArrayList getPacks(XMLElement data) throws Exception { // Initialisation ArrayList packs = new ArrayList(); XMLElement root = data.getFirstChildNamed("packs"); // We process each pack markup int npacks = root.getChildrenCount(); for (int i = 0; i < npacks; i++) { XMLElement el = root.getChildAtIndex(i); // Trivial initialisations Pack pack = new Pack(); pack.number = i; pack.name = el.getAttribute("name"); pack.required = el.getAttribute("required").equalsIgnoreCase("yes"); pack.description = el.getFirstChildNamed("description").getContent(); // We get the parsables list Iterator iter = null; Vector children = el.getChildrenNamed("parsable"); if (null != children && !children.isEmpty()) { iter = children.iterator(); while (iter.hasNext()) { XMLElement p = (XMLElement) iter.next(); pack.parsables.add (new ParsableFile(p.getAttribute("targetfile"), p.getAttribute("type", "plain"), p.getAttribute("encoding", null))); } } // We get the executables list children = el.getChildrenNamed("executable"); if (null != children && !children.isEmpty()) { iter = children.iterator(); while (iter.hasNext()) { XMLElement e = (XMLElement) iter.next(); // when to execute this executable int executeOn = ExecutableFile.NEVER; String val = e.getAttribute("stage", "never"); if ("postinstall".compareToIgnoreCase(val) == 0) executeOn = ExecutableFile.POSTINSTALL; else if ("uninstall".compareToIgnoreCase(val) == 0) executeOn = ExecutableFile.UNINSTALL; // main class of this executable String executeClass = e.getAttribute("class"); // type of this executable int executeType = ExecutableFile.BIN; val = e.getAttribute("type", "bin"); if ("jar".compareToIgnoreCase(val) == 0) executeType = ExecutableFile.JAR; // what to do if execution fails int onFailure = ExecutableFile.ASK; val = e.getAttribute("failure", "ask"); if ("abort".compareToIgnoreCase(val) == 0) onFailure = ExecutableFile.ABORT; else if ("warn".compareToIgnoreCase(val) == 0) onFailure = ExecutableFile.WARN; // get arguments for this executable ArrayList argList = new ArrayList(); XMLElement args = e.getFirstChildNamed("args"); if (null != args) { argList = new ArrayList(); Iterator argIterator = args.getChildrenNamed("arg").iterator(); while (argIterator.hasNext()) { XMLElement arg = (XMLElement) argIterator.next(); argList.add(arg.getAttribute("value")); } } // get os info on this executable ArrayList osList = new ArrayList(); Iterator osIterator = e.getChildrenNamed("os").iterator(); while (osIterator.hasNext()) { XMLElement os = (XMLElement) osIterator.next(); osList.add (new com.izforge.izpack.util.Os(os.getAttribute("family", null), os.getAttribute("name", null), os.getAttribute("version", null), os.getAttribute("arch", null))); } pack.executables.add(new ExecutableFile(e.getAttribute("targetfile"), executeType, executeClass, executeOn, onFailure, argList, osList)); } } // We get the files list iter = el.getChildrenNamed("file").iterator(); while (iter.hasNext()) { XMLElement f = (XMLElement) iter.next(); String path = basedir + File.separator + f.getAttribute("src"); File file = new File(path); boolean override = true; if (f.getAttribute("override") != null) override = f.getAttribute("override").equalsIgnoreCase("true"); addFile(file, f.getAttribute("targetdir"), f.getAttribute("os"), override, pack.packFiles); } // We get the fileset list iter = el.getChildrenNamed("fileset").iterator(); while (iter.hasNext()) { XMLElement f = (XMLElement) iter.next(); String path = basedir + File.separator + f.getAttribute("dir"); String casesensitive = f.getAttribute("casesensitive"); // get includes and excludes Vector xcludesList = f.getChildrenNamed("include"); String[] includes = null; XMLElement xclude = null; if (xcludesList.size() > 0) { includes = new String[xcludesList.size()]; for (int j = 0; j < xcludesList.size(); j++) { xclude = (XMLElement) xcludesList.get(j); includes[j] = xclude.getAttribute("name"); } } xcludesList = f.getChildrenNamed("exclude"); String[] excludes = null; xclude = null; if (xcludesList.size() > 0) { excludes = new String[xcludesList.size()]; for (int j = 0; j < xcludesList.size(); j++) { xclude = (XMLElement) xcludesList.get(j); excludes[j] = xclude.getAttribute("name"); } } addFileSet(path, includes, excludes, f.getAttribute("targetdir"), f.getAttribute("os"), pack.packFiles, casesensitive); } // We add the pack packs.add(pack); } // We return the ArrayList return packs; }
protected ArrayList getPacks(XMLElement data) throws Exception { // Initialisation ArrayList packs = new ArrayList(); XMLElement root = data.getFirstChildNamed("packs"); // We process each pack markup int npacks = root.getChildrenCount(); for (int i = 0; i < npacks; i++) { XMLElement el = root.getChildAtIndex(i); // Trivial initialisations Pack pack = new Pack(); pack.number = i; pack.name = el.getAttribute("name"); pack.required = el.getAttribute("required").equalsIgnoreCase("yes"); pack.description = el.getFirstChildNamed("description").getContent(); // We get the parsables list Iterator iter = null; Vector children = el.getChildrenNamed("parsable"); if (null != children && !children.isEmpty()) { iter = children.iterator(); while (iter.hasNext()) { XMLElement p = (XMLElement) iter.next(); pack.parsables.add (new ParsableFile(p.getAttribute("targetfile"), p.getAttribute("type", "plain"), p.getAttribute("encoding", null))); } } // We get the executables list children = el.getChildrenNamed("executable"); if (null != children && !children.isEmpty()) { iter = children.iterator(); while (iter.hasNext()) { XMLElement e = (XMLElement) iter.next(); // when to execute this executable int executeOn = ExecutableFile.NEVER; String val = e.getAttribute("stage", "never"); if ("postinstall".compareToIgnoreCase(val) == 0) executeOn = ExecutableFile.POSTINSTALL; else if ("uninstall".compareToIgnoreCase(val) == 0) executeOn = ExecutableFile.UNINSTALL; // main class of this executable String executeClass = e.getAttribute("class"); // type of this executable int executeType = ExecutableFile.BIN; val = e.getAttribute("type", "bin"); if ("jar".compareToIgnoreCase(val) == 0) executeType = ExecutableFile.JAR; // what to do if execution fails int onFailure = ExecutableFile.ASK; val = e.getAttribute("failure", "ask"); if ("abort".compareToIgnoreCase(val) == 0) onFailure = ExecutableFile.ABORT; else if ("warn".compareToIgnoreCase(val) == 0) onFailure = ExecutableFile.WARN; // get arguments for this executable ArrayList argList = new ArrayList(); XMLElement args = e.getFirstChildNamed("args"); if (null != args) { argList = new ArrayList(); Iterator argIterator = args.getChildrenNamed("arg").iterator(); while (argIterator.hasNext()) { XMLElement arg = (XMLElement) argIterator.next(); argList.add(arg.getAttribute("value")); } } // get os info on this executable ArrayList osList = new ArrayList(); Iterator osIterator = e.getChildrenNamed("os").iterator(); while (osIterator.hasNext()) { XMLElement os = (XMLElement) osIterator.next(); osList.add (new com.izforge.izpack.util.Os(os.getAttribute("family", null), os.getAttribute("name", null), os.getAttribute("version", null), os.getAttribute("arch", null))); } pack.executables.add(new ExecutableFile(e.getAttribute("targetfile"), executeType, executeClass, executeOn, onFailure, argList, osList)); } } // We get the files list iter = el.getChildrenNamed("file").iterator(); while (iter.hasNext()) { XMLElement f = (XMLElement) iter.next(); String path = basedir + File.separator + f.getAttribute("src"); File file = new File(path); boolean override = true; if (f.getAttribute("override") != null) override = f.getAttribute("override").equalsIgnoreCase("true"); addFile(file, targetDir, f.getAttribute("os"), override, pack.packFiles); } // We get the fileset list iter = el.getChildrenNamed("fileset").iterator(); while (iter.hasNext()) { XMLElement f = (XMLElement) iter.next(); String path = basedir + File.separator + f.getAttribute("dir"); String casesensitive = f.getAttribute("casesensitive"); // get includes and excludes Vector xcludesList = f.getChildrenNamed("include"); String[] includes = null; XMLElement xclude = null; if (xcludesList.size() > 0) { includes = new String[xcludesList.size()]; for (int j = 0; j < xcludesList.size(); j++) { xclude = (XMLElement) xcludesList.get(j); includes[j] = xclude.getAttribute("name"); } } xcludesList = f.getChildrenNamed("exclude"); String[] excludes = null; xclude = null; if (xcludesList.size() > 0) { excludes = new String[xcludesList.size()]; for (int j = 0; j < xcludesList.size(); j++) { xclude = (XMLElement) xcludesList.get(j); excludes[j] = xclude.getAttribute("name"); } } addFileSet(path, includes, excludes, targetDir, f.getAttribute("os"), pack.packFiles, casesensitive); } // We add the pack packs.add(pack); } // We return the ArrayList return packs; }
3,239,751
public Info() { }
public Info() { }
3,239,753
public StdKunststoffPackager(String outputFilename, PackagerListener plistener) throws Exception { super(outputFilename, plistener); // Copies the Kunststoff library sendMsg("Copying the Kunststoff library ..."); ZipInputStream skeleton_is = new ZipInputStream (getClass().getResourceAsStream("/lib/kunststoff.jar")); if (skeleton_is == null) { skeleton_is = new JarInputStream (new FileInputStream ( Compiler.IZPACK_HOME + "lib" + File.separator + "kunststoff.jar")); } ZipEntry zentry; while ((zentry = skeleton_is.getNextEntry()) != null) { // ugly hack: may not add a directory twice, therefore add no directories if (zentry.isDirectory()) continue; // Puts a new entry outJar.putNextEntry(new ZipEntry(zentry.getName())); // Copy the data copyStream(skeleton_is, outJar); outJar.closeEntry(); skeleton_is.closeEntry(); } }
public StdKunststoffPackager(String outputFilename, PackagerListener plistener) throws Exception { super(outputFilename, plistener); // Copies the Kunststoff library sendMsg("Copying the Kunststoff library ..."); ZipInputStream skeleton_is = new ZipInputStream (getClass().getResourceAsStream("/lib/kunststoff.jar")); if (skeleton_is == null) { skeleton_is = new JarInputStream (new FileInputStream ( Compiler.IZPACK_HOME + "lib" + File.separator + "kunststoff.jar")); } ZipEntry zentry; while ((zentry = skeleton_is.getNextEntry()) != null) { // ugly hack: may not add a directory twice, therefore add no directories if (zentry.isDirectory()) continue; // Puts a new entry outJar.putNextEntry(new ZipEntry(zentry.getName())); // Copy the data copyStream(skeleton_is, outJar); outJar.closeEntry(); skeleton_is.closeEntry(); } }
3,239,754
public ParsableFile(String path, String type, String encoding) { this.path = path; this.type = type; this.encoding = encoding; }
public ParsableFile(String path, String type, String encoding) { this.path = path; this.type = type; this.encoding = encoding; }
3,239,755
public ExecutableFile(String path, int type, String mainClass, int executionStage, int onFailure, java.util.ArrayList argList, java.util.ArrayList osList) { this.path = path; this.mainClass = mainClass; this.type = type; this.executionStage = executionStage; this.onFailure = onFailure; this.argList = argList; this.osList = osList; }
public ExecutableFile(String path, int type, String mainClass, int executionStage, int onFailure, java.util.ArrayList argList, java.util.ArrayList osList) { this.path = path; this.mainClass = mainClass; this.type = type; this.executionStage = executionStage; this.onFailure = onFailure; this.argList = argList; this.osList = osList; }
3,239,756
public ExecutableFile(String path, int type, String mainClass, int executionStage, int onFailure, java.util.ArrayList argList, java.util.ArrayList osList) { this.path = path; this.mainClass = mainClass; this.type = type; this.executionStage = executionStage; this.onFailure = onFailure; this.argList = argList; this.osList = osList; }
public ExecutableFile(String path, int type, String mainClass, int executionStage, int onFailure, java.util.ArrayList argList, java.util.ArrayList osList) { this.path = path; this.mainClass = mainClass; this.type = type; this.executionStage = executionStage; this.onFailure = onFailure; this.argList = argList; this.osList = osList; }
3,239,757
public synchronized Object borrowObject(Object key) throws Exception { long starttime = System.currentTimeMillis(); boolean newlyCreated = false; for(;;) { CursorableLinkedList pool = (CursorableLinkedList)(_poolMap.get(key)); if(null == pool) { pool = new CursorableLinkedList(); _poolMap.put(key,pool); _poolList.add(key); } ObjectTimestampPair pair = null; // if there are any sleeping, just grab one of those try { pair = (ObjectTimestampPair)(pool.removeFirst()); if(null != pair) { _totalIdle--; } } catch(NoSuchElementException e) { /* ignored */ } // otherwise if(null == pair) { // if there is a totalMaxActive and we are at the limit then // we have to make room if ((_maxTotal > 0) && (_totalActive + _totalIdle >= _maxTotal)) { clearOldest(); } // check if we can create one // (note we know that the num sleeping is 0, else we wouldn't be here) int active = getActiveCount(key); if ((_maxActive <= 0 || active < _maxActive) && (_maxTotal <= 0 || _totalActive + _totalIdle < _maxTotal)) { Object obj = _factory.makeObject(key); pair = new ObjectTimestampPair(obj); newlyCreated = true; } else { // the pool is exhausted switch(_whenExhaustedAction) { case WHEN_EXHAUSTED_GROW: Object obj = _factory.makeObject(key); pair = new ObjectTimestampPair(obj); break; case WHEN_EXHAUSTED_FAIL: throw new NoSuchElementException(); case WHEN_EXHAUSTED_BLOCK: try { if(_maxWait <= 0) { wait(); } else { wait(_maxWait); } } catch(InterruptedException e) { // ignored } if(_maxWait > 0 && ((System.currentTimeMillis() - starttime) >= _maxWait)) { throw new NoSuchElementException("Timeout waiting for idle object"); } else { continue; // keep looping } default: throw new IllegalArgumentException("whenExhaustedAction " + _whenExhaustedAction + " not recognized."); } } } _factory.activateObject(key,pair.value); if(_testOnBorrow && !_factory.validateObject(key,pair.value)) { _factory.destroyObject(key,pair.value); if(newlyCreated) { throw new NoSuchElementException("Could not create a validated object"); } // else keep looping } else { incrementActiveCount(key); return pair.value; } } }
public synchronized Object borrowObject(Object key) throws Exception { long starttime = System.currentTimeMillis(); boolean newlyCreated = false; for(;;) { CursorableLinkedList pool = (CursorableLinkedList)(_poolMap.get(key)); if(null == pool) { pool = new CursorableLinkedList(); _poolMap.put(key,pool); _poolList.add(key); } ObjectTimestampPair pair = null; // if there are any sleeping, just grab one of those try { pair = (ObjectTimestampPair)(pool.removeFirst()); if(null != pair) { _totalIdle--; } } catch(NoSuchElementException e) { /* ignored */ } // otherwise if(null == pair) { // if there is a totalMaxActive and we are at the limit then // we have to make room if ((_maxTotal > 0) && (_totalActive + _totalIdle >= _maxTotal)) { clearOldest(); } // check if we can create one // (note we know that the num sleeping is 0, else we wouldn't be here) int active = getActiveCount(key); if ((_maxActive <= 0 || active < _maxActive) && (_maxTotal <= 0 || _totalActive + _totalIdle < _maxTotal)) { Object obj = _factory.makeObject(key); pair = new ObjectTimestampPair(obj); newlyCreated = true; } else { // the pool is exhausted switch(_whenExhaustedAction) { case WHEN_EXHAUSTED_GROW: Object obj = _factory.makeObject(key); pair = new ObjectTimestampPair(obj); break; case WHEN_EXHAUSTED_FAIL: throw new NoSuchElementException(); case WHEN_EXHAUSTED_BLOCK: try { if(_maxWait <= 0) { wait(); } else { wait(_maxWait); } } catch(InterruptedException e) { // ignored } if(_maxWait > 0 && ((System.currentTimeMillis() - starttime) >= _maxWait)) { throw new NoSuchElementException("Timeout waiting for idle object"); } else { continue; // keep looping } default: throw new IllegalArgumentException("whenExhaustedAction " + _whenExhaustedAction + " not recognized."); } } } _factory.activateObject(key,pair.value); if(_testOnBorrow && !_factory.validateObject(key,pair.value)) { _factory.destroyObject(key,pair.value); if(newlyCreated) { throw new NoSuchElementException("Could not create a validated object"); } // else keep looping } else { incrementActiveCount(key); return pair.value; } } }
3,239,759
public int getNumActive() throws UnsupportedOperationException { return -1; }
public int getNumActive(Object key) throws UnsupportedOperationException { return -1; }
3,239,760
public int getNumIdle() throws UnsupportedOperationException { return -1; }
public int getNumIdle(Object key) throws UnsupportedOperationException { return -1; }
3,239,761
public int askQuestion (String title, String question, int choices, int default_choice) { int jo_choices = 0; if (choices == AbstractUIHandler.CHOICES_YES_NO) jo_choices = JOptionPane.YES_NO_OPTION; else if (choices == AbstractUIHandler.CHOICES_YES_NO_CANCEL) jo_choices = JOptionPane.YES_NO_CANCEL_OPTION; int user_choice = JOptionPane.showConfirmDialog ( this, (Object)question, title, jo_choices, JOptionPane.QUESTION_MESSAGE); if (user_choice == JOptionPane.CANCEL_OPTION) return AbstractUIHandler.ANSWER_CANCEL; if (user_choice == JOptionPane.YES_OPTION) return AbstractUIHandler.ANSWER_YES; if (user_choice == JOptionPane.NO_OPTION) return AbstractUIHandler.ANSWER_NO; return default_choice; }
public int askQuestion(String title, String question, int choices) { int jo_choices = 0; if (choices == AbstractUIHandler.CHOICES_YES_NO) jo_choices = JOptionPane.YES_NO_OPTION; else if (choices == AbstractUIHandler.CHOICES_YES_NO_CANCEL) jo_choices = JOptionPane.YES_NO_CANCEL_OPTION; int user_choice = JOptionPane.showConfirmDialog ( this, (Object)question, title, jo_choices, JOptionPane.QUESTION_MESSAGE); if (user_choice == JOptionPane.CANCEL_OPTION) return AbstractUIHandler.ANSWER_CANCEL; if (user_choice == JOptionPane.YES_OPTION) return AbstractUIHandler.ANSWER_YES; if (user_choice == JOptionPane.NO_OPTION) return AbstractUIHandler.ANSWER_NO; return default_choice; }
3,239,763
public int askQuestion (String title, String question, int choices, int default_choice) { int jo_choices = 0; if (choices == AbstractUIHandler.CHOICES_YES_NO) jo_choices = JOptionPane.YES_NO_OPTION; else if (choices == AbstractUIHandler.CHOICES_YES_NO_CANCEL) jo_choices = JOptionPane.YES_NO_CANCEL_OPTION; int user_choice = JOptionPane.showConfirmDialog ( this, (Object)question, title, jo_choices, JOptionPane.QUESTION_MESSAGE); if (user_choice == JOptionPane.CANCEL_OPTION) return AbstractUIHandler.ANSWER_CANCEL; if (user_choice == JOptionPane.YES_OPTION) return AbstractUIHandler.ANSWER_YES; if (user_choice == JOptionPane.NO_OPTION) return AbstractUIHandler.ANSWER_NO; return default_choice; }
public int askQuestion (String title, String question, int choices, int default_choice) { int jo_choices = 0; if (choices == AbstractUIHandler.CHOICES_YES_NO) jo_choices = JOptionPane.YES_NO_OPTION; else if (choices == AbstractUIHandler.CHOICES_YES_NO_CANCEL) jo_choices = JOptionPane.YES_NO_CANCEL_OPTION; int user_choice = JOptionPane.showConfirmDialog ( this, (Object)question, title, jo_choices, JOptionPane.QUESTION_MESSAGE); if (user_choice == JOptionPane.CANCEL_OPTION) return AbstractUIHandler.ANSWER_CANCEL; if (user_choice == JOptionPane.YES_OPTION) return AbstractUIHandler.ANSWER_YES; if (user_choice == JOptionPane.NO_OPTION) return AbstractUIHandler.ANSWER_NO; return default_choice; }
3,239,764
public IObject[] saveAndReturnArray(IObject[] graph) { return doAction( graph, new UpdateAction<IObject[]>(){ @Override public IObject[] run(IObject[] value, UpdateFilter filter) { IObject[] copy = new IObject[value.length]; for (int i = 0; i < value.length; i++) { copy[i] = internalSave( value[i], filter ); } return value; } }); }
public IObject[] saveAndReturnArray(IObject[] graph) { return doAction( graph, new UpdateAction<IObject[]>(){ @Override public IObject[] run(IObject[] value, UpdateFilter filter) { IObject[] copy = new IObject[value.length]; for (int i = 0; i < value.length; i++) { copy[i] = internalSave( value[i], filter ); } return copy; } }); }
3,239,765
public IObject[] run(IObject[] value, UpdateFilter filter) { IObject[] copy = new IObject[value.length]; for (int i = 0; i < value.length; i++) { copy[i] = internalSave( value[i], filter ); } return value; }
public IObject[] run(IObject[] value, UpdateFilter filter) { IObject[] copy = new IObject[value.length]; for (int i = 0; i < value.length; i++) { copy[i] = internalSave( value[i], filter ); } return copy; }
3,239,766
public void saveArray(IObject[] graph) { doAction( graph, new UpdateAction<IObject[]>(){ @Override public IObject[] run(IObject[] value, UpdateFilter filter) { IObject[] copy = new IObject[value.length]; for (int i = 0; i < value.length; i++) { copy[i] = internalSave( value[i], filter ); } return value; } }); }
public void saveArray(IObject[] graph) { doAction( graph, new UpdateAction<IObject[]>(){ @Override public IObject[] run(IObject[] value, UpdateFilter filter) { IObject[] copy = new IObject[value.length]; for (int i = 0; i < value.length; i++) { copy[i] = internalSave( value[i], filter ); } return copy; } }); }
3,239,767
public IObject[] run(IObject[] value, UpdateFilter filter) { IObject[] copy = new IObject[value.length]; for (int i = 0; i < value.length; i++) { copy[i] = internalSave( value[i], filter ); } return value; }
public IObject[] run(IObject[] value, UpdateFilter filter) { IObject[] copy = new IObject[value.length]; for (int i = 0; i < value.length; i++) { copy[i] = internalSave( value[i], filter ); } return copy; }
3,239,768
public void activateObject(Object obj) { }
public void activateObject(Object obj) throws Exception { }
3,239,769
public void destroyObject(Object obj) { }
public void destroyObject(Object obj) throws Exception { }
3,239,770
public void passivateObject(Object obj) { }
public void passivateObject(Object obj) throws Exception { }
3,239,771
private void stopMonitor(OutputMonitor m, Thread t) { // taken from com.izforge.izpack.util.FileExecutor m.doStop(); long softTimeout = 500; try { t.join(softTimeout); } catch (InterruptedException e) {} if (t.isAlive() == false) return; t.interrupt(); long hardTimeout = 500; try { t.join(hardTimeout); } catch (InterruptedException e) {} }
private void stopMonitor(OutputMonitor m, Thread t) { // taken from com.izforge.izpack.util.FileExecutor m.doStop(); long softTimeout = 500; try { t.join(softTimeout); } catch (InterruptedException e) {} if (!t.isAlive()) return; t.interrupt(); long hardTimeout = 500; try { t.join(hardTimeout); } catch (InterruptedException e) {} }
3,239,772
private boolean readSpec() throws IOException { InputStream input; try { input = ResourceManager.getInstance().getInputStream(SPEC_RESOURCE_NAME); } catch (Exception e) { e.printStackTrace(); return false; } StdXMLParser parser = new StdXMLParser(); parser.setBuilder(new StdXMLBuilder()); parser.setValidator(new NonValidator()); try { parser.setReader(new StdXMLReader(input)); this.spec = (XMLElement) parser.parse(); } catch (Exception e) { System.err.println("Error parsing XML specification for processing."); System.err.println(e.toString()); return false; } if (!this.spec.hasChildren()) return false; // Handle logfile XMLElement lfd = spec.getFirstChildNamed("logfiledir"); if (lfd != null) { logfiledir = lfd.getContent(); } for (Iterator job_it = this.spec.getChildrenNamed("job").iterator(); job_it.hasNext();) { XMLElement job_el = (XMLElement) job_it.next(); // ExecuteForPack Patch // Check if processing required for pack Vector forPacks = job_el.getChildrenNamed("executeForPack"); if (!jobRequiredFor(forPacks)) { continue; } // first check OS constraints - skip jobs not suited for this OS List constraints = OsConstraint.getOsList(job_el); if (OsConstraint.oneMatchesCurrentSystem(constraints)) { List ef_list = new ArrayList(); String job_name = job_el.getAttribute("name", ""); for (Iterator ef_it = job_el.getChildrenNamed("executefile").iterator(); ef_it .hasNext();) { XMLElement ef = (XMLElement) ef_it.next(); String ef_name = ef.getAttribute("name"); if ((ef_name == null) || (ef_name.length() == 0)) { System.err.println("missing \"name\" attribute for <executefile>"); return false; } List args = new ArrayList(); for (Iterator arg_it = ef.getChildrenNamed("arg").iterator(); arg_it.hasNext();) { XMLElement arg_el = (XMLElement) arg_it.next(); String arg_val = arg_el.getContent(); args.add(arg_val); } ef_list.add(new ExecutableFile(ef_name, args)); } for (Iterator ef_it = job_el.getChildrenNamed("executeclass").iterator(); ef_it .hasNext();) { XMLElement ef = (XMLElement) ef_it.next(); String ef_name = ef.getAttribute("name"); if ((ef_name == null) || (ef_name.length() == 0)) { System.err.println("missing \"name\" attribute for <executeclass>"); return false; } List args = new ArrayList(); for (Iterator arg_it = ef.getChildrenNamed("arg").iterator(); arg_it.hasNext();) { XMLElement arg_el = (XMLElement) arg_it.next(); String arg_val = arg_el.getContent(); args.add(arg_val); } ef_list.add(new ExecutableClass(ef_name, args)); } this.jobs.add(new ProcessingJob(job_name, ef_list)); } } return true; }
private boolean readSpec() throws IOException { InputStream input; try { input = ResourceManager.getInstance().getInputStream(SPEC_RESOURCE_NAME); } catch (Exception e) { e.printStackTrace(); return false; } StdXMLParser parser = new StdXMLParser(); parser.setBuilder(new StdXMLBuilder()); parser.setValidator(new NonValidator()); try { parser.setReader(new StdXMLReader(input)); spec = (XMLElement) parser.parse(); } catch (Exception e) { System.err.println("Error parsing XML specification for processing."); System.err.println(e.toString()); return false; } if (!this.spec.hasChildren()) return false; // Handle logfile XMLElement lfd = spec.getFirstChildNamed("logfiledir"); if (lfd != null) { logfiledir = lfd.getContent(); } for (Iterator job_it = this.spec.getChildrenNamed("job").iterator(); job_it.hasNext();) { XMLElement job_el = (XMLElement) job_it.next(); // ExecuteForPack Patch // Check if processing required for pack Vector forPacks = job_el.getChildrenNamed("executeForPack"); if (!jobRequiredFor(forPacks)) { continue; } // first check OS constraints - skip jobs not suited for this OS List constraints = OsConstraint.getOsList(job_el); if (OsConstraint.oneMatchesCurrentSystem(constraints)) { List ef_list = new ArrayList(); String job_name = job_el.getAttribute("name", ""); for (Iterator ef_it = job_el.getChildrenNamed("executefile").iterator(); ef_it .hasNext();) { XMLElement ef = (XMLElement) ef_it.next(); String ef_name = ef.getAttribute("name"); if ((ef_name == null) || (ef_name.length() == 0)) { System.err.println("missing \"name\" attribute for <executefile>"); return false; } List args = new ArrayList(); for (Iterator arg_it = ef.getChildrenNamed("arg").iterator(); arg_it.hasNext();) { XMLElement arg_el = (XMLElement) arg_it.next(); String arg_val = arg_el.getContent(); args.add(arg_val); } ef_list.add(new ExecutableFile(ef_name, args)); } for (Iterator ef_it = job_el.getChildrenNamed("executeclass").iterator(); ef_it .hasNext();) { XMLElement ef = (XMLElement) ef_it.next(); String ef_name = ef.getAttribute("name"); if ((ef_name == null) || (ef_name.length() == 0)) { System.err.println("missing \"name\" attribute for <executeclass>"); return false; } List args = new ArrayList(); for (Iterator arg_it = ef.getChildrenNamed("arg").iterator(); arg_it.hasNext();) { XMLElement arg_el = (XMLElement) arg_it.next(); String arg_val = arg_el.getContent(); args.add(arg_val); } ef_list.add(new ExecutableClass(ef_name, args)); } this.jobs.add(new ProcessingJob(job_name, ef_list)); } } return true; }
3,239,773
private boolean readSpec() throws IOException { InputStream input; try { input = ResourceManager.getInstance().getInputStream(SPEC_RESOURCE_NAME); } catch (Exception e) { e.printStackTrace(); return false; } StdXMLParser parser = new StdXMLParser(); parser.setBuilder(new StdXMLBuilder()); parser.setValidator(new NonValidator()); try { parser.setReader(new StdXMLReader(input)); this.spec = (XMLElement) parser.parse(); } catch (Exception e) { System.err.println("Error parsing XML specification for processing."); System.err.println(e.toString()); return false; } if (!this.spec.hasChildren()) return false; // Handle logfile XMLElement lfd = spec.getFirstChildNamed("logfiledir"); if (lfd != null) { logfiledir = lfd.getContent(); } for (Iterator job_it = this.spec.getChildrenNamed("job").iterator(); job_it.hasNext();) { XMLElement job_el = (XMLElement) job_it.next(); // ExecuteForPack Patch // Check if processing required for pack Vector forPacks = job_el.getChildrenNamed("executeForPack"); if (!jobRequiredFor(forPacks)) { continue; } // first check OS constraints - skip jobs not suited for this OS List constraints = OsConstraint.getOsList(job_el); if (OsConstraint.oneMatchesCurrentSystem(constraints)) { List ef_list = new ArrayList(); String job_name = job_el.getAttribute("name", ""); for (Iterator ef_it = job_el.getChildrenNamed("executefile").iterator(); ef_it .hasNext();) { XMLElement ef = (XMLElement) ef_it.next(); String ef_name = ef.getAttribute("name"); if ((ef_name == null) || (ef_name.length() == 0)) { System.err.println("missing \"name\" attribute for <executefile>"); return false; } List args = new ArrayList(); for (Iterator arg_it = ef.getChildrenNamed("arg").iterator(); arg_it.hasNext();) { XMLElement arg_el = (XMLElement) arg_it.next(); String arg_val = arg_el.getContent(); args.add(arg_val); } ef_list.add(new ExecutableFile(ef_name, args)); } for (Iterator ef_it = job_el.getChildrenNamed("executeclass").iterator(); ef_it .hasNext();) { XMLElement ef = (XMLElement) ef_it.next(); String ef_name = ef.getAttribute("name"); if ((ef_name == null) || (ef_name.length() == 0)) { System.err.println("missing \"name\" attribute for <executeclass>"); return false; } List args = new ArrayList(); for (Iterator arg_it = ef.getChildrenNamed("arg").iterator(); arg_it.hasNext();) { XMLElement arg_el = (XMLElement) arg_it.next(); String arg_val = arg_el.getContent(); args.add(arg_val); } ef_list.add(new ExecutableClass(ef_name, args)); } this.jobs.add(new ProcessingJob(job_name, ef_list)); } } return true; }
private boolean readSpec() throws IOException { InputStream input; try { input = ResourceManager.getInstance().getInputStream(SPEC_RESOURCE_NAME); } catch (Exception e) { e.printStackTrace(); return false; } StdXMLParser parser = new StdXMLParser(); parser.setBuilder(new StdXMLBuilder()); parser.setValidator(new NonValidator()); try { parser.setReader(new StdXMLReader(input)); this.spec = (XMLElement) parser.parse(); } catch (Exception e) { System.err.println("Error parsing XML specification for processing."); System.err.println(e.toString()); return false; } if (!spec.hasChildren()) return false; // Handle logfile XMLElement lfd = spec.getFirstChildNamed("logfiledir"); if (lfd != null) { logfiledir = lfd.getContent(); } for (Iterator job_it = this.spec.getChildrenNamed("job").iterator(); job_it.hasNext();) { XMLElement job_el = (XMLElement) job_it.next(); // ExecuteForPack Patch // Check if processing required for pack Vector forPacks = job_el.getChildrenNamed("executeForPack"); if (!jobRequiredFor(forPacks)) { continue; } // first check OS constraints - skip jobs not suited for this OS List constraints = OsConstraint.getOsList(job_el); if (OsConstraint.oneMatchesCurrentSystem(constraints)) { List ef_list = new ArrayList(); String job_name = job_el.getAttribute("name", ""); for (Iterator ef_it = job_el.getChildrenNamed("executefile").iterator(); ef_it .hasNext();) { XMLElement ef = (XMLElement) ef_it.next(); String ef_name = ef.getAttribute("name"); if ((ef_name == null) || (ef_name.length() == 0)) { System.err.println("missing \"name\" attribute for <executefile>"); return false; } List args = new ArrayList(); for (Iterator arg_it = ef.getChildrenNamed("arg").iterator(); arg_it.hasNext();) { XMLElement arg_el = (XMLElement) arg_it.next(); String arg_val = arg_el.getContent(); args.add(arg_val); } ef_list.add(new ExecutableFile(ef_name, args)); } for (Iterator ef_it = job_el.getChildrenNamed("executeclass").iterator(); ef_it .hasNext();) { XMLElement ef = (XMLElement) ef_it.next(); String ef_name = ef.getAttribute("name"); if ((ef_name == null) || (ef_name.length() == 0)) { System.err.println("missing \"name\" attribute for <executeclass>"); return false; } List args = new ArrayList(); for (Iterator arg_it = ef.getChildrenNamed("arg").iterator(); arg_it.hasNext();) { XMLElement arg_el = (XMLElement) arg_it.next(); String arg_val = arg_el.getContent(); args.add(arg_val); } ef_list.add(new ExecutableClass(ef_name, args)); } this.jobs.add(new ProcessingJob(job_name, ef_list)); } } return true; }
3,239,774
private boolean readSpec() throws IOException { InputStream input; try { input = ResourceManager.getInstance().getInputStream(SPEC_RESOURCE_NAME); } catch (Exception e) { e.printStackTrace(); return false; } StdXMLParser parser = new StdXMLParser(); parser.setBuilder(new StdXMLBuilder()); parser.setValidator(new NonValidator()); try { parser.setReader(new StdXMLReader(input)); this.spec = (XMLElement) parser.parse(); } catch (Exception e) { System.err.println("Error parsing XML specification for processing."); System.err.println(e.toString()); return false; } if (!this.spec.hasChildren()) return false; // Handle logfile XMLElement lfd = spec.getFirstChildNamed("logfiledir"); if (lfd != null) { logfiledir = lfd.getContent(); } for (Iterator job_it = this.spec.getChildrenNamed("job").iterator(); job_it.hasNext();) { XMLElement job_el = (XMLElement) job_it.next(); // ExecuteForPack Patch // Check if processing required for pack Vector forPacks = job_el.getChildrenNamed("executeForPack"); if (!jobRequiredFor(forPacks)) { continue; } // first check OS constraints - skip jobs not suited for this OS List constraints = OsConstraint.getOsList(job_el); if (OsConstraint.oneMatchesCurrentSystem(constraints)) { List ef_list = new ArrayList(); String job_name = job_el.getAttribute("name", ""); for (Iterator ef_it = job_el.getChildrenNamed("executefile").iterator(); ef_it .hasNext();) { XMLElement ef = (XMLElement) ef_it.next(); String ef_name = ef.getAttribute("name"); if ((ef_name == null) || (ef_name.length() == 0)) { System.err.println("missing \"name\" attribute for <executefile>"); return false; } List args = new ArrayList(); for (Iterator arg_it = ef.getChildrenNamed("arg").iterator(); arg_it.hasNext();) { XMLElement arg_el = (XMLElement) arg_it.next(); String arg_val = arg_el.getContent(); args.add(arg_val); } ef_list.add(new ExecutableFile(ef_name, args)); } for (Iterator ef_it = job_el.getChildrenNamed("executeclass").iterator(); ef_it .hasNext();) { XMLElement ef = (XMLElement) ef_it.next(); String ef_name = ef.getAttribute("name"); if ((ef_name == null) || (ef_name.length() == 0)) { System.err.println("missing \"name\" attribute for <executeclass>"); return false; } List args = new ArrayList(); for (Iterator arg_it = ef.getChildrenNamed("arg").iterator(); arg_it.hasNext();) { XMLElement arg_el = (XMLElement) arg_it.next(); String arg_val = arg_el.getContent(); args.add(arg_val); } ef_list.add(new ExecutableClass(ef_name, args)); } this.jobs.add(new ProcessingJob(job_name, ef_list)); } } return true; }
private boolean readSpec() throws IOException { InputStream input; try { input = ResourceManager.getInstance().getInputStream(SPEC_RESOURCE_NAME); } catch (Exception e) { e.printStackTrace(); return false; } StdXMLParser parser = new StdXMLParser(); parser.setBuilder(new StdXMLBuilder()); parser.setValidator(new NonValidator()); try { parser.setReader(new StdXMLReader(input)); this.spec = (XMLElement) parser.parse(); } catch (Exception e) { System.err.println("Error parsing XML specification for processing."); System.err.println(e.toString()); return false; } if (!this.spec.hasChildren()) return false; // Handle logfile XMLElement lfd = spec.getFirstChildNamed("logfiledir"); if (lfd != null) { logfiledir = lfd.getContent(); } for (Iterator job_it = spec.getChildrenNamed("job").iterator(); job_it.hasNext();) { XMLElement job_el = (XMLElement) job_it.next(); // ExecuteForPack Patch // Check if processing required for pack Vector forPacks = job_el.getChildrenNamed("executeForPack"); if (!jobRequiredFor(forPacks)) { continue; } // first check OS constraints - skip jobs not suited for this OS List constraints = OsConstraint.getOsList(job_el); if (OsConstraint.oneMatchesCurrentSystem(constraints)) { List ef_list = new ArrayList(); String job_name = job_el.getAttribute("name", ""); for (Iterator ef_it = job_el.getChildrenNamed("executefile").iterator(); ef_it .hasNext();) { XMLElement ef = (XMLElement) ef_it.next(); String ef_name = ef.getAttribute("name"); if ((ef_name == null) || (ef_name.length() == 0)) { System.err.println("missing \"name\" attribute for <executefile>"); return false; } List args = new ArrayList(); for (Iterator arg_it = ef.getChildrenNamed("arg").iterator(); arg_it.hasNext();) { XMLElement arg_el = (XMLElement) arg_it.next(); String arg_val = arg_el.getContent(); args.add(arg_val); } ef_list.add(new ExecutableFile(ef_name, args)); } for (Iterator ef_it = job_el.getChildrenNamed("executeclass").iterator(); ef_it .hasNext();) { XMLElement ef = (XMLElement) ef_it.next(); String ef_name = ef.getAttribute("name"); if ((ef_name == null) || (ef_name.length() == 0)) { System.err.println("missing \"name\" attribute for <executeclass>"); return false; } List args = new ArrayList(); for (Iterator arg_it = ef.getChildrenNamed("arg").iterator(); arg_it.hasNext();) { XMLElement arg_el = (XMLElement) arg_it.next(); String arg_val = arg_el.getContent(); args.add(arg_val); } ef_list.add(new ExecutableClass(ef_name, args)); } this.jobs.add(new ProcessingJob(job_name, ef_list)); } } return true; }
3,239,775
public void startThread() { this.processingThread = new Thread(this, "processing thread"); // will call this.run() this.processingThread.start(); }
public void startThread() { Thread processingThread = new Thread(this, "processing thread"); // will call this.run() this.processingThread.start(); }
3,239,776
public void startThread() { this.processingThread = new Thread(this, "processing thread"); // will call this.run() this.processingThread.start(); }
public void startThread() { this.processingThread = new Thread(this, "processing thread"); // will call this.run() processingThread.start(); }
3,239,777
protected TestObjectPoolFactory(final String name) { super(name); }
public TestObjectPoolFactory(final String name) { super(name); }
3,239,778
public void run() { instances.add(this); try { // // Initialisations FileOutputStream out = null; ArrayList parsables = new ArrayList(); ArrayList executables = new ArrayList(); ArrayList updatechecks = new ArrayList(); List packs = idata.selectedPacks; int npacks = packs.size(); handler.startAction("Unpacking", npacks); udata = UninstallData.getInstance(); // Custom action listener stuff --- load listeners ---- List [] customActions = getCustomActions(); // Custom action listener stuff --- beforePacks ---- informListeners(customActions, InstallerListener.BEFORE_PACKS,idata, new Integer(npacks), handler); // We unpack the selected packs for (int i = 0; i < npacks; i++) { // We get the pack stream int n = idata.allPacks.indexOf(packs.get(i)); // Custom action listener stuff --- beforePack ---- informListeners(customActions, InstallerListener.BEFORE_PACK,packs.get(i), new Integer(npacks), handler); ObjectInputStream objIn = new ObjectInputStream(getPackAsStream(n)); // We unpack the files int nfiles = objIn.readInt(); handler.nextStep(((Pack) packs.get(i)).name, i + 1, nfiles); for (int j = 0; j < nfiles; j++) { // We read the header PackFile pf = (PackFile) objIn.readObject(); if (OsConstraint.oneMatchesCurrentSystem(pf.osConstraints())) { // We translate & build the path String path = translatePath(pf.getTargetPath()); File pathFile = new File(path); File dest = pathFile; if (! pf.isDirectory()) dest = pathFile.getParentFile(); if (!dest.exists()) { // If there are custom actions which would be called at // creating a directory, create it recursively. List fileListeners = customActions[customActions.length - 1]; if( fileListeners != null && fileListeners.size() > 0 ) mkDirsWithEnhancement(dest, pf, customActions ); else // Create it in on step. { if (!dest.mkdirs()) { handler.emitError( "Error creating directories", "Could not create directory\n" + dest.getPath()); handler.stopAction(); return; } } } if (pf.isDirectory()) continue; // Custom action listener stuff --- beforeFile ---- informListeners(customActions, InstallerListener.BEFORE_FILE,pathFile, pf, null); // We add the path to the log, udata.addFile(path); handler.progress(j, path); //if this file exists and should not be overwritten, check //what to do if ((pathFile.exists()) && (pf.override() != PackFile.OVERRIDE_TRUE)) { boolean overwritefile = false; // don't overwrite file if the user said so if (pf.override() != PackFile.OVERRIDE_FALSE) { if (pf.override() == PackFile.OVERRIDE_TRUE) { overwritefile = true; } else if (pf.override() == PackFile.OVERRIDE_UPDATE) { // check mtime of involved files // (this is not 100% perfect, because the already existing file might // still be modified but the new installed is just a bit newer; we would // need the creation time of the existing file or record with which mtime // it was installed...) overwritefile = (pathFile.lastModified() < pf.lastModified()); } else { int def_choice = -1; if (pf.override() == PackFile.OVERRIDE_ASK_FALSE) def_choice = AbstractUIHandler.ANSWER_NO; if (pf.override() == PackFile.OVERRIDE_ASK_TRUE) def_choice = AbstractUIHandler.ANSWER_YES; int answer = handler.askQuestion( idata.langpack.getString("InstallPanel.overwrite.title") + pathFile.getName(), idata.langpack.getString( "InstallPanel.overwrite.question") + pathFile.getAbsolutePath(), AbstractUIHandler.CHOICES_YES_NO, def_choice); overwritefile = (answer == AbstractUIHandler.ANSWER_YES); } } if (!overwritefile) { if (!pf.isBackReference() && !((Pack)packs.get(i)).loose) objIn.skip(pf.length()); continue; } } // We copy the file out = new FileOutputStream(pathFile); byte[] buffer = new byte[5120]; long bytesCopied = 0; InputStream pis = objIn; if (pf.isBackReference()) { InputStream is = getPackAsStream(pf.previousPackNumber); pis = new ObjectInputStream(is); //must wrap for blockdata use by objectstream (otherwise strange result) //skip on underlaying stream (for some reason not possible on ObjectStream) is.skip(pf.offsetInPreviousPack - 4); //but the stream header is now already read (== 4 bytes) } else if(((Pack)packs.get(i)).loose) { pis = new FileInputStream(pf.sourcePath); } while (bytesCopied < pf.length()) { int maxBytes = (int)Math.min(pf.length() - bytesCopied, buffer.length); int bytesInBuffer = pis.read(buffer, 0, maxBytes); if (bytesInBuffer == -1) throw new IOException("Unexpected end of stream"); out.write(buffer, 0, bytesInBuffer); bytesCopied += bytesInBuffer; } // Cleanings out.close(); if (pis != objIn) pis.close(); // Set file modification time if specified if (pf.lastModified() >= 0) pathFile.setLastModified(pf.lastModified()); // Custom action listener stuff --- afterFile ---- informListeners(customActions, InstallerListener.AFTER_FILE,pathFile, pf, null); } else { if (!pf.isBackReference()) objIn.skip(pf.length()); } } // Load information about parsable files int numParsables = objIn.readInt(); for (int k = 0; k < numParsables; k++) { ParsableFile pf = (ParsableFile) objIn.readObject(); pf.path = translatePath(pf.path); parsables.add(pf); } // Load information about executable files int numExecutables = objIn.readInt(); for (int k = 0; k < numExecutables; k++) { ExecutableFile ef = (ExecutableFile) objIn.readObject(); ef.path = translatePath(ef.path); if (null != ef.argList && !ef.argList.isEmpty()) { String arg = null; for (int j = 0; j < ef.argList.size(); j++) { arg = (String) ef.argList.get(j); arg = translatePath(arg); ef.argList.set(j, arg); } } executables.add(ef); if (ef.executionStage == ExecutableFile.UNINSTALL) { udata.addExecutable(ef); } } // Custom action listener stuff --- uninstall data ---- handleAdditionalUninstallData(udata, customActions); // Load information about updatechecks int numUpdateChecks = objIn.readInt(); for (int k = 0; k < numUpdateChecks; k++) { UpdateCheck uc = (UpdateCheck) objIn.readObject(); updatechecks.add(uc); } objIn.close(); // Custom action listener stuff --- afterPack ---- informListeners(customActions, InstallerListener.AFTER_PACK, packs.get(i), new Integer(i), handler); } // We use the scripts parser ScriptParser parser = new ScriptParser(parsables, vs); parser.parseFiles(); // We use the file executor FileExecutor executor = new FileExecutor(executables); if (executor.executeFiles(ExecutableFile.POSTINSTALL, handler) != 0) handler.emitError( "File execution failed", "The installation was not completed"); // We put the uninstaller (it's not yet complete...) putUninstaller(); // update checks _after_ uninstaller was put, so we don't delete it performUpdateChecks(updatechecks); // Custom action listener stuff --- afterPacks ---- informListeners(customActions, InstallerListener.AFTER_PACKS,idata, handler, null); // The end :-) handler.stopAction(); } catch (Exception err) { // TODO: finer grained error handling with useful error messages handler.stopAction(); handler.emitError("An error occured", err.toString()); err.printStackTrace(); } finally { instances.remove(instances.indexOf(this)); } }
public void run() { instances.add(this); try { // // Initialisations FileOutputStream out = null; ArrayList parsables = new ArrayList(); ArrayList executables = new ArrayList(); ArrayList updatechecks = new ArrayList(); List packs = idata.selectedPacks; int npacks = packs.size(); handler.startAction("Unpacking", npacks); udata = UninstallData.getInstance(); // Custom action listener stuff --- load listeners ---- List [] customActions = getCustomActions(); // Custom action listener stuff --- beforePacks ---- informListeners(customActions, InstallerListener.BEFORE_PACKS,idata, new Integer(npacks), handler); // We unpack the selected packs for (int i = 0; i < npacks; i++) { // We get the pack stream int n = idata.allPacks.indexOf(packs.get(i)); // Custom action listener stuff --- beforePack ---- informListeners(customActions, InstallerListener.BEFORE_PACK,packs.get(i), new Integer(npacks), handler); ObjectInputStream objIn = new ObjectInputStream(getPackAsStream(n)); // We unpack the files int nfiles = objIn.readInt(); handler.nextStep(((Pack) packs.get(i)).name, i + 1, nfiles); for (int j = 0; j < nfiles; j++) { // We read the header PackFile pf = (PackFile) objIn.readObject(); if (OsConstraint.oneMatchesCurrentSystem(pf.osConstraints())) { // We translate & build the path String path = translatePath(pf.getTargetPath()); File pathFile = new File(path); File dest = pathFile; if (! pf.isDirectory()) dest = pathFile.getParentFile(); if (!dest.exists()) { // If there are custom actions which would be called at // creating a directory, create it recursively. List fileListeners = customActions[customActions.length - 1]; if( fileListeners != null && fileListeners.size() > 0 ) mkDirsWithEnhancement(dest, pf, customActions ); else // Create it in on step. { if (!dest.mkdirs()) { handler.emitError( "Error creating directories", "Could not create directory\n" + dest.getPath()); handler.stopAction(); return; } } } if (pf.isDirectory()) continue; // Custom action listener stuff --- beforeFile ---- informListeners(customActions, InstallerListener.BEFORE_FILE,pathFile, pf, null); // We add the path to the log, udata.addFile(path); handler.progress(j, path); //if this file exists and should not be overwritten, check //what to do if ((pathFile.exists()) && (pf.override() != PackFile.OVERRIDE_TRUE)) { boolean overwritefile = false; // don't overwrite file if the user said so if (pf.override() != PackFile.OVERRIDE_FALSE) { if (pf.override() == PackFile.OVERRIDE_TRUE) { overwritefile = true; } else if (pf.override() == PackFile.OVERRIDE_UPDATE) { // check mtime of involved files // (this is not 100% perfect, because the already existing file might // still be modified but the new installed is just a bit newer; we would // need the creation time of the existing file or record with which mtime // it was installed...) overwritefile = (pathFile.lastModified() < pf.lastModified()); } else { int def_choice = -1; if (pf.override() == PackFile.OVERRIDE_ASK_FALSE) def_choice = AbstractUIHandler.ANSWER_NO; if (pf.override() == PackFile.OVERRIDE_ASK_TRUE) def_choice = AbstractUIHandler.ANSWER_YES; int answer = handler.askQuestion( idata.langpack.getString("InstallPanel.overwrite.title") + pathFile.getName(), idata.langpack.getString( "InstallPanel.overwrite.question") + pathFile.getAbsolutePath(), AbstractUIHandler.CHOICES_YES_NO, def_choice); overwritefile = (answer == AbstractUIHandler.ANSWER_YES); } } if (!overwritefile) { if (!pf.isBackReference() && !((Pack)packs.get(i)).loose) objIn.skip(pf.length()); continue; } } // We copy the file out = new FileOutputStream(pathFile); byte[] buffer = new byte[5120]; long bytesCopied = 0; InputStream pis = objIn; if (pf.isBackReference()) { InputStream is = getPackAsStream(pf.previousPackNumber); pis = new ObjectInputStream(is); //must wrap for blockdata use by objectstream (otherwise strange result) //skip on underlaying stream (for some reason not possible on ObjectStream) is.skip(pf.offsetInPreviousPack - 4); //but the stream header is now already read (== 4 bytes) } else if(((Pack)packs.get(i)).loose) { pis = new FileInputStream(pf.sourcePath); } while (bytesCopied < pf.length()) { int maxBytes = (int)Math.min(pf.length() - bytesCopied, buffer.length); int bytesInBuffer = pis.read(buffer, 0, maxBytes); if (bytesInBuffer == -1) throw new IOException("Unexpected end of stream"); out.write(buffer, 0, bytesInBuffer); bytesCopied += bytesInBuffer; } // Cleanings out.close(); if (pis != objIn) pis.close(); // Set file modification time if specified if (pf.lastModified() >= 0) pathFile.setLastModified(pf.lastModified()); // Custom action listener stuff --- afterFile ---- informListeners(customActions, InstallerListener.AFTER_FILE,pathFile, pf, null); } else { if (!pf.isBackReference()) objIn.skip(pf.length()); } } // Load information about parsable files int numParsables = objIn.readInt(); for (int k = 0; k < numParsables; k++) { ParsableFile pf = (ParsableFile) objIn.readObject(); pf.path = translatePath(pf.path); parsables.add(pf); } // Load information about executable files int numExecutables = objIn.readInt(); for (int k = 0; k < numExecutables; k++) { ExecutableFile ef = (ExecutableFile) objIn.readObject(); ef.path = translatePath(ef.path); if (null != ef.argList && !ef.argList.isEmpty()) { String arg = null; for (int j = 0; j < ef.argList.size(); j++) { arg = (String) ef.argList.get(j); arg = translatePath(arg); ef.argList.set(j, arg); } } executables.add(ef); if (ef.executionStage == ExecutableFile.UNINSTALL) { udata.addExecutable(ef); } } // Custom action listener stuff --- uninstall data ---- handleAdditionalUninstallData(udata, customActions); // Load information about updatechecks int numUpdateChecks = objIn.readInt(); for (int k = 0; k < numUpdateChecks; k++) { UpdateCheck uc = (UpdateCheck) objIn.readObject(); updatechecks.add(uc); } objIn.close(); // Custom action listener stuff --- afterPack ---- informListeners(customActions, InstallerListener.AFTER_PACK, packs.get(i), new Integer(i), handler); } // We use the scripts parser ScriptParser parser = new ScriptParser(parsables, vs); parser.parseFiles(); // We use the file executor FileExecutor executor = new FileExecutor(executables); if (executor.executeFiles(ExecutableFile.POSTINSTALL, handler) != 0) handler.emitError( "File execution failed", "The installation was not completed"); // We put the uninstaller (it's not yet complete...) putUninstaller(); // update checks _after_ uninstaller was put, so we don't delete it performUpdateChecks(updatechecks); // Custom action listener stuff --- afterPacks ---- informListeners(customActions, InstallerListener.AFTER_PACKS,idata, handler, null); // The end :-) handler.stopAction(); } catch (Exception err) { // TODO: finer grained error handling with useful error messages handler.stopAction(); handler.emitError("An error occured", err.toString()); err.printStackTrace(); } finally { instances.remove(instances.indexOf(this)); } }
3,239,780
public void run() { instances.add(this); try { // // Initialisations FileOutputStream out = null; ArrayList parsables = new ArrayList(); ArrayList executables = new ArrayList(); ArrayList updatechecks = new ArrayList(); List packs = idata.selectedPacks; int npacks = packs.size(); handler.startAction("Unpacking", npacks); udata = UninstallData.getInstance(); // Custom action listener stuff --- load listeners ---- List [] customActions = getCustomActions(); // Custom action listener stuff --- beforePacks ---- informListeners(customActions, InstallerListener.BEFORE_PACKS,idata, new Integer(npacks), handler); // We unpack the selected packs for (int i = 0; i < npacks; i++) { // We get the pack stream int n = idata.allPacks.indexOf(packs.get(i)); // Custom action listener stuff --- beforePack ---- informListeners(customActions, InstallerListener.BEFORE_PACK,packs.get(i), new Integer(npacks), handler); ObjectInputStream objIn = new ObjectInputStream(getPackAsStream(n)); // We unpack the files int nfiles = objIn.readInt(); handler.nextStep(((Pack) packs.get(i)).name, i + 1, nfiles); for (int j = 0; j < nfiles; j++) { // We read the header PackFile pf = (PackFile) objIn.readObject(); if (OsConstraint.oneMatchesCurrentSystem(pf.osConstraints())) { // We translate & build the path String path = translatePath(pf.getTargetPath()); File pathFile = new File(path); File dest = pathFile; if (! pf.isDirectory()) dest = pathFile.getParentFile(); if (!dest.exists()) { // If there are custom actions which would be called at // creating a directory, create it recursively. List fileListeners = customActions[customActions.length - 1]; if( fileListeners != null && fileListeners.size() > 0 ) mkDirsWithEnhancement(dest, pf, customActions ); else // Create it in on step. { if (!dest.mkdirs()) { handler.emitError( "Error creating directories", "Could not create directory\n" + dest.getPath()); handler.stopAction(); return; } } } if (pf.isDirectory()) continue; // Custom action listener stuff --- beforeFile ---- informListeners(customActions, InstallerListener.BEFORE_FILE,pathFile, pf, null); // We add the path to the log, udata.addFile(path); handler.progress(j, path); //if this file exists and should not be overwritten, check //what to do if ((pathFile.exists()) && (pf.override() != PackFile.OVERRIDE_TRUE)) { boolean overwritefile = false; // don't overwrite file if the user said so if (pf.override() != PackFile.OVERRIDE_FALSE) { if (pf.override() == PackFile.OVERRIDE_TRUE) { overwritefile = true; } else if (pf.override() == PackFile.OVERRIDE_UPDATE) { // check mtime of involved files // (this is not 100% perfect, because the already existing file might // still be modified but the new installed is just a bit newer; we would // need the creation time of the existing file or record with which mtime // it was installed...) overwritefile = (pathFile.lastModified() < pf.lastModified()); } else { int def_choice = -1; if (pf.override() == PackFile.OVERRIDE_ASK_FALSE) def_choice = AbstractUIHandler.ANSWER_NO; if (pf.override() == PackFile.OVERRIDE_ASK_TRUE) def_choice = AbstractUIHandler.ANSWER_YES; int answer = handler.askQuestion( idata.langpack.getString("InstallPanel.overwrite.title") + pathFile.getName(), idata.langpack.getString( "InstallPanel.overwrite.question") + pathFile.getAbsolutePath(), AbstractUIHandler.CHOICES_YES_NO, def_choice); overwritefile = (answer == AbstractUIHandler.ANSWER_YES); } } if (!overwritefile) { if (!pf.isBackReference() && !((Pack)packs.get(i)).loose) objIn.skip(pf.length()); continue; } } // We copy the file out = new FileOutputStream(pathFile); byte[] buffer = new byte[5120]; long bytesCopied = 0; InputStream pis = objIn; if (pf.isBackReference()) { InputStream is = getPackAsStream(pf.previousPackNumber); pis = new ObjectInputStream(is); //must wrap for blockdata use by objectstream (otherwise strange result) //skip on underlaying stream (for some reason not possible on ObjectStream) is.skip(pf.offsetInPreviousPack - 4); //but the stream header is now already read (== 4 bytes) } else if(((Pack)packs.get(i)).loose) { pis = new FileInputStream(pf.sourcePath); } while (bytesCopied < pf.length()) { int maxBytes = (int)Math.min(pf.length() - bytesCopied, buffer.length); int bytesInBuffer = pis.read(buffer, 0, maxBytes); if (bytesInBuffer == -1) throw new IOException("Unexpected end of stream"); out.write(buffer, 0, bytesInBuffer); bytesCopied += bytesInBuffer; } // Cleanings out.close(); if (pis != objIn) pis.close(); // Set file modification time if specified if (pf.lastModified() >= 0) pathFile.setLastModified(pf.lastModified()); // Custom action listener stuff --- afterFile ---- informListeners(customActions, InstallerListener.AFTER_FILE,pathFile, pf, null); } else { if (!pf.isBackReference()) objIn.skip(pf.length()); } } // Load information about parsable files int numParsables = objIn.readInt(); for (int k = 0; k < numParsables; k++) { ParsableFile pf = (ParsableFile) objIn.readObject(); pf.path = translatePath(pf.path); parsables.add(pf); } // Load information about executable files int numExecutables = objIn.readInt(); for (int k = 0; k < numExecutables; k++) { ExecutableFile ef = (ExecutableFile) objIn.readObject(); ef.path = translatePath(ef.path); if (null != ef.argList && !ef.argList.isEmpty()) { String arg = null; for (int j = 0; j < ef.argList.size(); j++) { arg = (String) ef.argList.get(j); arg = translatePath(arg); ef.argList.set(j, arg); } } executables.add(ef); if (ef.executionStage == ExecutableFile.UNINSTALL) { udata.addExecutable(ef); } } // Custom action listener stuff --- uninstall data ---- handleAdditionalUninstallData(udata, customActions); // Load information about updatechecks int numUpdateChecks = objIn.readInt(); for (int k = 0; k < numUpdateChecks; k++) { UpdateCheck uc = (UpdateCheck) objIn.readObject(); updatechecks.add(uc); } objIn.close(); // Custom action listener stuff --- afterPack ---- informListeners(customActions, InstallerListener.AFTER_PACK, packs.get(i), new Integer(i), handler); } // We use the scripts parser ScriptParser parser = new ScriptParser(parsables, vs); parser.parseFiles(); // We use the file executor FileExecutor executor = new FileExecutor(executables); if (executor.executeFiles(ExecutableFile.POSTINSTALL, handler) != 0) handler.emitError( "File execution failed", "The installation was not completed"); // We put the uninstaller (it's not yet complete...) putUninstaller(); // update checks _after_ uninstaller was put, so we don't delete it performUpdateChecks(updatechecks); // Custom action listener stuff --- afterPacks ---- informListeners(customActions, InstallerListener.AFTER_PACKS,idata, handler, null); // The end :-) handler.stopAction(); } catch (Exception err) { // TODO: finer grained error handling with useful error messages handler.stopAction(); handler.emitError("An error occured", err.toString()); err.printStackTrace(); } finally { instances.remove(instances.indexOf(this)); } }
public void run() { instances.add(this); try { // // Initialisations FileOutputStream out = null; ArrayList parsables = new ArrayList(); ArrayList executables = new ArrayList(); ArrayList updatechecks = new ArrayList(); List packs = idata.selectedPacks; int npacks = packs.size(); handler.startAction("Unpacking", npacks); udata = UninstallData.getInstance(); // Custom action listener stuff --- load listeners ---- List [] customActions = getCustomActions(); // Custom action listener stuff --- beforePacks ---- informListeners(customActions, InstallerListener.BEFORE_PACKS,idata, new Integer(npacks), handler); // We unpack the selected packs for (int i = 0; i < npacks; i++) { // We get the pack stream int n = idata.allPacks.indexOf(packs.get(i)); // Custom action listener stuff --- beforePack ---- informListeners(customActions, InstallerListener.BEFORE_PACK,packs.get(i), new Integer(npacks), handler); ObjectInputStream objIn = new ObjectInputStream(getPackAsStream(n)); // We unpack the files int nfiles = objIn.readInt(); final Pack pack = ((Pack) packs.get(i)); String stepname = pack.name; if(langpack !=null && !(pack.id == null || pack.id.equals("")) ) { final String name = langpack.getString(pack.id); if(name !=null && !name.equals("")) { stepname = name; } } handler.nextStep(stepname, i + 1, nfiles); for (int j = 0; j < nfiles; j++) { // We read the header PackFile pf = (PackFile) objIn.readObject(); if (OsConstraint.oneMatchesCurrentSystem(pf.osConstraints())) { // We translate & build the path String path = translatePath(pf.getTargetPath()); File pathFile = new File(path); File dest = pathFile; if (! pf.isDirectory()) dest = pathFile.getParentFile(); if (!dest.exists()) { // If there are custom actions which would be called at // creating a directory, create it recursively. List fileListeners = customActions[customActions.length - 1]; if( fileListeners != null && fileListeners.size() > 0 ) mkDirsWithEnhancement(dest, pf, customActions ); else // Create it in on step. { if (!dest.mkdirs()) { handler.emitError( "Error creating directories", "Could not create directory\n" + dest.getPath()); handler.stopAction(); return; } } } if (pf.isDirectory()) continue; // Custom action listener stuff --- beforeFile ---- informListeners(customActions, InstallerListener.BEFORE_FILE,pathFile, pf, null); // We add the path to the log, udata.addFile(path); handler.progress(j, path); //if this file exists and should not be overwritten, check //what to do if ((pathFile.exists()) && (pf.override() != PackFile.OVERRIDE_TRUE)) { boolean overwritefile = false; // don't overwrite file if the user said so if (pf.override() != PackFile.OVERRIDE_FALSE) { if (pf.override() == PackFile.OVERRIDE_TRUE) { overwritefile = true; } else if (pf.override() == PackFile.OVERRIDE_UPDATE) { // check mtime of involved files // (this is not 100% perfect, because the already existing file might // still be modified but the new installed is just a bit newer; we would // need the creation time of the existing file or record with which mtime // it was installed...) overwritefile = (pathFile.lastModified() < pf.lastModified()); } else { int def_choice = -1; if (pf.override() == PackFile.OVERRIDE_ASK_FALSE) def_choice = AbstractUIHandler.ANSWER_NO; if (pf.override() == PackFile.OVERRIDE_ASK_TRUE) def_choice = AbstractUIHandler.ANSWER_YES; int answer = handler.askQuestion( idata.langpack.getString("InstallPanel.overwrite.title") + pathFile.getName(), idata.langpack.getString( "InstallPanel.overwrite.question") + pathFile.getAbsolutePath(), AbstractUIHandler.CHOICES_YES_NO, def_choice); overwritefile = (answer == AbstractUIHandler.ANSWER_YES); } } if (!overwritefile) { if (!pf.isBackReference() && !((Pack)packs.get(i)).loose) objIn.skip(pf.length()); continue; } } // We copy the file out = new FileOutputStream(pathFile); byte[] buffer = new byte[5120]; long bytesCopied = 0; InputStream pis = objIn; if (pf.isBackReference()) { InputStream is = getPackAsStream(pf.previousPackNumber); pis = new ObjectInputStream(is); //must wrap for blockdata use by objectstream (otherwise strange result) //skip on underlaying stream (for some reason not possible on ObjectStream) is.skip(pf.offsetInPreviousPack - 4); //but the stream header is now already read (== 4 bytes) } else if(((Pack)packs.get(i)).loose) { pis = new FileInputStream(pf.sourcePath); } while (bytesCopied < pf.length()) { int maxBytes = (int)Math.min(pf.length() - bytesCopied, buffer.length); int bytesInBuffer = pis.read(buffer, 0, maxBytes); if (bytesInBuffer == -1) throw new IOException("Unexpected end of stream"); out.write(buffer, 0, bytesInBuffer); bytesCopied += bytesInBuffer; } // Cleanings out.close(); if (pis != objIn) pis.close(); // Set file modification time if specified if (pf.lastModified() >= 0) pathFile.setLastModified(pf.lastModified()); // Custom action listener stuff --- afterFile ---- informListeners(customActions, InstallerListener.AFTER_FILE,pathFile, pf, null); } else { if (!pf.isBackReference()) objIn.skip(pf.length()); } } // Load information about parsable files int numParsables = objIn.readInt(); for (int k = 0; k < numParsables; k++) { ParsableFile pf = (ParsableFile) objIn.readObject(); pf.path = translatePath(pf.path); parsables.add(pf); } // Load information about executable files int numExecutables = objIn.readInt(); for (int k = 0; k < numExecutables; k++) { ExecutableFile ef = (ExecutableFile) objIn.readObject(); ef.path = translatePath(ef.path); if (null != ef.argList && !ef.argList.isEmpty()) { String arg = null; for (int j = 0; j < ef.argList.size(); j++) { arg = (String) ef.argList.get(j); arg = translatePath(arg); ef.argList.set(j, arg); } } executables.add(ef); if (ef.executionStage == ExecutableFile.UNINSTALL) { udata.addExecutable(ef); } } // Custom action listener stuff --- uninstall data ---- handleAdditionalUninstallData(udata, customActions); // Load information about updatechecks int numUpdateChecks = objIn.readInt(); for (int k = 0; k < numUpdateChecks; k++) { UpdateCheck uc = (UpdateCheck) objIn.readObject(); updatechecks.add(uc); } objIn.close(); // Custom action listener stuff --- afterPack ---- informListeners(customActions, InstallerListener.AFTER_PACK, packs.get(i), new Integer(i), handler); } // We use the scripts parser ScriptParser parser = new ScriptParser(parsables, vs); parser.parseFiles(); // We use the file executor FileExecutor executor = new FileExecutor(executables); if (executor.executeFiles(ExecutableFile.POSTINSTALL, handler) != 0) handler.emitError( "File execution failed", "The installation was not completed"); // We put the uninstaller (it's not yet complete...) putUninstaller(); // update checks _after_ uninstaller was put, so we don't delete it performUpdateChecks(updatechecks); // Custom action listener stuff --- afterPacks ---- informListeners(customActions, InstallerListener.AFTER_PACKS,idata, handler, null); // The end :-) handler.stopAction(); } catch (Exception err) { // TODO: finer grained error handling with useful error messages handler.stopAction(); handler.emitError("An error occured", err.toString()); err.printStackTrace(); } finally { instances.remove(instances.indexOf(this)); } }
3,239,781
public void run() { instances.add(this); try { // // Initialisations FileOutputStream out = null; ArrayList parsables = new ArrayList(); ArrayList executables = new ArrayList(); ArrayList updatechecks = new ArrayList(); List packs = idata.selectedPacks; int npacks = packs.size(); handler.startAction("Unpacking", npacks); udata = UninstallData.getInstance(); // Custom action listener stuff --- load listeners ---- List [] customActions = getCustomActions(); // Custom action listener stuff --- beforePacks ---- informListeners(customActions, InstallerListener.BEFORE_PACKS,idata, new Integer(npacks), handler); // We unpack the selected packs for (int i = 0; i < npacks; i++) { // We get the pack stream int n = idata.allPacks.indexOf(packs.get(i)); // Custom action listener stuff --- beforePack ---- informListeners(customActions, InstallerListener.BEFORE_PACK,packs.get(i), new Integer(npacks), handler); ObjectInputStream objIn = new ObjectInputStream(getPackAsStream(n)); // We unpack the files int nfiles = objIn.readInt(); handler.nextStep(((Pack) packs.get(i)).name, i + 1, nfiles); for (int j = 0; j < nfiles; j++) { // We read the header PackFile pf = (PackFile) objIn.readObject(); if (OsConstraint.oneMatchesCurrentSystem(pf.osConstraints())) { // We translate & build the path String path = translatePath(pf.getTargetPath()); File pathFile = new File(path); File dest = pathFile; if (! pf.isDirectory()) dest = pathFile.getParentFile(); if (!dest.exists()) { // If there are custom actions which would be called at // creating a directory, create it recursively. List fileListeners = customActions[customActions.length - 1]; if( fileListeners != null && fileListeners.size() > 0 ) mkDirsWithEnhancement(dest, pf, customActions ); else // Create it in on step. { if (!dest.mkdirs()) { handler.emitError( "Error creating directories", "Could not create directory\n" + dest.getPath()); handler.stopAction(); return; } } } if (pf.isDirectory()) continue; // Custom action listener stuff --- beforeFile ---- informListeners(customActions, InstallerListener.BEFORE_FILE,pathFile, pf, null); // We add the path to the log, udata.addFile(path); handler.progress(j, path); //if this file exists and should not be overwritten, check //what to do if ((pathFile.exists()) && (pf.override() != PackFile.OVERRIDE_TRUE)) { boolean overwritefile = false; // don't overwrite file if the user said so if (pf.override() != PackFile.OVERRIDE_FALSE) { if (pf.override() == PackFile.OVERRIDE_TRUE) { overwritefile = true; } else if (pf.override() == PackFile.OVERRIDE_UPDATE) { // check mtime of involved files // (this is not 100% perfect, because the already existing file might // still be modified but the new installed is just a bit newer; we would // need the creation time of the existing file or record with which mtime // it was installed...) overwritefile = (pathFile.lastModified() < pf.lastModified()); } else { int def_choice = -1; if (pf.override() == PackFile.OVERRIDE_ASK_FALSE) def_choice = AbstractUIHandler.ANSWER_NO; if (pf.override() == PackFile.OVERRIDE_ASK_TRUE) def_choice = AbstractUIHandler.ANSWER_YES; int answer = handler.askQuestion( idata.langpack.getString("InstallPanel.overwrite.title") + pathFile.getName(), idata.langpack.getString( "InstallPanel.overwrite.question") + pathFile.getAbsolutePath(), AbstractUIHandler.CHOICES_YES_NO, def_choice); overwritefile = (answer == AbstractUIHandler.ANSWER_YES); } } if (!overwritefile) { if (!pf.isBackReference() && !((Pack)packs.get(i)).loose) objIn.skip(pf.length()); continue; } } // We copy the file out = new FileOutputStream(pathFile); byte[] buffer = new byte[5120]; long bytesCopied = 0; InputStream pis = objIn; if (pf.isBackReference()) { InputStream is = getPackAsStream(pf.previousPackNumber); pis = new ObjectInputStream(is); //must wrap for blockdata use by objectstream (otherwise strange result) //skip on underlaying stream (for some reason not possible on ObjectStream) is.skip(pf.offsetInPreviousPack - 4); //but the stream header is now already read (== 4 bytes) } else if(((Pack)packs.get(i)).loose) { pis = new FileInputStream(pf.sourcePath); } while (bytesCopied < pf.length()) { int maxBytes = (int)Math.min(pf.length() - bytesCopied, buffer.length); int bytesInBuffer = pis.read(buffer, 0, maxBytes); if (bytesInBuffer == -1) throw new IOException("Unexpected end of stream"); out.write(buffer, 0, bytesInBuffer); bytesCopied += bytesInBuffer; } // Cleanings out.close(); if (pis != objIn) pis.close(); // Set file modification time if specified if (pf.lastModified() >= 0) pathFile.setLastModified(pf.lastModified()); // Custom action listener stuff --- afterFile ---- informListeners(customActions, InstallerListener.AFTER_FILE,pathFile, pf, null); } else { if (!pf.isBackReference()) objIn.skip(pf.length()); } } // Load information about parsable files int numParsables = objIn.readInt(); for (int k = 0; k < numParsables; k++) { ParsableFile pf = (ParsableFile) objIn.readObject(); pf.path = translatePath(pf.path); parsables.add(pf); } // Load information about executable files int numExecutables = objIn.readInt(); for (int k = 0; k < numExecutables; k++) { ExecutableFile ef = (ExecutableFile) objIn.readObject(); ef.path = translatePath(ef.path); if (null != ef.argList && !ef.argList.isEmpty()) { String arg = null; for (int j = 0; j < ef.argList.size(); j++) { arg = (String) ef.argList.get(j); arg = translatePath(arg); ef.argList.set(j, arg); } } executables.add(ef); if (ef.executionStage == ExecutableFile.UNINSTALL) { udata.addExecutable(ef); } } // Custom action listener stuff --- uninstall data ---- handleAdditionalUninstallData(udata, customActions); // Load information about updatechecks int numUpdateChecks = objIn.readInt(); for (int k = 0; k < numUpdateChecks; k++) { UpdateCheck uc = (UpdateCheck) objIn.readObject(); updatechecks.add(uc); } objIn.close(); // Custom action listener stuff --- afterPack ---- informListeners(customActions, InstallerListener.AFTER_PACK, packs.get(i), new Integer(i), handler); } // We use the scripts parser ScriptParser parser = new ScriptParser(parsables, vs); parser.parseFiles(); // We use the file executor FileExecutor executor = new FileExecutor(executables); if (executor.executeFiles(ExecutableFile.POSTINSTALL, handler) != 0) handler.emitError( "File execution failed", "The installation was not completed"); // We put the uninstaller (it's not yet complete...) putUninstaller(); // update checks _after_ uninstaller was put, so we don't delete it performUpdateChecks(updatechecks); // Custom action listener stuff --- afterPacks ---- informListeners(customActions, InstallerListener.AFTER_PACKS,idata, handler, null); // The end :-) handler.stopAction(); } catch (Exception err) { // TODO: finer grained error handling with useful error messages handler.stopAction(); handler.emitError("An error occured", err.toString()); err.printStackTrace(); } finally { instances.remove(instances.indexOf(this)); } }
public void run() { instances.add(this); try { // // Initialisations FileOutputStream out = null; ArrayList parsables = new ArrayList(); ArrayList executables = new ArrayList(); ArrayList updatechecks = new ArrayList(); List packs = idata.selectedPacks; int npacks = packs.size(); handler.startAction("Unpacking", npacks); udata = UninstallData.getInstance(); // Custom action listener stuff --- load listeners ---- List [] customActions = getCustomActions(); // Custom action listener stuff --- beforePacks ---- informListeners(customActions, InstallerListener.BEFORE_PACKS,idata, new Integer(npacks), handler); // We unpack the selected packs for (int i = 0; i < npacks; i++) { // We get the pack stream int n = idata.allPacks.indexOf(packs.get(i)); // Custom action listener stuff --- beforePack ---- informListeners(customActions, InstallerListener.BEFORE_PACK,packs.get(i), new Integer(npacks), handler); ObjectInputStream objIn = new ObjectInputStream(getPackAsStream(n)); // We unpack the files int nfiles = objIn.readInt(); handler.nextStep(((Pack) packs.get(i)).name, i + 1, nfiles); for (int j = 0; j < nfiles; j++) { // We read the header PackFile pf = (PackFile) objIn.readObject(); if (OsConstraint.oneMatchesCurrentSystem(pf.osConstraints())) { // We translate & build the path String path = translatePath(pf.getTargetPath()); File pathFile = new File(path); File dest = pathFile; if (! pf.isDirectory()) dest = pathFile.getParentFile(); if (!dest.exists()) { // If there are custom actions which would be called at // creating a directory, create it recursively. List fileListeners = customActions[customActions.length - 1]; if( fileListeners != null && fileListeners.size() > 0 ) mkDirsWithEnhancement(dest, pf, customActions ); else // Create it in on step. { if (!dest.mkdirs()) { handler.emitError( "Error creating directories", "Could not create directory\n" + dest.getPath()); handler.stopAction(); return; } } } if (pf.isDirectory()) continue; // Custom action listener stuff --- beforeFile ---- informListeners(customActions, InstallerListener.BEFORE_FILE,pathFile, pf, null); // We add the path to the log, udata.addFile(path); handler.progress(j, path); //if this file exists and should not be overwritten, check //what to do if ((pathFile.exists()) && (pf.override() != PackFile.OVERRIDE_TRUE)) { boolean overwritefile = false; // don't overwrite file if the user said so if (pf.override() != PackFile.OVERRIDE_FALSE) { if (pf.override() == PackFile.OVERRIDE_TRUE) { overwritefile = true; } else if (pf.override() == PackFile.OVERRIDE_UPDATE) { // check mtime of involved files // (this is not 100% perfect, because the already existing file might // still be modified but the new installed is just a bit newer; we would // need the creation time of the existing file or record with which mtime // it was installed...) overwritefile = (pathFile.lastModified() < pf.lastModified()); } else { int def_choice = -1; if (pf.override() == PackFile.OVERRIDE_ASK_FALSE) def_choice = AbstractUIHandler.ANSWER_NO; if (pf.override() == PackFile.OVERRIDE_ASK_TRUE) def_choice = AbstractUIHandler.ANSWER_YES; int answer = handler.askQuestion( idata.langpack.getString("InstallPanel.overwrite.title") + pathFile.getName(), idata.langpack.getString( "InstallPanel.overwrite.question") + pathFile.getAbsolutePath(), AbstractUIHandler.CHOICES_YES_NO, def_choice); overwritefile = (answer == AbstractUIHandler.ANSWER_YES); } } if (!overwritefile) { if (!pf.isBackReference() && !((Pack)packs.get(i)).loose) objIn.skip(pf.length()); continue; } } // We copy the file out = new FileOutputStream(pathFile); byte[] buffer = new byte[5120]; long bytesCopied = 0; InputStream pis = objIn; if (pf.isBackReference()) { InputStream is = getPackAsStream(pf.previousPackNumber); pis = new ObjectInputStream(is); //must wrap for blockdata use by objectstream (otherwise strange result) //skip on underlaying stream (for some reason not possible on ObjectStream) is.skip(pf.offsetInPreviousPack - 4); //but the stream header is now already read (== 4 bytes) } else if(((Pack)packs.get(i)).loose) { pis = new FileInputStream(pf.sourcePath); } while (bytesCopied < pf.length()) { int maxBytes = (int)Math.min(pf.length() - bytesCopied, buffer.length); int bytesInBuffer = pis.read(buffer, 0, maxBytes); if (bytesInBuffer == -1) throw new IOException("Unexpected end of stream"); out.write(buffer, 0, bytesInBuffer); bytesCopied += bytesInBuffer; } // Cleanings out.close(); if (pis != objIn) pis.close(); // Set file modification time if specified if (pf.lastModified() >= 0) pathFile.setLastModified(pf.lastModified()); // Custom action listener stuff --- afterFile ---- informListeners(customActions, InstallerListener.AFTER_FILE,pathFile, pf, null); } else { if (!pf.isBackReference()) objIn.skip(pf.length()); } } // Load information about parsable files int numParsables = objIn.readInt(); for (int k = 0; k < numParsables; k++) { ParsableFile pf = (ParsableFile) objIn.readObject(); pf.path = translatePath(pf.path); parsables.add(pf); } // Load information about executable files int numExecutables = objIn.readInt(); for (int k = 0; k < numExecutables; k++) { ExecutableFile ef = (ExecutableFile) objIn.readObject(); ef.path = translatePath(ef.path); if (null != ef.argList && !ef.argList.isEmpty()) { String arg = null; for (int j = 0; j < ef.argList.size(); j++) { arg = (String) ef.argList.get(j); arg = translatePath(arg); ef.argList.set(j, arg); } } executables.add(ef); if (ef.executionStage == ExecutableFile.UNINSTALL) { udata.addExecutable(ef); } } // Custom action listener stuff --- uninstall data ---- handleAdditionalUninstallData(udata, customActions); // Load information about updatechecks int numUpdateChecks = objIn.readInt(); for (int k = 0; k < numUpdateChecks; k++) { UpdateCheck uc = (UpdateCheck) objIn.readObject(); updatechecks.add(uc); } objIn.close(); // Custom action listener stuff --- afterPack ---- informListeners(customActions, InstallerListener.AFTER_PACK, packs.get(i), new Integer(i), handler); } // We use the scripts parser ScriptParser parser = new ScriptParser(parsables, vs); parser.parseFiles(); // We use the file executor FileExecutor executor = new FileExecutor(executables); if (executor.executeFiles(ExecutableFile.POSTINSTALL, handler) != 0) handler.emitError( "File execution failed", "The installation was not completed"); // We put the uninstaller (it's not yet complete...) putUninstaller(); // update checks _after_ uninstaller was put, so we don't delete it performUpdateChecks(updatechecks); // Custom action listener stuff --- afterPacks ---- informListeners(customActions, InstallerListener.AFTER_PACKS,idata, handler, null); // The end :-) handler.stopAction(); } catch (Exception err) { // TODO: finer grained error handling with useful error messages handler.stopAction(); handler.emitError("An error occured", err.toString()); err.printStackTrace(); } finally { instances.remove(instances.indexOf(this)); } }
3,239,782
public void run() { instances.add(this); try { // // Initialisations FileOutputStream out = null; ArrayList parsables = new ArrayList(); ArrayList executables = new ArrayList(); ArrayList updatechecks = new ArrayList(); List packs = idata.selectedPacks; int npacks = packs.size(); handler.startAction("Unpacking", npacks); udata = UninstallData.getInstance(); // Custom action listener stuff --- load listeners ---- List [] customActions = getCustomActions(); // Custom action listener stuff --- beforePacks ---- informListeners(customActions, InstallerListener.BEFORE_PACKS,idata, new Integer(npacks), handler); // We unpack the selected packs for (int i = 0; i < npacks; i++) { // We get the pack stream int n = idata.allPacks.indexOf(packs.get(i)); // Custom action listener stuff --- beforePack ---- informListeners(customActions, InstallerListener.BEFORE_PACK,packs.get(i), new Integer(npacks), handler); ObjectInputStream objIn = new ObjectInputStream(getPackAsStream(n)); // We unpack the files int nfiles = objIn.readInt(); handler.nextStep(((Pack) packs.get(i)).name, i + 1, nfiles); for (int j = 0; j < nfiles; j++) { // We read the header PackFile pf = (PackFile) objIn.readObject(); if (OsConstraint.oneMatchesCurrentSystem(pf.osConstraints())) { // We translate & build the path String path = translatePath(pf.getTargetPath()); File pathFile = new File(path); File dest = pathFile; if (! pf.isDirectory()) dest = pathFile.getParentFile(); if (!dest.exists()) { // If there are custom actions which would be called at // creating a directory, create it recursively. List fileListeners = customActions[customActions.length - 1]; if( fileListeners != null && fileListeners.size() > 0 ) mkDirsWithEnhancement(dest, pf, customActions ); else // Create it in on step. { if (!dest.mkdirs()) { handler.emitError( "Error creating directories", "Could not create directory\n" + dest.getPath()); handler.stopAction(); return; } } } if (pf.isDirectory()) continue; // Custom action listener stuff --- beforeFile ---- informListeners(customActions, InstallerListener.BEFORE_FILE,pathFile, pf, null); // We add the path to the log, udata.addFile(path); handler.progress(j, path); //if this file exists and should not be overwritten, check //what to do if ((pathFile.exists()) && (pf.override() != PackFile.OVERRIDE_TRUE)) { boolean overwritefile = false; // don't overwrite file if the user said so if (pf.override() != PackFile.OVERRIDE_FALSE) { if (pf.override() == PackFile.OVERRIDE_TRUE) { overwritefile = true; } else if (pf.override() == PackFile.OVERRIDE_UPDATE) { // check mtime of involved files // (this is not 100% perfect, because the already existing file might // still be modified but the new installed is just a bit newer; we would // need the creation time of the existing file or record with which mtime // it was installed...) overwritefile = (pathFile.lastModified() < pf.lastModified()); } else { int def_choice = -1; if (pf.override() == PackFile.OVERRIDE_ASK_FALSE) def_choice = AbstractUIHandler.ANSWER_NO; if (pf.override() == PackFile.OVERRIDE_ASK_TRUE) def_choice = AbstractUIHandler.ANSWER_YES; int answer = handler.askQuestion( idata.langpack.getString("InstallPanel.overwrite.title") + pathFile.getName(), idata.langpack.getString( "InstallPanel.overwrite.question") + pathFile.getAbsolutePath(), AbstractUIHandler.CHOICES_YES_NO, def_choice); overwritefile = (answer == AbstractUIHandler.ANSWER_YES); } } if (!overwritefile) { if (!pf.isBackReference() && !((Pack)packs.get(i)).loose) objIn.skip(pf.length()); continue; } } // We copy the file out = new FileOutputStream(pathFile); byte[] buffer = new byte[5120]; long bytesCopied = 0; InputStream pis = objIn; if (pf.isBackReference()) { InputStream is = getPackAsStream(pf.previousPackNumber); pis = new ObjectInputStream(is); //must wrap for blockdata use by objectstream (otherwise strange result) //skip on underlaying stream (for some reason not possible on ObjectStream) is.skip(pf.offsetInPreviousPack - 4); //but the stream header is now already read (== 4 bytes) } else if(((Pack)packs.get(i)).loose) { pis = new FileInputStream(pf.sourcePath); } while (bytesCopied < pf.length()) { int maxBytes = (int)Math.min(pf.length() - bytesCopied, buffer.length); int bytesInBuffer = pis.read(buffer, 0, maxBytes); if (bytesInBuffer == -1) throw new IOException("Unexpected end of stream"); out.write(buffer, 0, bytesInBuffer); bytesCopied += bytesInBuffer; } // Cleanings out.close(); if (pis != objIn) pis.close(); // Set file modification time if specified if (pf.lastModified() >= 0) pathFile.setLastModified(pf.lastModified()); // Custom action listener stuff --- afterFile ---- informListeners(customActions, InstallerListener.AFTER_FILE,pathFile, pf, null); } else { if (!pf.isBackReference()) objIn.skip(pf.length()); } } // Load information about parsable files int numParsables = objIn.readInt(); for (int k = 0; k < numParsables; k++) { ParsableFile pf = (ParsableFile) objIn.readObject(); pf.path = translatePath(pf.path); parsables.add(pf); } // Load information about executable files int numExecutables = objIn.readInt(); for (int k = 0; k < numExecutables; k++) { ExecutableFile ef = (ExecutableFile) objIn.readObject(); ef.path = translatePath(ef.path); if (null != ef.argList && !ef.argList.isEmpty()) { String arg = null; for (int j = 0; j < ef.argList.size(); j++) { arg = (String) ef.argList.get(j); arg = translatePath(arg); ef.argList.set(j, arg); } } executables.add(ef); if (ef.executionStage == ExecutableFile.UNINSTALL) { udata.addExecutable(ef); } } // Custom action listener stuff --- uninstall data ---- handleAdditionalUninstallData(udata, customActions); // Load information about updatechecks int numUpdateChecks = objIn.readInt(); for (int k = 0; k < numUpdateChecks; k++) { UpdateCheck uc = (UpdateCheck) objIn.readObject(); updatechecks.add(uc); } objIn.close(); // Custom action listener stuff --- afterPack ---- informListeners(customActions, InstallerListener.AFTER_PACK, packs.get(i), new Integer(i), handler); } // We use the scripts parser ScriptParser parser = new ScriptParser(parsables, vs); parser.parseFiles(); // We use the file executor FileExecutor executor = new FileExecutor(executables); if (executor.executeFiles(ExecutableFile.POSTINSTALL, handler) != 0) handler.emitError( "File execution failed", "The installation was not completed"); // We put the uninstaller (it's not yet complete...) putUninstaller(); // update checks _after_ uninstaller was put, so we don't delete it performUpdateChecks(updatechecks); // Custom action listener stuff --- afterPacks ---- informListeners(customActions, InstallerListener.AFTER_PACKS,idata, handler, null); // The end :-) handler.stopAction(); } catch (Exception err) { // TODO: finer grained error handling with useful error messages handler.stopAction(); handler.emitError("An error occured", err.toString()); err.printStackTrace(); } finally { instances.remove(instances.indexOf(this)); } }
public void run() { instances.add(this); try { // // Initialisations FileOutputStream out = null; ArrayList parsables = new ArrayList(); ArrayList executables = new ArrayList(); ArrayList updatechecks = new ArrayList(); List packs = idata.selectedPacks; int npacks = packs.size(); handler.startAction("Unpacking", npacks); udata = UninstallData.getInstance(); // Custom action listener stuff --- load listeners ---- List [] customActions = getCustomActions(); // Custom action listener stuff --- beforePacks ---- informListeners(customActions, InstallerListener.BEFORE_PACKS,idata, new Integer(npacks), handler); // We unpack the selected packs for (int i = 0; i < npacks; i++) { // We get the pack stream int n = idata.allPacks.indexOf(packs.get(i)); // Custom action listener stuff --- beforePack ---- informListeners(customActions, InstallerListener.BEFORE_PACK,packs.get(i), new Integer(npacks), handler); ObjectInputStream objIn = new ObjectInputStream(getPackAsStream(n)); // We unpack the files int nfiles = objIn.readInt(); handler.nextStep(((Pack) packs.get(i)).name, i + 1, nfiles); for (int j = 0; j < nfiles; j++) { // We read the header PackFile pf = (PackFile) objIn.readObject(); if (OsConstraint.oneMatchesCurrentSystem(pf.osConstraints())) { // We translate & build the path String path = translatePath(pf.getTargetPath()); File pathFile = new File(path); File dest = pathFile; if (! pf.isDirectory()) dest = pathFile.getParentFile(); if (!dest.exists()) { // If there are custom actions which would be called at // creating a directory, create it recursively. List fileListeners = customActions[customActions.length - 1]; if( fileListeners != null && fileListeners.size() > 0 ) mkDirsWithEnhancement(dest, pf, customActions ); else // Create it in on step. { if (!dest.mkdirs()) { handler.emitError( "Error creating directories", "Could not create directory\n" + dest.getPath()); handler.stopAction(); return; } } } if (pf.isDirectory()) continue; // Custom action listener stuff --- beforeFile ---- informListeners(customActions, InstallerListener.BEFORE_FILE,pathFile, pf, null); // We add the path to the log, udata.addFile(path); handler.progress(j, path); //if this file exists and should not be overwritten, check //what to do if ((pathFile.exists()) && (pf.override() != PackFile.OVERRIDE_TRUE)) { boolean overwritefile = false; // don't overwrite file if the user said so if (pf.override() != PackFile.OVERRIDE_FALSE) { if (pf.override() == PackFile.OVERRIDE_TRUE) { overwritefile = true; } else if (pf.override() == PackFile.OVERRIDE_UPDATE) { // check mtime of involved files // (this is not 100% perfect, because the already existing file might // still be modified but the new installed is just a bit newer; we would // need the creation time of the existing file or record with which mtime // it was installed...) overwritefile = (pathFile.lastModified() < pf.lastModified()); } else { int def_choice = -1; if (pf.override() == PackFile.OVERRIDE_ASK_FALSE) def_choice = AbstractUIHandler.ANSWER_NO; if (pf.override() == PackFile.OVERRIDE_ASK_TRUE) def_choice = AbstractUIHandler.ANSWER_YES; int answer = handler.askQuestion( idata.langpack.getString("InstallPanel.overwrite.title") + pathFile.getName(), idata.langpack.getString( "InstallPanel.overwrite.question") + pathFile.getAbsolutePath(), AbstractUIHandler.CHOICES_YES_NO, def_choice); overwritefile = (answer == AbstractUIHandler.ANSWER_YES); } } if (!overwritefile) { if (!pf.isBackReference() && !((Pack)packs.get(i)).loose) objIn.skip(pf.length()); continue; } } // We copy the file out = new FileOutputStream(pathFile); byte[] buffer = new byte[5120]; long bytesCopied = 0; InputStream pis = objIn; if (pf.isBackReference()) { InputStream is = getPackAsStream(pf.previousPackNumber); pis = new ObjectInputStream(is); //must wrap for blockdata use by objectstream (otherwise strange result) //skip on underlaying stream (for some reason not possible on ObjectStream) is.skip(pf.offsetInPreviousPack - 4); //but the stream header is now already read (== 4 bytes) } else if(((Pack)packs.get(i)).loose) { pis = new FileInputStream(pf.sourcePath); } while (bytesCopied < pf.length()) { int maxBytes = (int)Math.min(pf.length() - bytesCopied, buffer.length); int bytesInBuffer = pis.read(buffer, 0, maxBytes); if (bytesInBuffer == -1) throw new IOException("Unexpected end of stream"); out.write(buffer, 0, bytesInBuffer); bytesCopied += bytesInBuffer; } // Cleanings out.close(); if (pis != objIn) pis.close(); // Set file modification time if specified if (pf.lastModified() >= 0) pathFile.setLastModified(pf.lastModified()); // Custom action listener stuff --- afterFile ---- informListeners(customActions, InstallerListener.AFTER_FILE,pathFile, pf, null); } else { if (!pf.isBackReference()) objIn.skip(pf.length()); } } // Load information about parsable files int numParsables = objIn.readInt(); for (int k = 0; k < numParsables; k++) { ParsableFile pf = (ParsableFile) objIn.readObject(); pf.path = translatePath(pf.path); parsables.add(pf); } // Load information about executable files int numExecutables = objIn.readInt(); for (int k = 0; k < numExecutables; k++) { ExecutableFile ef = (ExecutableFile) objIn.readObject(); ef.path = translatePath(ef.path); if (null != ef.argList && !ef.argList.isEmpty()) { String arg = null; for (int j = 0; j < ef.argList.size(); j++) { arg = (String) ef.argList.get(j); arg = translatePath(arg); ef.argList.set(j, arg); } } executables.add(ef); if (ef.executionStage == ExecutableFile.UNINSTALL) { udata.addExecutable(ef); } } // Custom action listener stuff --- uninstall data ---- handleAdditionalUninstallData(udata, customActions); // Load information about updatechecks int numUpdateChecks = objIn.readInt(); for (int k = 0; k < numUpdateChecks; k++) { UpdateCheck uc = (UpdateCheck) objIn.readObject(); updatechecks.add(uc); } objIn.close(); // Custom action listener stuff --- afterPack ---- informListeners(customActions, InstallerListener.AFTER_PACK, packs.get(i), new Integer(i), handler); } // We use the scripts parser ScriptParser parser = new ScriptParser(parsables, vs); parser.parseFiles(); // We use the file executor FileExecutor executor = new FileExecutor(executables); if (executor.executeFiles(ExecutableFile.POSTINSTALL, handler) != 0) handler.emitError( "File execution failed", "The installation was not completed"); // We put the uninstaller (it's not yet complete...) putUninstaller(); // update checks _after_ uninstaller was put, so we don't delete it performUpdateChecks(updatechecks); // Custom action listener stuff --- afterPacks ---- informListeners(customActions, InstallerListener.AFTER_PACKS,idata, handler, null); // The end :-) handler.stopAction(); } catch (Exception err) { // TODO: finer grained error handling with useful error messages handler.stopAction(); handler.emitError("An error occured", err.toString()); err.printStackTrace(); } finally { instances.remove(instances.indexOf(this)); } }
3,239,783
public void run() { instances.add(this); try { // // Initialisations FileOutputStream out = null; ArrayList parsables = new ArrayList(); ArrayList executables = new ArrayList(); ArrayList updatechecks = new ArrayList(); List packs = idata.selectedPacks; int npacks = packs.size(); handler.startAction("Unpacking", npacks); udata = UninstallData.getInstance(); // Custom action listener stuff --- load listeners ---- List [] customActions = getCustomActions(); // Custom action listener stuff --- beforePacks ---- informListeners(customActions, InstallerListener.BEFORE_PACKS,idata, new Integer(npacks), handler); // We unpack the selected packs for (int i = 0; i < npacks; i++) { // We get the pack stream int n = idata.allPacks.indexOf(packs.get(i)); // Custom action listener stuff --- beforePack ---- informListeners(customActions, InstallerListener.BEFORE_PACK,packs.get(i), new Integer(npacks), handler); ObjectInputStream objIn = new ObjectInputStream(getPackAsStream(n)); // We unpack the files int nfiles = objIn.readInt(); handler.nextStep(((Pack) packs.get(i)).name, i + 1, nfiles); for (int j = 0; j < nfiles; j++) { // We read the header PackFile pf = (PackFile) objIn.readObject(); if (OsConstraint.oneMatchesCurrentSystem(pf.osConstraints())) { // We translate & build the path String path = translatePath(pf.getTargetPath()); File pathFile = new File(path); File dest = pathFile; if (! pf.isDirectory()) dest = pathFile.getParentFile(); if (!dest.exists()) { // If there are custom actions which would be called at // creating a directory, create it recursively. List fileListeners = customActions[customActions.length - 1]; if( fileListeners != null && fileListeners.size() > 0 ) mkDirsWithEnhancement(dest, pf, customActions ); else // Create it in on step. { if (!dest.mkdirs()) { handler.emitError( "Error creating directories", "Could not create directory\n" + dest.getPath()); handler.stopAction(); return; } } } if (pf.isDirectory()) continue; // Custom action listener stuff --- beforeFile ---- informListeners(customActions, InstallerListener.BEFORE_FILE,pathFile, pf, null); // We add the path to the log, udata.addFile(path); handler.progress(j, path); //if this file exists and should not be overwritten, check //what to do if ((pathFile.exists()) && (pf.override() != PackFile.OVERRIDE_TRUE)) { boolean overwritefile = false; // don't overwrite file if the user said so if (pf.override() != PackFile.OVERRIDE_FALSE) { if (pf.override() == PackFile.OVERRIDE_TRUE) { overwritefile = true; } else if (pf.override() == PackFile.OVERRIDE_UPDATE) { // check mtime of involved files // (this is not 100% perfect, because the already existing file might // still be modified but the new installed is just a bit newer; we would // need the creation time of the existing file or record with which mtime // it was installed...) overwritefile = (pathFile.lastModified() < pf.lastModified()); } else { int def_choice = -1; if (pf.override() == PackFile.OVERRIDE_ASK_FALSE) def_choice = AbstractUIHandler.ANSWER_NO; if (pf.override() == PackFile.OVERRIDE_ASK_TRUE) def_choice = AbstractUIHandler.ANSWER_YES; int answer = handler.askQuestion( idata.langpack.getString("InstallPanel.overwrite.title") + pathFile.getName(), idata.langpack.getString( "InstallPanel.overwrite.question") + pathFile.getAbsolutePath(), AbstractUIHandler.CHOICES_YES_NO, def_choice); overwritefile = (answer == AbstractUIHandler.ANSWER_YES); } } if (!overwritefile) { if (!pf.isBackReference() && !((Pack)packs.get(i)).loose) objIn.skip(pf.length()); continue; } } // We copy the file out = new FileOutputStream(pathFile); byte[] buffer = new byte[5120]; long bytesCopied = 0; InputStream pis = objIn; if (pf.isBackReference()) { InputStream is = getPackAsStream(pf.previousPackNumber); pis = new ObjectInputStream(is); //must wrap for blockdata use by objectstream (otherwise strange result) //skip on underlaying stream (for some reason not possible on ObjectStream) is.skip(pf.offsetInPreviousPack - 4); //but the stream header is now already read (== 4 bytes) } else if(((Pack)packs.get(i)).loose) { pis = new FileInputStream(pf.sourcePath); } while (bytesCopied < pf.length()) { int maxBytes = (int)Math.min(pf.length() - bytesCopied, buffer.length); int bytesInBuffer = pis.read(buffer, 0, maxBytes); if (bytesInBuffer == -1) throw new IOException("Unexpected end of stream"); out.write(buffer, 0, bytesInBuffer); bytesCopied += bytesInBuffer; } // Cleanings out.close(); if (pis != objIn) pis.close(); // Set file modification time if specified if (pf.lastModified() >= 0) pathFile.setLastModified(pf.lastModified()); // Custom action listener stuff --- afterFile ---- informListeners(customActions, InstallerListener.AFTER_FILE,pathFile, pf, null); } else { if (!pf.isBackReference()) objIn.skip(pf.length()); } } // Load information about parsable files int numParsables = objIn.readInt(); for (int k = 0; k < numParsables; k++) { ParsableFile pf = (ParsableFile) objIn.readObject(); pf.path = translatePath(pf.path); parsables.add(pf); } // Load information about executable files int numExecutables = objIn.readInt(); for (int k = 0; k < numExecutables; k++) { ExecutableFile ef = (ExecutableFile) objIn.readObject(); ef.path = translatePath(ef.path); if (null != ef.argList && !ef.argList.isEmpty()) { String arg = null; for (int j = 0; j < ef.argList.size(); j++) { arg = (String) ef.argList.get(j); arg = translatePath(arg); ef.argList.set(j, arg); } } executables.add(ef); if (ef.executionStage == ExecutableFile.UNINSTALL) { udata.addExecutable(ef); } } // Custom action listener stuff --- uninstall data ---- handleAdditionalUninstallData(udata, customActions); // Load information about updatechecks int numUpdateChecks = objIn.readInt(); for (int k = 0; k < numUpdateChecks; k++) { UpdateCheck uc = (UpdateCheck) objIn.readObject(); updatechecks.add(uc); } objIn.close(); // Custom action listener stuff --- afterPack ---- informListeners(customActions, InstallerListener.AFTER_PACK, packs.get(i), new Integer(i), handler); } // We use the scripts parser ScriptParser parser = new ScriptParser(parsables, vs); parser.parseFiles(); // We use the file executor FileExecutor executor = new FileExecutor(executables); if (executor.executeFiles(ExecutableFile.POSTINSTALL, handler) != 0) handler.emitError( "File execution failed", "The installation was not completed"); // We put the uninstaller (it's not yet complete...) putUninstaller(); // update checks _after_ uninstaller was put, so we don't delete it performUpdateChecks(updatechecks); // Custom action listener stuff --- afterPacks ---- informListeners(customActions, InstallerListener.AFTER_PACKS,idata, handler, null); // The end :-) handler.stopAction(); } catch (Exception err) { // TODO: finer grained error handling with useful error messages handler.stopAction(); handler.emitError("An error occured", err.toString()); err.printStackTrace(); } finally { instances.remove(instances.indexOf(this)); } }
public void run() { instances.add(this); try { // // Initialisations FileOutputStream out = null; ArrayList parsables = new ArrayList(); ArrayList executables = new ArrayList(); ArrayList updatechecks = new ArrayList(); List packs = idata.selectedPacks; int npacks = packs.size(); handler.startAction("Unpacking", npacks); udata = UninstallData.getInstance(); // Custom action listener stuff --- load listeners ---- List [] customActions = getCustomActions(); // Custom action listener stuff --- beforePacks ---- informListeners(customActions, InstallerListener.BEFORE_PACKS,idata, new Integer(npacks), handler); // We unpack the selected packs for (int i = 0; i < npacks; i++) { // We get the pack stream int n = idata.allPacks.indexOf(packs.get(i)); // Custom action listener stuff --- beforePack ---- informListeners(customActions, InstallerListener.BEFORE_PACK,packs.get(i), new Integer(npacks), handler); ObjectInputStream objIn = new ObjectInputStream(getPackAsStream(n)); // We unpack the files int nfiles = objIn.readInt(); handler.nextStep(((Pack) packs.get(i)).name, i + 1, nfiles); for (int j = 0; j < nfiles; j++) { // We read the header PackFile pf = (PackFile) objIn.readObject(); if (OsConstraint.oneMatchesCurrentSystem(pf.osConstraints())) { // We translate & build the path String path = translatePath(pf.getTargetPath()); File pathFile = new File(path); File dest = pathFile; if (! pf.isDirectory()) dest = pathFile.getParentFile(); if (!dest.exists()) { // If there are custom actions which would be called at // creating a directory, create it recursively. List fileListeners = customActions[customActions.length - 1]; if( fileListeners != null && fileListeners.size() > 0 ) mkDirsWithEnhancement(dest, pf, customActions ); else // Create it in on step. { if (!dest.mkdirs()) { handler.emitError( "Error creating directories", "Could not create directory\n" + dest.getPath()); handler.stopAction(); return; } } } if (pf.isDirectory()) continue; // Custom action listener stuff --- beforeFile ---- informListeners(customActions, InstallerListener.BEFORE_FILE,pathFile, pf, null); // We add the path to the log, udata.addFile(path); handler.progress(j, path); //if this file exists and should not be overwritten, check //what to do if ((pathFile.exists()) && (pf.override() != PackFile.OVERRIDE_TRUE)) { boolean overwritefile = false; // don't overwrite file if the user said so if (pf.override() != PackFile.OVERRIDE_FALSE) { if (pf.override() == PackFile.OVERRIDE_TRUE) { overwritefile = true; } else if (pf.override() == PackFile.OVERRIDE_UPDATE) { // check mtime of involved files // (this is not 100% perfect, because the already existing file might // still be modified but the new installed is just a bit newer; we would // need the creation time of the existing file or record with which mtime // it was installed...) overwritefile = (pathFile.lastModified() < pf.lastModified()); } else { int def_choice = -1; if (pf.override() == PackFile.OVERRIDE_ASK_FALSE) def_choice = AbstractUIHandler.ANSWER_NO; if (pf.override() == PackFile.OVERRIDE_ASK_TRUE) def_choice = AbstractUIHandler.ANSWER_YES; int answer = handler.askQuestion( idata.langpack.getString("InstallPanel.overwrite.title") + pathFile.getName(), idata.langpack.getString( "InstallPanel.overwrite.question") + pathFile.getAbsolutePath(), AbstractUIHandler.CHOICES_YES_NO, def_choice); overwritefile = (answer == AbstractUIHandler.ANSWER_YES); } } if (!overwritefile) { if (!pf.isBackReference() && !((Pack)packs.get(i)).loose) objIn.skip(pf.length()); continue; } } // We copy the file out = new FileOutputStream(pathFile); byte[] buffer = new byte[5120]; long bytesCopied = 0; InputStream pis = objIn; if (pf.isBackReference()) { InputStream is = getPackAsStream(pf.previousPackNumber); pis = new ObjectInputStream(is); //must wrap for blockdata use by objectstream (otherwise strange result) //skip on underlaying stream (for some reason not possible on ObjectStream) is.skip(pf.offsetInPreviousPack - 4); //but the stream header is now already read (== 4 bytes) } else if(((Pack)packs.get(i)).loose) { pis = new FileInputStream(pf.sourcePath); } while (bytesCopied < pf.length()) { int maxBytes = (int)Math.min(pf.length() - bytesCopied, buffer.length); int bytesInBuffer = pis.read(buffer, 0, maxBytes); if (bytesInBuffer == -1) throw new IOException("Unexpected end of stream"); out.write(buffer, 0, bytesInBuffer); bytesCopied += bytesInBuffer; } // Cleanings out.close(); if (pis != objIn) pis.close(); // Set file modification time if specified if (pf.lastModified() >= 0) pathFile.setLastModified(pf.lastModified()); // Custom action listener stuff --- afterFile ---- informListeners(customActions, InstallerListener.AFTER_FILE,pathFile, pf, null); } else { if (!pf.isBackReference()) objIn.skip(pf.length()); } } // Load information about parsable files int numParsables = objIn.readInt(); for (int k = 0; k < numParsables; k++) { ParsableFile pf = (ParsableFile) objIn.readObject(); pf.path = translatePath(pf.path); parsables.add(pf); } // Load information about executable files int numExecutables = objIn.readInt(); for (int k = 0; k < numExecutables; k++) { ExecutableFile ef = (ExecutableFile) objIn.readObject(); ef.path = translatePath(ef.path); if (null != ef.argList && !ef.argList.isEmpty()) { String arg = null; for (int j = 0; j < ef.argList.size(); j++) { arg = (String) ef.argList.get(j); arg = translatePath(arg); ef.argList.set(j, arg); } } executables.add(ef); if (ef.executionStage == ExecutableFile.UNINSTALL) { udata.addExecutable(ef); } } // Custom action listener stuff --- uninstall data ---- handleAdditionalUninstallData(udata, customActions); // Load information about updatechecks int numUpdateChecks = objIn.readInt(); for (int k = 0; k < numUpdateChecks; k++) { UpdateCheck uc = (UpdateCheck) objIn.readObject(); updatechecks.add(uc); } objIn.close(); // Custom action listener stuff --- afterPack ---- informListeners(customActions, InstallerListener.AFTER_PACK, packs.get(i), new Integer(i), handler); } // We use the scripts parser ScriptParser parser = new ScriptParser(parsables, vs); parser.parseFiles(); // We use the file executor FileExecutor executor = new FileExecutor(executables); if (executor.executeFiles(ExecutableFile.POSTINSTALL, handler) != 0) handler.emitError( "File execution failed", "The installation was not completed"); // We put the uninstaller (it's not yet complete...) putUninstaller(); // update checks _after_ uninstaller was put, so we don't delete it performUpdateChecks(updatechecks); // Custom action listener stuff --- afterPacks ---- informListeners(customActions, InstallerListener.AFTER_PACKS,idata, handler, null); // The end :-) handler.stopAction(); } catch (Exception err) { // TODO: finer grained error handling with useful error messages handler.stopAction(); handler.emitError("An error occured", err.toString()); err.printStackTrace(); } finally { instances.remove(instances.indexOf(this)); } }
3,239,784
public void run() { instances.add(this); try { // // Initialisations FileOutputStream out = null; ArrayList parsables = new ArrayList(); ArrayList executables = new ArrayList(); ArrayList updatechecks = new ArrayList(); List packs = idata.selectedPacks; int npacks = packs.size(); handler.startAction("Unpacking", npacks); udata = UninstallData.getInstance(); // Custom action listener stuff --- load listeners ---- List [] customActions = getCustomActions(); // Custom action listener stuff --- beforePacks ---- informListeners(customActions, InstallerListener.BEFORE_PACKS,idata, new Integer(npacks), handler); // We unpack the selected packs for (int i = 0; i < npacks; i++) { // We get the pack stream int n = idata.allPacks.indexOf(packs.get(i)); // Custom action listener stuff --- beforePack ---- informListeners(customActions, InstallerListener.BEFORE_PACK,packs.get(i), new Integer(npacks), handler); ObjectInputStream objIn = new ObjectInputStream(getPackAsStream(n)); // We unpack the files int nfiles = objIn.readInt(); handler.nextStep(((Pack) packs.get(i)).name, i + 1, nfiles); for (int j = 0; j < nfiles; j++) { // We read the header PackFile pf = (PackFile) objIn.readObject(); if (OsConstraint.oneMatchesCurrentSystem(pf.osConstraints())) { // We translate & build the path String path = translatePath(pf.getTargetPath()); File pathFile = new File(path); File dest = pathFile; if (! pf.isDirectory()) dest = pathFile.getParentFile(); if (!dest.exists()) { // If there are custom actions which would be called at // creating a directory, create it recursively. List fileListeners = customActions[customActions.length - 1]; if( fileListeners != null && fileListeners.size() > 0 ) mkDirsWithEnhancement(dest, pf, customActions ); else // Create it in on step. { if (!dest.mkdirs()) { handler.emitError( "Error creating directories", "Could not create directory\n" + dest.getPath()); handler.stopAction(); return; } } } if (pf.isDirectory()) continue; // Custom action listener stuff --- beforeFile ---- informListeners(customActions, InstallerListener.BEFORE_FILE,pathFile, pf, null); // We add the path to the log, udata.addFile(path); handler.progress(j, path); //if this file exists and should not be overwritten, check //what to do if ((pathFile.exists()) && (pf.override() != PackFile.OVERRIDE_TRUE)) { boolean overwritefile = false; // don't overwrite file if the user said so if (pf.override() != PackFile.OVERRIDE_FALSE) { if (pf.override() == PackFile.OVERRIDE_TRUE) { overwritefile = true; } else if (pf.override() == PackFile.OVERRIDE_UPDATE) { // check mtime of involved files // (this is not 100% perfect, because the already existing file might // still be modified but the new installed is just a bit newer; we would // need the creation time of the existing file or record with which mtime // it was installed...) overwritefile = (pathFile.lastModified() < pf.lastModified()); } else { int def_choice = -1; if (pf.override() == PackFile.OVERRIDE_ASK_FALSE) def_choice = AbstractUIHandler.ANSWER_NO; if (pf.override() == PackFile.OVERRIDE_ASK_TRUE) def_choice = AbstractUIHandler.ANSWER_YES; int answer = handler.askQuestion( idata.langpack.getString("InstallPanel.overwrite.title") + pathFile.getName(), idata.langpack.getString( "InstallPanel.overwrite.question") + pathFile.getAbsolutePath(), AbstractUIHandler.CHOICES_YES_NO, def_choice); overwritefile = (answer == AbstractUIHandler.ANSWER_YES); } } if (!overwritefile) { if (!pf.isBackReference() && !((Pack)packs.get(i)).loose) objIn.skip(pf.length()); continue; } } // We copy the file out = new FileOutputStream(pathFile); byte[] buffer = new byte[5120]; long bytesCopied = 0; InputStream pis = objIn; if (pf.isBackReference()) { InputStream is = getPackAsStream(pf.previousPackNumber); pis = new ObjectInputStream(is); //must wrap for blockdata use by objectstream (otherwise strange result) //skip on underlaying stream (for some reason not possible on ObjectStream) is.skip(pf.offsetInPreviousPack - 4); //but the stream header is now already read (== 4 bytes) } else if(((Pack)packs.get(i)).loose) { pis = new FileInputStream(pf.sourcePath); } while (bytesCopied < pf.length()) { int maxBytes = (int)Math.min(pf.length() - bytesCopied, buffer.length); int bytesInBuffer = pis.read(buffer, 0, maxBytes); if (bytesInBuffer == -1) throw new IOException("Unexpected end of stream"); out.write(buffer, 0, bytesInBuffer); bytesCopied += bytesInBuffer; } // Cleanings out.close(); if (pis != objIn) pis.close(); // Set file modification time if specified if (pf.lastModified() >= 0) pathFile.setLastModified(pf.lastModified()); // Custom action listener stuff --- afterFile ---- informListeners(customActions, InstallerListener.AFTER_FILE,pathFile, pf, null); } else { if (!pf.isBackReference()) objIn.skip(pf.length()); } } // Load information about parsable files int numParsables = objIn.readInt(); for (int k = 0; k < numParsables; k++) { ParsableFile pf = (ParsableFile) objIn.readObject(); pf.path = translatePath(pf.path); parsables.add(pf); } // Load information about executable files int numExecutables = objIn.readInt(); for (int k = 0; k < numExecutables; k++) { ExecutableFile ef = (ExecutableFile) objIn.readObject(); ef.path = translatePath(ef.path); if (null != ef.argList && !ef.argList.isEmpty()) { String arg = null; for (int j = 0; j < ef.argList.size(); j++) { arg = (String) ef.argList.get(j); arg = translatePath(arg); ef.argList.set(j, arg); } } executables.add(ef); if (ef.executionStage == ExecutableFile.UNINSTALL) { udata.addExecutable(ef); } } // Custom action listener stuff --- uninstall data ---- handleAdditionalUninstallData(udata, customActions); // Load information about updatechecks int numUpdateChecks = objIn.readInt(); for (int k = 0; k < numUpdateChecks; k++) { UpdateCheck uc = (UpdateCheck) objIn.readObject(); updatechecks.add(uc); } objIn.close(); // Custom action listener stuff --- afterPack ---- informListeners(customActions, InstallerListener.AFTER_PACK, packs.get(i), new Integer(i), handler); } // We use the scripts parser ScriptParser parser = new ScriptParser(parsables, vs); parser.parseFiles(); // We use the file executor FileExecutor executor = new FileExecutor(executables); if (executor.executeFiles(ExecutableFile.POSTINSTALL, handler) != 0) handler.emitError( "File execution failed", "The installation was not completed"); // We put the uninstaller (it's not yet complete...) putUninstaller(); // update checks _after_ uninstaller was put, so we don't delete it performUpdateChecks(updatechecks); // Custom action listener stuff --- afterPacks ---- informListeners(customActions, InstallerListener.AFTER_PACKS,idata, handler, null); // The end :-) handler.stopAction(); } catch (Exception err) { // TODO: finer grained error handling with useful error messages handler.stopAction(); handler.emitError("An error occured", err.toString()); err.printStackTrace(); } finally { instances.remove(instances.indexOf(this)); } }
public void run() { instances.add(this); try { // // Initialisations FileOutputStream out = null; ArrayList parsables = new ArrayList(); ArrayList executables = new ArrayList(); ArrayList updatechecks = new ArrayList(); List packs = idata.selectedPacks; int npacks = packs.size(); handler.startAction("Unpacking", npacks); udata = UninstallData.getInstance(); // Custom action listener stuff --- load listeners ---- List [] customActions = getCustomActions(); // Custom action listener stuff --- beforePacks ---- informListeners(customActions, InstallerListener.BEFORE_PACKS,idata, new Integer(npacks), handler); // We unpack the selected packs for (int i = 0; i < npacks; i++) { // We get the pack stream int n = idata.allPacks.indexOf(packs.get(i)); // Custom action listener stuff --- beforePack ---- informListeners(customActions, InstallerListener.BEFORE_PACK,packs.get(i), new Integer(npacks), handler); ObjectInputStream objIn = new ObjectInputStream(getPackAsStream(n)); // We unpack the files int nfiles = objIn.readInt(); handler.nextStep(((Pack) packs.get(i)).name, i + 1, nfiles); for (int j = 0; j < nfiles; j++) { // We read the header PackFile pf = (PackFile) objIn.readObject(); if (OsConstraint.oneMatchesCurrentSystem(pf.osConstraints())) { // We translate & build the path String path = translatePath(pf.getTargetPath()); File pathFile = new File(path); File dest = pathFile; if (! pf.isDirectory()) dest = pathFile.getParentFile(); if (!dest.exists()) { // If there are custom actions which would be called at // creating a directory, create it recursively. List fileListeners = customActions[customActions.length - 1]; if( fileListeners != null && fileListeners.size() > 0 ) mkDirsWithEnhancement(dest, pf, customActions ); else // Create it in on step. { if (!dest.mkdirs()) { handler.emitError( "Error creating directories", "Could not create directory\n" + dest.getPath()); handler.stopAction(); return; } } } if (pf.isDirectory()) continue; // Custom action listener stuff --- beforeFile ---- informListeners(customActions, InstallerListener.BEFORE_FILE,pathFile, pf, null); // We add the path to the log, udata.addFile(path); handler.progress(j, path); //if this file exists and should not be overwritten, check //what to do if ((pathFile.exists()) && (pf.override() != PackFile.OVERRIDE_TRUE)) { boolean overwritefile = false; // don't overwrite file if the user said so if (pf.override() != PackFile.OVERRIDE_FALSE) { if (pf.override() == PackFile.OVERRIDE_TRUE) { overwritefile = true; } else if (pf.override() == PackFile.OVERRIDE_UPDATE) { // check mtime of involved files // (this is not 100% perfect, because the already existing file might // still be modified but the new installed is just a bit newer; we would // need the creation time of the existing file or record with which mtime // it was installed...) overwritefile = (pathFile.lastModified() < pf.lastModified()); } else { int def_choice = -1; if (pf.override() == PackFile.OVERRIDE_ASK_FALSE) def_choice = AbstractUIHandler.ANSWER_NO; if (pf.override() == PackFile.OVERRIDE_ASK_TRUE) def_choice = AbstractUIHandler.ANSWER_YES; int answer = handler.askQuestion( idata.langpack.getString("InstallPanel.overwrite.title") + pathFile.getName(), idata.langpack.getString( "InstallPanel.overwrite.question") + pathFile.getAbsolutePath(), AbstractUIHandler.CHOICES_YES_NO, def_choice); overwritefile = (answer == AbstractUIHandler.ANSWER_YES); } } if (!overwritefile) { if (!pf.isBackReference() && !((Pack)packs.get(i)).loose) objIn.skip(pf.length()); continue; } } // We copy the file out = new FileOutputStream(pathFile); byte[] buffer = new byte[5120]; long bytesCopied = 0; InputStream pis = objIn; if (pf.isBackReference()) { InputStream is = getPackAsStream(pf.previousPackNumber); pis = new ObjectInputStream(is); //must wrap for blockdata use by objectstream (otherwise strange result) //skip on underlaying stream (for some reason not possible on ObjectStream) is.skip(pf.offsetInPreviousPack - 4); //but the stream header is now already read (== 4 bytes) } else if(((Pack)packs.get(i)).loose) { pis = new FileInputStream(pf.sourcePath); } while (bytesCopied < pf.length()) { int maxBytes = (int)Math.min(pf.length() - bytesCopied, buffer.length); int bytesInBuffer = pis.read(buffer, 0, maxBytes); if (bytesInBuffer == -1) throw new IOException("Unexpected end of stream"); out.write(buffer, 0, bytesInBuffer); bytesCopied += bytesInBuffer; } // Cleanings out.close(); if (pis != objIn) pis.close(); // Set file modification time if specified if (pf.lastModified() >= 0) pathFile.setLastModified(pf.lastModified()); // Custom action listener stuff --- afterFile ---- informListeners(customActions, InstallerListener.AFTER_FILE,pathFile, pf, null); } else { if (!pf.isBackReference()) objIn.skip(pf.length()); } } // Load information about parsable files int numParsables = objIn.readInt(); for (int k = 0; k < numParsables; k++) { ParsableFile pf = (ParsableFile) objIn.readObject(); pf.path = translatePath(pf.path); parsables.add(pf); } // Load information about executable files int numExecutables = objIn.readInt(); for (int k = 0; k < numExecutables; k++) { ExecutableFile ef = (ExecutableFile) objIn.readObject(); ef.path = translatePath(ef.path); if (null != ef.argList && !ef.argList.isEmpty()) { String arg = null; for (int j = 0; j < ef.argList.size(); j++) { arg = (String) ef.argList.get(j); arg = translatePath(arg); ef.argList.set(j, arg); } } executables.add(ef); if (ef.executionStage == ExecutableFile.UNINSTALL) { udata.addExecutable(ef); } } // Custom action listener stuff --- uninstall data ---- handleAdditionalUninstallData(udata, customActions); // Load information about updatechecks int numUpdateChecks = objIn.readInt(); for (int k = 0; k < numUpdateChecks; k++) { UpdateCheck uc = (UpdateCheck) objIn.readObject(); updatechecks.add(uc); } objIn.close(); // Custom action listener stuff --- afterPack ---- informListeners(customActions, InstallerListener.AFTER_PACK, packs.get(i), new Integer(i), handler); } // We use the scripts parser ScriptParser parser = new ScriptParser(parsables, vs); parser.parseFiles(); // We use the file executor FileExecutor executor = new FileExecutor(executables); if (executor.executeFiles(ExecutableFile.POSTINSTALL, handler) != 0) handler.emitError( "File execution failed", "The installation was not completed"); // We put the uninstaller (it's not yet complete...) putUninstaller(); // update checks _after_ uninstaller was put, so we don't delete it performUpdateChecks(updatechecks); // Custom action listener stuff --- afterPacks ---- informListeners(customActions, InstallerListener.AFTER_PACKS,idata, handler, null); // The end :-) handler.stopAction(); } catch (Exception err) { // TODO: finer grained error handling with useful error messages handler.stopAction(); handler.emitError("An error occured", err.toString()); err.printStackTrace(); } finally { instances.remove(instances.indexOf(this)); } }
3,239,785
public void run() { instances.add(this); try { // // Initialisations FileOutputStream out = null; ArrayList parsables = new ArrayList(); ArrayList executables = new ArrayList(); ArrayList updatechecks = new ArrayList(); List packs = idata.selectedPacks; int npacks = packs.size(); handler.startAction("Unpacking", npacks); udata = UninstallData.getInstance(); // Custom action listener stuff --- load listeners ---- List [] customActions = getCustomActions(); // Custom action listener stuff --- beforePacks ---- informListeners(customActions, InstallerListener.BEFORE_PACKS,idata, new Integer(npacks), handler); // We unpack the selected packs for (int i = 0; i < npacks; i++) { // We get the pack stream int n = idata.allPacks.indexOf(packs.get(i)); // Custom action listener stuff --- beforePack ---- informListeners(customActions, InstallerListener.BEFORE_PACK,packs.get(i), new Integer(npacks), handler); ObjectInputStream objIn = new ObjectInputStream(getPackAsStream(n)); // We unpack the files int nfiles = objIn.readInt(); handler.nextStep(((Pack) packs.get(i)).name, i + 1, nfiles); for (int j = 0; j < nfiles; j++) { // We read the header PackFile pf = (PackFile) objIn.readObject(); if (OsConstraint.oneMatchesCurrentSystem(pf.osConstraints())) { // We translate & build the path String path = translatePath(pf.getTargetPath()); File pathFile = new File(path); File dest = pathFile; if (! pf.isDirectory()) dest = pathFile.getParentFile(); if (!dest.exists()) { // If there are custom actions which would be called at // creating a directory, create it recursively. List fileListeners = customActions[customActions.length - 1]; if( fileListeners != null && fileListeners.size() > 0 ) mkDirsWithEnhancement(dest, pf, customActions ); else // Create it in on step. { if (!dest.mkdirs()) { handler.emitError( "Error creating directories", "Could not create directory\n" + dest.getPath()); handler.stopAction(); return; } } } if (pf.isDirectory()) continue; // Custom action listener stuff --- beforeFile ---- informListeners(customActions, InstallerListener.BEFORE_FILE,pathFile, pf, null); // We add the path to the log, udata.addFile(path); handler.progress(j, path); //if this file exists and should not be overwritten, check //what to do if ((pathFile.exists()) && (pf.override() != PackFile.OVERRIDE_TRUE)) { boolean overwritefile = false; // don't overwrite file if the user said so if (pf.override() != PackFile.OVERRIDE_FALSE) { if (pf.override() == PackFile.OVERRIDE_TRUE) { overwritefile = true; } else if (pf.override() == PackFile.OVERRIDE_UPDATE) { // check mtime of involved files // (this is not 100% perfect, because the already existing file might // still be modified but the new installed is just a bit newer; we would // need the creation time of the existing file or record with which mtime // it was installed...) overwritefile = (pathFile.lastModified() < pf.lastModified()); } else { int def_choice = -1; if (pf.override() == PackFile.OVERRIDE_ASK_FALSE) def_choice = AbstractUIHandler.ANSWER_NO; if (pf.override() == PackFile.OVERRIDE_ASK_TRUE) def_choice = AbstractUIHandler.ANSWER_YES; int answer = handler.askQuestion( idata.langpack.getString("InstallPanel.overwrite.title") + pathFile.getName(), idata.langpack.getString( "InstallPanel.overwrite.question") + pathFile.getAbsolutePath(), AbstractUIHandler.CHOICES_YES_NO, def_choice); overwritefile = (answer == AbstractUIHandler.ANSWER_YES); } } if (!overwritefile) { if (!pf.isBackReference() && !((Pack)packs.get(i)).loose) objIn.skip(pf.length()); continue; } } // We copy the file out = new FileOutputStream(pathFile); byte[] buffer = new byte[5120]; long bytesCopied = 0; InputStream pis = objIn; if (pf.isBackReference()) { InputStream is = getPackAsStream(pf.previousPackNumber); pis = new ObjectInputStream(is); //must wrap for blockdata use by objectstream (otherwise strange result) //skip on underlaying stream (for some reason not possible on ObjectStream) is.skip(pf.offsetInPreviousPack - 4); //but the stream header is now already read (== 4 bytes) } else if(((Pack)packs.get(i)).loose) { pis = new FileInputStream(pf.sourcePath); } while (bytesCopied < pf.length()) { int maxBytes = (int)Math.min(pf.length() - bytesCopied, buffer.length); int bytesInBuffer = pis.read(buffer, 0, maxBytes); if (bytesInBuffer == -1) throw new IOException("Unexpected end of stream"); out.write(buffer, 0, bytesInBuffer); bytesCopied += bytesInBuffer; } // Cleanings out.close(); if (pis != objIn) pis.close(); // Set file modification time if specified if (pf.lastModified() >= 0) pathFile.setLastModified(pf.lastModified()); // Custom action listener stuff --- afterFile ---- informListeners(customActions, InstallerListener.AFTER_FILE,pathFile, pf, null); } else { if (!pf.isBackReference()) objIn.skip(pf.length()); } } // Load information about parsable files int numParsables = objIn.readInt(); for (int k = 0; k < numParsables; k++) { ParsableFile pf = (ParsableFile) objIn.readObject(); pf.path = translatePath(pf.path); parsables.add(pf); } // Load information about executable files int numExecutables = objIn.readInt(); for (int k = 0; k < numExecutables; k++) { ExecutableFile ef = (ExecutableFile) objIn.readObject(); ef.path = translatePath(ef.path); if (null != ef.argList && !ef.argList.isEmpty()) { String arg = null; for (int j = 0; j < ef.argList.size(); j++) { arg = (String) ef.argList.get(j); arg = translatePath(arg); ef.argList.set(j, arg); } } executables.add(ef); if (ef.executionStage == ExecutableFile.UNINSTALL) { udata.addExecutable(ef); } } // Custom action listener stuff --- uninstall data ---- handleAdditionalUninstallData(udata, customActions); // Load information about updatechecks int numUpdateChecks = objIn.readInt(); for (int k = 0; k < numUpdateChecks; k++) { UpdateCheck uc = (UpdateCheck) objIn.readObject(); updatechecks.add(uc); } objIn.close(); // Custom action listener stuff --- afterPack ---- informListeners(customActions, InstallerListener.AFTER_PACK, packs.get(i), new Integer(i), handler); } // We use the scripts parser ScriptParser parser = new ScriptParser(parsables, vs); parser.parseFiles(); // We use the file executor FileExecutor executor = new FileExecutor(executables); if (executor.executeFiles(ExecutableFile.POSTINSTALL, handler) != 0) handler.emitError( "File execution failed", "The installation was not completed"); // We put the uninstaller (it's not yet complete...) putUninstaller(); // update checks _after_ uninstaller was put, so we don't delete it performUpdateChecks(updatechecks); // Custom action listener stuff --- afterPacks ---- informListeners(customActions, InstallerListener.AFTER_PACKS,idata, handler, null); // The end :-) handler.stopAction(); } catch (Exception err) { // TODO: finer grained error handling with useful error messages handler.stopAction(); handler.emitError("An error occured", err.toString()); err.printStackTrace(); } finally { instances.remove(instances.indexOf(this)); } }
public void run() { instances.add(this); try { // // Initialisations FileOutputStream out = null; ArrayList parsables = new ArrayList(); ArrayList executables = new ArrayList(); ArrayList updatechecks = new ArrayList(); List packs = idata.selectedPacks; int npacks = packs.size(); handler.startAction("Unpacking", npacks); udata = UninstallData.getInstance(); // Custom action listener stuff --- load listeners ---- List [] customActions = getCustomActions(); // Custom action listener stuff --- beforePacks ---- informListeners(customActions, InstallerListener.BEFORE_PACKS,idata, new Integer(npacks), handler); // We unpack the selected packs for (int i = 0; i < npacks; i++) { // We get the pack stream int n = idata.allPacks.indexOf(packs.get(i)); // Custom action listener stuff --- beforePack ---- informListeners(customActions, InstallerListener.BEFORE_PACK,packs.get(i), new Integer(npacks), handler); ObjectInputStream objIn = new ObjectInputStream(getPackAsStream(n)); // We unpack the files int nfiles = objIn.readInt(); handler.nextStep(((Pack) packs.get(i)).name, i + 1, nfiles); for (int j = 0; j < nfiles; j++) { // We read the header PackFile pf = (PackFile) objIn.readObject(); if (OsConstraint.oneMatchesCurrentSystem(pf.osConstraints())) { // We translate & build the path String path = translatePath(pf.getTargetPath()); File pathFile = new File(path); File dest = pathFile; if (! pf.isDirectory()) dest = pathFile.getParentFile(); if (!dest.exists()) { // If there are custom actions which would be called at // creating a directory, create it recursively. List fileListeners = customActions[customActions.length - 1]; if( fileListeners != null && fileListeners.size() > 0 ) mkDirsWithEnhancement(dest, pf, customActions ); else // Create it in on step. { if (!dest.mkdirs()) { handler.emitError( "Error creating directories", "Could not create directory\n" + dest.getPath()); handler.stopAction(); return; } } } if (pf.isDirectory()) continue; // Custom action listener stuff --- beforeFile ---- informListeners(customActions, InstallerListener.BEFORE_FILE,pathFile, pf, null); // We add the path to the log, udata.addFile(path); handler.progress(j, path); //if this file exists and should not be overwritten, check //what to do if ((pathFile.exists()) && (pf.override() != PackFile.OVERRIDE_TRUE)) { boolean overwritefile = false; // don't overwrite file if the user said so if (pf.override() != PackFile.OVERRIDE_FALSE) { if (pf.override() == PackFile.OVERRIDE_TRUE) { overwritefile = true; } else if (pf.override() == PackFile.OVERRIDE_UPDATE) { // check mtime of involved files // (this is not 100% perfect, because the already existing file might // still be modified but the new installed is just a bit newer; we would // need the creation time of the existing file or record with which mtime // it was installed...) overwritefile = (pathFile.lastModified() < pf.lastModified()); } else { int def_choice = -1; if (pf.override() == PackFile.OVERRIDE_ASK_FALSE) def_choice = AbstractUIHandler.ANSWER_NO; if (pf.override() == PackFile.OVERRIDE_ASK_TRUE) def_choice = AbstractUIHandler.ANSWER_YES; int answer = handler.askQuestion( idata.langpack.getString("InstallPanel.overwrite.title") + pathFile.getName(), idata.langpack.getString( "InstallPanel.overwrite.question") + pathFile.getAbsolutePath(), AbstractUIHandler.CHOICES_YES_NO, def_choice); overwritefile = (answer == AbstractUIHandler.ANSWER_YES); } } if (!overwritefile) { if (!pf.isBackReference() && !((Pack)packs.get(i)).loose) objIn.skip(pf.length()); continue; } } // We copy the file out = new FileOutputStream(pathFile); byte[] buffer = new byte[5120]; long bytesCopied = 0; InputStream pis = objIn; if (pf.isBackReference()) { InputStream is = getPackAsStream(pf.previousPackNumber); pis = new ObjectInputStream(is); //must wrap for blockdata use by objectstream (otherwise strange result) //skip on underlaying stream (for some reason not possible on ObjectStream) is.skip(pf.offsetInPreviousPack - 4); //but the stream header is now already read (== 4 bytes) } else if(((Pack)packs.get(i)).loose) { pis = new FileInputStream(pf.sourcePath); } while (bytesCopied < pf.length()) { int maxBytes = (int)Math.min(pf.length() - bytesCopied, buffer.length); int bytesInBuffer = pis.read(buffer, 0, maxBytes); if (bytesInBuffer == -1) throw new IOException("Unexpected end of stream"); out.write(buffer, 0, bytesInBuffer); bytesCopied += bytesInBuffer; } // Cleanings out.close(); if (pis != objIn) pis.close(); // Set file modification time if specified if (pf.lastModified() >= 0) pathFile.setLastModified(pf.lastModified()); // Custom action listener stuff --- afterFile ---- informListeners(customActions, InstallerListener.AFTER_FILE,pathFile, pf, null); } else { if (!pf.isBackReference()) objIn.skip(pf.length()); } } // Load information about parsable files int numParsables = objIn.readInt(); for (int k = 0; k < numParsables; k++) { ParsableFile pf = (ParsableFile) objIn.readObject(); pf.path = translatePath(pf.path); parsables.add(pf); } // Load information about executable files int numExecutables = objIn.readInt(); for (int k = 0; k < numExecutables; k++) { ExecutableFile ef = (ExecutableFile) objIn.readObject(); ef.path = translatePath(ef.path); if (null != ef.argList && !ef.argList.isEmpty()) { String arg = null; for (int j = 0; j < ef.argList.size(); j++) { arg = (String) ef.argList.get(j); arg = translatePath(arg); ef.argList.set(j, arg); } } executables.add(ef); if (ef.executionStage == ExecutableFile.UNINSTALL) { udata.addExecutable(ef); } } // Custom action listener stuff --- uninstall data ---- handleAdditionalUninstallData(udata, customActions); // Load information about updatechecks int numUpdateChecks = objIn.readInt(); for (int k = 0; k < numUpdateChecks; k++) { UpdateCheck uc = (UpdateCheck) objIn.readObject(); updatechecks.add(uc); } objIn.close(); // Custom action listener stuff --- afterPack ---- informListeners(customActions, InstallerListener.AFTER_PACK, packs.get(i), new Integer(i), handler); } // We use the scripts parser ScriptParser parser = new ScriptParser(parsables, vs); parser.parseFiles(); // We use the file executor FileExecutor executor = new FileExecutor(executables); if (executor.executeFiles(ExecutableFile.POSTINSTALL, handler) != 0) handler.emitError( "File execution failed", "The installation was not completed"); // We put the uninstaller (it's not yet complete...) putUninstaller(); // update checks _after_ uninstaller was put, so we don't delete it performUpdateChecks(updatechecks); // Custom action listener stuff --- afterPacks ---- informListeners(customActions, InstallerListener.AFTER_PACKS,idata, handler, null); // The end :-) handler.stopAction(); } catch (Exception err) { // TODO: finer grained error handling with useful error messages handler.stopAction(); handler.emitError("An error occured", err.toString()); err.printStackTrace(); } finally { instances.remove(instances.indexOf(this)); } }
3,239,786
public void run() { instances.add(this); try { // // Initialisations FileOutputStream out = null; ArrayList parsables = new ArrayList(); ArrayList executables = new ArrayList(); ArrayList updatechecks = new ArrayList(); List packs = idata.selectedPacks; int npacks = packs.size(); handler.startAction("Unpacking", npacks); udata = UninstallData.getInstance(); // Custom action listener stuff --- load listeners ---- List [] customActions = getCustomActions(); // Custom action listener stuff --- beforePacks ---- informListeners(customActions, InstallerListener.BEFORE_PACKS,idata, new Integer(npacks), handler); // We unpack the selected packs for (int i = 0; i < npacks; i++) { // We get the pack stream int n = idata.allPacks.indexOf(packs.get(i)); // Custom action listener stuff --- beforePack ---- informListeners(customActions, InstallerListener.BEFORE_PACK,packs.get(i), new Integer(npacks), handler); ObjectInputStream objIn = new ObjectInputStream(getPackAsStream(n)); // We unpack the files int nfiles = objIn.readInt(); handler.nextStep(((Pack) packs.get(i)).name, i + 1, nfiles); for (int j = 0; j < nfiles; j++) { // We read the header PackFile pf = (PackFile) objIn.readObject(); if (OsConstraint.oneMatchesCurrentSystem(pf.osConstraints())) { // We translate & build the path String path = translatePath(pf.getTargetPath()); File pathFile = new File(path); File dest = pathFile; if (! pf.isDirectory()) dest = pathFile.getParentFile(); if (!dest.exists()) { // If there are custom actions which would be called at // creating a directory, create it recursively. List fileListeners = customActions[customActions.length - 1]; if( fileListeners != null && fileListeners.size() > 0 ) mkDirsWithEnhancement(dest, pf, customActions ); else // Create it in on step. { if (!dest.mkdirs()) { handler.emitError( "Error creating directories", "Could not create directory\n" + dest.getPath()); handler.stopAction(); return; } } } if (pf.isDirectory()) continue; // Custom action listener stuff --- beforeFile ---- informListeners(customActions, InstallerListener.BEFORE_FILE,pathFile, pf, null); // We add the path to the log, udata.addFile(path); handler.progress(j, path); //if this file exists and should not be overwritten, check //what to do if ((pathFile.exists()) && (pf.override() != PackFile.OVERRIDE_TRUE)) { boolean overwritefile = false; // don't overwrite file if the user said so if (pf.override() != PackFile.OVERRIDE_FALSE) { if (pf.override() == PackFile.OVERRIDE_TRUE) { overwritefile = true; } else if (pf.override() == PackFile.OVERRIDE_UPDATE) { // check mtime of involved files // (this is not 100% perfect, because the already existing file might // still be modified but the new installed is just a bit newer; we would // need the creation time of the existing file or record with which mtime // it was installed...) overwritefile = (pathFile.lastModified() < pf.lastModified()); } else { int def_choice = -1; if (pf.override() == PackFile.OVERRIDE_ASK_FALSE) def_choice = AbstractUIHandler.ANSWER_NO; if (pf.override() == PackFile.OVERRIDE_ASK_TRUE) def_choice = AbstractUIHandler.ANSWER_YES; int answer = handler.askQuestion( idata.langpack.getString("InstallPanel.overwrite.title") + pathFile.getName(), idata.langpack.getString( "InstallPanel.overwrite.question") + pathFile.getAbsolutePath(), AbstractUIHandler.CHOICES_YES_NO, def_choice); overwritefile = (answer == AbstractUIHandler.ANSWER_YES); } } if (!overwritefile) { if (!pf.isBackReference() && !((Pack)packs.get(i)).loose) objIn.skip(pf.length()); continue; } } // We copy the file out = new FileOutputStream(pathFile); byte[] buffer = new byte[5120]; long bytesCopied = 0; InputStream pis = objIn; if (pf.isBackReference()) { InputStream is = getPackAsStream(pf.previousPackNumber); pis = new ObjectInputStream(is); //must wrap for blockdata use by objectstream (otherwise strange result) //skip on underlaying stream (for some reason not possible on ObjectStream) is.skip(pf.offsetInPreviousPack - 4); //but the stream header is now already read (== 4 bytes) } else if(((Pack)packs.get(i)).loose) { pis = new FileInputStream(pf.sourcePath); } while (bytesCopied < pf.length()) { int maxBytes = (int)Math.min(pf.length() - bytesCopied, buffer.length); int bytesInBuffer = pis.read(buffer, 0, maxBytes); if (bytesInBuffer == -1) throw new IOException("Unexpected end of stream"); out.write(buffer, 0, bytesInBuffer); bytesCopied += bytesInBuffer; } // Cleanings out.close(); if (pis != objIn) pis.close(); // Set file modification time if specified if (pf.lastModified() >= 0) pathFile.setLastModified(pf.lastModified()); // Custom action listener stuff --- afterFile ---- informListeners(customActions, InstallerListener.AFTER_FILE,pathFile, pf, null); } else { if (!pf.isBackReference()) objIn.skip(pf.length()); } } // Load information about parsable files int numParsables = objIn.readInt(); for (int k = 0; k < numParsables; k++) { ParsableFile pf = (ParsableFile) objIn.readObject(); pf.path = translatePath(pf.path); parsables.add(pf); } // Load information about executable files int numExecutables = objIn.readInt(); for (int k = 0; k < numExecutables; k++) { ExecutableFile ef = (ExecutableFile) objIn.readObject(); ef.path = translatePath(ef.path); if (null != ef.argList && !ef.argList.isEmpty()) { String arg = null; for (int j = 0; j < ef.argList.size(); j++) { arg = (String) ef.argList.get(j); arg = translatePath(arg); ef.argList.set(j, arg); } } executables.add(ef); if (ef.executionStage == ExecutableFile.UNINSTALL) { udata.addExecutable(ef); } } // Custom action listener stuff --- uninstall data ---- handleAdditionalUninstallData(udata, customActions); // Load information about updatechecks int numUpdateChecks = objIn.readInt(); for (int k = 0; k < numUpdateChecks; k++) { UpdateCheck uc = (UpdateCheck) objIn.readObject(); updatechecks.add(uc); } objIn.close(); // Custom action listener stuff --- afterPack ---- informListeners(customActions, InstallerListener.AFTER_PACK, packs.get(i), new Integer(i), handler); } // We use the scripts parser ScriptParser parser = new ScriptParser(parsables, vs); parser.parseFiles(); // We use the file executor FileExecutor executor = new FileExecutor(executables); if (executor.executeFiles(ExecutableFile.POSTINSTALL, handler) != 0) handler.emitError( "File execution failed", "The installation was not completed"); // We put the uninstaller (it's not yet complete...) putUninstaller(); // update checks _after_ uninstaller was put, so we don't delete it performUpdateChecks(updatechecks); // Custom action listener stuff --- afterPacks ---- informListeners(customActions, InstallerListener.AFTER_PACKS,idata, handler, null); // The end :-) handler.stopAction(); } catch (Exception err) { // TODO: finer grained error handling with useful error messages handler.stopAction(); handler.emitError("An error occured", err.toString()); err.printStackTrace(); } finally { instances.remove(instances.indexOf(this)); } }
public void run() { instances.add(this); try { // // Initialisations FileOutputStream out = null; ArrayList parsables = new ArrayList(); ArrayList executables = new ArrayList(); ArrayList updatechecks = new ArrayList(); List packs = idata.selectedPacks; int npacks = packs.size(); handler.startAction("Unpacking", npacks); udata = UninstallData.getInstance(); // Custom action listener stuff --- load listeners ---- List [] customActions = getCustomActions(); // Custom action listener stuff --- beforePacks ---- informListeners(customActions, InstallerListener.BEFORE_PACKS,idata, new Integer(npacks), handler); // We unpack the selected packs for (int i = 0; i < npacks; i++) { // We get the pack stream int n = idata.allPacks.indexOf(packs.get(i)); // Custom action listener stuff --- beforePack ---- informListeners(customActions, InstallerListener.BEFORE_PACK,packs.get(i), new Integer(npacks), handler); ObjectInputStream objIn = new ObjectInputStream(getPackAsStream(n)); // We unpack the files int nfiles = objIn.readInt(); handler.nextStep(((Pack) packs.get(i)).name, i + 1, nfiles); for (int j = 0; j < nfiles; j++) { // We read the header PackFile pf = (PackFile) objIn.readObject(); if (OsConstraint.oneMatchesCurrentSystem(pf.osConstraints())) { // We translate & build the path String path = translatePath(pf.getTargetPath()); File pathFile = new File(path); File dest = pathFile; if (! pf.isDirectory()) dest = pathFile.getParentFile(); if (!dest.exists()) { // If there are custom actions which would be called at // creating a directory, create it recursively. List fileListeners = customActions[customActions.length - 1]; if( fileListeners != null && fileListeners.size() > 0 ) mkDirsWithEnhancement(dest, pf, customActions ); else // Create it in on step. { if (!dest.mkdirs()) { handler.emitError( "Error creating directories", "Could not create directory\n" + dest.getPath()); handler.stopAction(); return; } } } if (pf.isDirectory()) continue; // Custom action listener stuff --- beforeFile ---- informListeners(customActions, InstallerListener.BEFORE_FILE,pathFile, pf, null); // We add the path to the log, udata.addFile(path); handler.progress(j, path); //if this file exists and should not be overwritten, check //what to do if ((pathFile.exists()) && (pf.override() != PackFile.OVERRIDE_TRUE)) { boolean overwritefile = false; // don't overwrite file if the user said so if (pf.override() != PackFile.OVERRIDE_FALSE) { if (pf.override() == PackFile.OVERRIDE_TRUE) { overwritefile = true; } else if (pf.override() == PackFile.OVERRIDE_UPDATE) { // check mtime of involved files // (this is not 100% perfect, because the already existing file might // still be modified but the new installed is just a bit newer; we would // need the creation time of the existing file or record with which mtime // it was installed...) overwritefile = (pathFile.lastModified() < pf.lastModified()); } else { int def_choice = -1; if (pf.override() == PackFile.OVERRIDE_ASK_FALSE) def_choice = AbstractUIHandler.ANSWER_NO; if (pf.override() == PackFile.OVERRIDE_ASK_TRUE) def_choice = AbstractUIHandler.ANSWER_YES; int answer = handler.askQuestion( idata.langpack.getString("InstallPanel.overwrite.title") + pathFile.getName(), idata.langpack.getString( "InstallPanel.overwrite.question") + pathFile.getAbsolutePath(), AbstractUIHandler.CHOICES_YES_NO, def_choice); overwritefile = (answer == AbstractUIHandler.ANSWER_YES); } } if (!overwritefile) { if (!pf.isBackReference() && !((Pack)packs.get(i)).loose) objIn.skip(pf.length()); continue; } } // We copy the file out = new FileOutputStream(pathFile); byte[] buffer = new byte[5120]; long bytesCopied = 0; InputStream pis = objIn; if (pf.isBackReference()) { InputStream is = getPackAsStream(pf.previousPackNumber); pis = new ObjectInputStream(is); //must wrap for blockdata use by objectstream (otherwise strange result) //skip on underlaying stream (for some reason not possible on ObjectStream) is.skip(pf.offsetInPreviousPack - 4); //but the stream header is now already read (== 4 bytes) } else if(((Pack)packs.get(i)).loose) { pis = new FileInputStream(pf.sourcePath); } while (bytesCopied < pf.length()) { int maxBytes = (int)Math.min(pf.length() - bytesCopied, buffer.length); int bytesInBuffer = pis.read(buffer, 0, maxBytes); if (bytesInBuffer == -1) throw new IOException("Unexpected end of stream"); out.write(buffer, 0, bytesInBuffer); bytesCopied += bytesInBuffer; } // Cleanings out.close(); if (pis != objIn) pis.close(); // Set file modification time if specified if (pf.lastModified() >= 0) pathFile.setLastModified(pf.lastModified()); // Custom action listener stuff --- afterFile ---- informListeners(customActions, InstallerListener.AFTER_FILE,pathFile, pf, null); } else { if (!pf.isBackReference()) objIn.skip(pf.length()); } } // Load information about parsable files int numParsables = objIn.readInt(); for (int k = 0; k < numParsables; k++) { ParsableFile pf = (ParsableFile) objIn.readObject(); pf.path = translatePath(pf.path); parsables.add(pf); } // Load information about executable files int numExecutables = objIn.readInt(); for (int k = 0; k < numExecutables; k++) { ExecutableFile ef = (ExecutableFile) objIn.readObject(); ef.path = translatePath(ef.path); if (null != ef.argList && !ef.argList.isEmpty()) { String arg = null; for (int j = 0; j < ef.argList.size(); j++) { arg = (String) ef.argList.get(j); arg = translatePath(arg); ef.argList.set(j, arg); } } executables.add(ef); if (ef.executionStage == ExecutableFile.UNINSTALL) { udata.addExecutable(ef); } } // Custom action listener stuff --- uninstall data ---- handleAdditionalUninstallData(udata, customActions); // Load information about updatechecks int numUpdateChecks = objIn.readInt(); for (int k = 0; k < numUpdateChecks; k++) { UpdateCheck uc = (UpdateCheck) objIn.readObject(); updatechecks.add(uc); } objIn.close(); // Custom action listener stuff --- afterPack ---- informListeners(customActions, InstallerListener.AFTER_PACK, packs.get(i), new Integer(i), handler); } // We use the scripts parser ScriptParser parser = new ScriptParser(parsables, vs); parser.parseFiles(); // We use the file executor FileExecutor executor = new FileExecutor(executables); if (executor.executeFiles(ExecutableFile.POSTINSTALL, handler) != 0) handler.emitError( "File execution failed", "The installation was not completed"); // We put the uninstaller (it's not yet complete...) putUninstaller(); // update checks _after_ uninstaller was put, so we don't delete it performUpdateChecks(updatechecks); // Custom action listener stuff --- afterPacks ---- informListeners(customActions, InstallerListener.AFTER_PACKS,idata, handler, null); // The end :-) handler.stopAction(); } catch (Exception err) { // TODO: finer grained error handling with useful error messages handler.stopAction(); handler.emitError("An error occured", err.toString()); err.printStackTrace(); } finally { instances.remove(instances.indexOf(this)); } }
3,239,787
public WebAccessor(Component parent) { this.parent = parent; Locale l = null; if (parent != null) parent.getLocale(); soloCancelOption = UIManager.get("OptionPane.cancelButtonText", l);// TODO: // i18n? Authenticator.setDefault(new MyDialogAuthenticator()); }
public WebAccessor() { this.parent = parent; Locale l = null; if (parent != null) parent.getLocale(); soloCancelOption = UIManager.get("OptionPane.cancelButtonText", l);// TODO: // i18n? Authenticator.setDefault(new MyDialogAuthenticator()); }
3,239,788
public WebAccessor(Component parent) { this.parent = parent; Locale l = null; if (parent != null) parent.getLocale(); soloCancelOption = UIManager.get("OptionPane.cancelButtonText", l);// TODO: // i18n? Authenticator.setDefault(new MyDialogAuthenticator()); }
public WebAccessor(Component parent) { this.parent = parent; Locale l = null; if (parent != null) parent.getLocale(); soloCancelOption = UIManager.get("OptionPane.cancelButtonText", l);// TODO: // i18n? Authenticator.setDefault(new MyDialogAuthenticator()); }
3,239,789
public void runAutomated(AutomatedInstallData idata, XMLElement panelRoot) { try { this.worker = new ProcessPanelWorker(idata, this); this.worker.run(); } catch (IOException e) { e.printStackTrace(); } }
public void runAutomated(AutomatedInstallData idata, XMLElement panelRoot) { try { ProcessPanelWorker worker = new ProcessPanelWorker(idata, this); this.worker.run(); } catch (IOException e) { e.printStackTrace(); } }
3,239,790
public void runAutomated(AutomatedInstallData idata, XMLElement panelRoot) { try { this.worker = new ProcessPanelWorker(idata, this); this.worker.run(); } catch (IOException e) { e.printStackTrace(); } }
public void runAutomated(AutomatedInstallData idata, XMLElement panelRoot) { try { this.worker = new ProcessPanelWorker(idata, this); worker.run(); } catch (IOException e) { e.printStackTrace(); } }
3,239,791
public LicencePanel(InstallerFrame parent, InstallData idata) { super(parent, idata); // We initialize our layout setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); // We load the licence loadLicence(); // We put our components JLabel infoLabel = new JLabel(parent.langpack.getString("LicencePanel.info"), parent.icons.getImageIcon("history"), JLabel.TRAILING); add(infoLabel); add(Box.createRigidArea(new Dimension(0, 3))); textArea = new JTextArea(licence); textArea.setMargin(new Insets(2,2,2,2)); textArea.setCaretPosition(0); textArea.setEditable(false); textArea.setLineWrap(true); textArea.setWrapStyleWord(true); scroller = new JScrollPane(textArea); scroller.setAlignmentX(LEFT_ALIGNMENT); add(scroller); ButtonGroup group = new ButtonGroup(); yesRadio = new JRadioButton(parent.langpack.getString("LicencePanel.agree"), false); group.add(yesRadio); add(yesRadio); yesRadio.addActionListener(this); noRadio = new JRadioButton(parent.langpack.getString("LicencePanel.notagree"), true); group.add(noRadio); add(noRadio); noRadio.addActionListener(this); }
public LicencePanel(InstallerFrame parent, InstallData idata) { super(parent, idata); // We initialize our layout setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); // We load the licence loadLicence(); // We put our components JLabel infoLabel = new JLabel( parent.langpack.getString("LicencePanel.info"), parent.icons.getImageIcon("history"), JLabel.TRAILING); add(infoLabel); add(Box.createRigidArea(new Dimension(0, 3))); textArea = new JTextArea(licence); textArea.setMargin(new Insets(2,2,2,2)); textArea.setCaretPosition(0); textArea.setEditable(false); textArea.setLineWrap(true); textArea.setWrapStyleWord(true); scroller = new JScrollPane(textArea); scroller.setAlignmentX(LEFT_ALIGNMENT); add(scroller); ButtonGroup group = new ButtonGroup(); yesRadio = new JRadioButton(parent.langpack.getString("LicencePanel.agree"), false); group.add(yesRadio); add(yesRadio); yesRadio.addActionListener(this); noRadio = new JRadioButton(parent.langpack.getString("LicencePanel.notagree"), true); group.add(noRadio); add(noRadio); noRadio.addActionListener(this); }
3,239,792
public LicencePanel(InstallerFrame parent, InstallData idata) { super(parent, idata); // We initialize our layout setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); // We load the licence loadLicence(); // We put our components JLabel infoLabel = new JLabel(parent.langpack.getString("LicencePanel.info"), parent.icons.getImageIcon("history"), JLabel.TRAILING); add(infoLabel); add(Box.createRigidArea(new Dimension(0, 3))); textArea = new JTextArea(licence); textArea.setMargin(new Insets(2,2,2,2)); textArea.setCaretPosition(0); textArea.setEditable(false); textArea.setLineWrap(true); textArea.setWrapStyleWord(true); scroller = new JScrollPane(textArea); scroller.setAlignmentX(LEFT_ALIGNMENT); add(scroller); ButtonGroup group = new ButtonGroup(); yesRadio = new JRadioButton(parent.langpack.getString("LicencePanel.agree"), false); group.add(yesRadio); add(yesRadio); yesRadio.addActionListener(this); noRadio = new JRadioButton(parent.langpack.getString("LicencePanel.notagree"), true); group.add(noRadio); add(noRadio); noRadio.addActionListener(this); }
public LicencePanel(InstallerFrame parent, InstallData idata) { super(parent, idata); // We initialize our layout setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); // We load the licence loadLicence(); // We put our components JLabel infoLabel = new JLabel(parent.langpack.getString("LicencePanel.info"), parent.icons.getImageIcon("history"), JLabel.TRAILING); add(infoLabel); add(Box.createRigidArea(new Dimension(0, 3))); textArea = new JTextArea(licence); textArea.setMargin(new Insets(2, 2, 2, 2)); textArea.setCaretPosition(0); textArea.setEditable(false); textArea.setLineWrap(true); textArea.setWrapStyleWord(true); scroller = new JScrollPane(textArea); scroller.setAlignmentX(LEFT_ALIGNMENT); add(scroller); ButtonGroup group = new ButtonGroup(); yesRadio = new JRadioButton(parent.langpack.getString("LicencePanel.agree"), false); group.add(yesRadio); add(yesRadio); yesRadio.addActionListener(this); noRadio = new JRadioButton(parent.langpack.getString("LicencePanel.notagree"), true); group.add(noRadio); add(noRadio); noRadio.addActionListener(this); }
3,239,793
public LicencePanel(InstallerFrame parent, InstallData idata) { super(parent, idata); // We initialize our layout setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); // We load the licence loadLicence(); // We put our components JLabel infoLabel = new JLabel(parent.langpack.getString("LicencePanel.info"), parent.icons.getImageIcon("history"), JLabel.TRAILING); add(infoLabel); add(Box.createRigidArea(new Dimension(0, 3))); textArea = new JTextArea(licence); textArea.setMargin(new Insets(2,2,2,2)); textArea.setCaretPosition(0); textArea.setEditable(false); textArea.setLineWrap(true); textArea.setWrapStyleWord(true); scroller = new JScrollPane(textArea); scroller.setAlignmentX(LEFT_ALIGNMENT); add(scroller); ButtonGroup group = new ButtonGroup(); yesRadio = new JRadioButton(parent.langpack.getString("LicencePanel.agree"), false); group.add(yesRadio); add(yesRadio); yesRadio.addActionListener(this); noRadio = new JRadioButton(parent.langpack.getString("LicencePanel.notagree"), true); group.add(noRadio); add(noRadio); noRadio.addActionListener(this); }
public LicencePanel(InstallerFrame parent, InstallData idata) { super(parent, idata); // We initialize our layout setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); // We load the licence loadLicence(); // We put our components JLabel infoLabel = new JLabel(parent.langpack.getString("LicencePanel.info"), parent.icons.getImageIcon("history"), JLabel.TRAILING); add(infoLabel); add(Box.createRigidArea(new Dimension(0, 3))); textArea = new JTextArea(licence); textArea.setMargin(new Insets(2,2,2,2)); textArea.setCaretPosition(0); textArea.setEditable(false); textArea.setLineWrap(true); textArea.setWrapStyleWord(true); scroller = new JScrollPane(textArea); scroller.setAlignmentX(LEFT_ALIGNMENT); add(scroller); ButtonGroup group = new ButtonGroup(); yesRadio = new JRadioButton(parent.langpack.getString("LicencePanel.agree"), false); group.add(yesRadio); add(yesRadio); yesRadio.addActionListener(this); noRadio = new JRadioButton(parent.langpack.getString("LicencePanel.notagree"), true); group.add(noRadio); add(noRadio); noRadio.addActionListener(this); }
3,239,794
public LicencePanel(InstallerFrame parent, InstallData idata) { super(parent, idata); // We initialize our layout setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); // We load the licence loadLicence(); // We put our components JLabel infoLabel = new JLabel(parent.langpack.getString("LicencePanel.info"), parent.icons.getImageIcon("history"), JLabel.TRAILING); add(infoLabel); add(Box.createRigidArea(new Dimension(0, 3))); textArea = new JTextArea(licence); textArea.setMargin(new Insets(2,2,2,2)); textArea.setCaretPosition(0); textArea.setEditable(false); textArea.setLineWrap(true); textArea.setWrapStyleWord(true); scroller = new JScrollPane(textArea); scroller.setAlignmentX(LEFT_ALIGNMENT); add(scroller); ButtonGroup group = new ButtonGroup(); yesRadio = new JRadioButton(parent.langpack.getString("LicencePanel.agree"), false); group.add(yesRadio); add(yesRadio); yesRadio.addActionListener(this); noRadio = new JRadioButton(parent.langpack.getString("LicencePanel.notagree"), true); group.add(noRadio); add(noRadio); noRadio.addActionListener(this); }
public LicencePanel(InstallerFrame parent, InstallData idata) { super(parent, idata); // We initialize our layout setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); // We load the licence loadLicence(); // We put our components JLabel infoLabel = new JLabel(parent.langpack.getString("LicencePanel.info"), parent.icons.getImageIcon("history"), JLabel.TRAILING); add(infoLabel); add(Box.createRigidArea(new Dimension(0, 3))); textArea = new JTextArea(licence); textArea.setMargin(new Insets(2,2,2,2)); textArea.setCaretPosition(0); textArea.setEditable(false); textArea.setLineWrap(true); textArea.setWrapStyleWord(true); scroller = new JScrollPane(textArea); scroller.setAlignmentX(LEFT_ALIGNMENT); add(scroller); ButtonGroup group = new ButtonGroup(); yesRadio = new JRadioButton(parent.langpack.getString("LicencePanel.agree"), false); group.add(yesRadio); add(yesRadio); yesRadio.addActionListener(this); noRadio = new JRadioButton( parent.langpack.getString("LicencePanel.notagree"), true); group.add(noRadio); add(noRadio); noRadio.addActionListener(this); }
3,239,795
public boolean isValidated() { if (noRadio.isSelected()) { parent.exit(); return false; } else return (yesRadio.isSelected()); }
public boolean isValidated() { if (noRadio.isSelected()) { parent.exit(); return false; } else return (yesRadio.isSelected()); }
3,239,796
private void loadLicence() { try { // We read it String resNamePrifix = "LicencePanel.licence"; licence = ResourceManager.getInstance().getTextResource(resNamePrifix); } catch (Exception err) { licence = "Error : could not load the licence text !"; } }
private void loadLicence() { try { // We read it String resNamePrifix = "LicencePanel.licence"; licence = ResourceManager.getInstance().getTextResource(resNamePrifix); } catch (Exception err) { licence = "Error : could not load the licence text !"; } }
3,239,797
protected ArrayList getPacks(XMLElement data) throws Exception { // Initialisation ArrayList packs = new ArrayList(); XMLElement root = data.getFirstChildNamed("packs"); if (root == null) { throw new Exception ("no packs specified"); } // dummy variable used for values from XML String val; // We process each pack markup int npacks = root.getChildrenCount(); for (int i = 0; i < npacks; i++) { XMLElement el = root.getChildAtIndex(i); // Trivial initialisations Pack pack = new Pack(); pack.number = i; pack.name = el.getAttribute("name"); if (pack.name == null) { throw new Exception ("missing \"name\" attribute for <pack> in line "+el.getLineNr()); } pack.osConstraints = OsConstraint.getOsList (el); pack.required = el.getAttribute("required").equalsIgnoreCase("yes"); pack.description = el.getFirstChildNamed("description").getContent(); pack.preselected = true; val = el.getAttribute ("preselected"); if ((null != val) && ("no".compareToIgnoreCase (val) == 0)) pack.preselected = false; // We get the parsables list Iterator iter = null; Vector children = el.getChildrenNamed("parsable"); if (null != children && !children.isEmpty()) { iter = children.iterator(); while (iter.hasNext()) { XMLElement p = (XMLElement) iter.next(); String targetFile = p.getAttribute("targetfile"); if (targetFile == null) throw new Exception ("missing \"targetfile\" attribute for <parsable> in line "+p.getLineNr()); List osList = OsConstraint.getOsList (p); pack.parsables.add (new ParsableFile(targetFile, p.getAttribute("type", "plain"), p.getAttribute("encoding", null), osList)); } } // We get the executables list children = el.getChildrenNamed("executable"); if (null != children && !children.isEmpty()) { iter = children.iterator(); while (iter.hasNext()) { XMLElement e = (XMLElement) iter.next(); // when to execute this executable int executeOn = ExecutableFile.NEVER; val = e.getAttribute("stage", "never"); if ("postinstall".compareToIgnoreCase(val) == 0) executeOn = ExecutableFile.POSTINSTALL; else if ("uninstall".compareToIgnoreCase(val) == 0) executeOn = ExecutableFile.UNINSTALL; // main class of this executable String executeClass = e.getAttribute("class"); // type of this executable int executeType = ExecutableFile.BIN; val = e.getAttribute("type", "bin"); if ("jar".compareToIgnoreCase(val) == 0) executeType = ExecutableFile.JAR; // what to do if execution fails int onFailure = ExecutableFile.ASK; val = e.getAttribute("failure", "ask"); if ("abort".compareToIgnoreCase(val) == 0) onFailure = ExecutableFile.ABORT; else if ("warn".compareToIgnoreCase(val) == 0) onFailure = ExecutableFile.WARN; // whether to keep the executable after executing it boolean keepFile = false; val = e.getAttribute ("keep"); if ((null != val) && ("true".compareToIgnoreCase(val) == 0)) keepFile = true; // get arguments for this executable ArrayList argList = new ArrayList(); XMLElement args = e.getFirstChildNamed("args"); if (null != args) { argList = new ArrayList(); Iterator argIterator = args.getChildrenNamed("arg").iterator(); while (argIterator.hasNext()) { XMLElement arg = (XMLElement) argIterator.next(); argList.add(arg.getAttribute("value")); } } List osList = OsConstraint.getOsList(e); String targetfile_attr = e.getAttribute("targetfile"); if (targetfile_attr == null) { throw new Exception ("missing \"targetfile\" attribute for <parsable> in line "+e.getLineNr()); } pack.executables.add(new ExecutableFile(targetfile_attr, executeType, executeClass, executeOn, onFailure, argList, osList, keepFile)); } } // We get the files list iter = el.getChildrenNamed("file").iterator(); while (iter.hasNext()) { XMLElement f = (XMLElement) iter.next(); String src_attr = f.getAttribute ("src"); if (src_attr == null) { throw new Exception ("missing \"src\" attribute for <file> in line "+f.getLineNr()); } String path; if (new File(src_attr).isAbsolute()) { path = src_attr; } else { path = basedir + File.separator + src_attr; } File file = new File(path); int override = getOverrideValue (f); List osList = OsConstraint.getOsList (f); String targetdir_attr = f.getAttribute ("targetdir"); if (targetdir_attr == null) { throw new Exception ("missing \"targetdir\" attribute for <file> in line "+f.getLineNr()); } addFile(file, targetdir_attr, osList, override, pack.packFiles); } // We get the singlefiles list iter = el.getChildrenNamed("singlefile").iterator(); while (iter.hasNext()) { XMLElement f = (XMLElement) iter.next(); String src_attr = f.getAttribute ("src"); if (src_attr == null) { throw new Exception ("missing \"src\" attribute for <file> in line "+f.getLineNr()); } String path; if (new File (src_attr).isAbsolute ()) { path = src_attr; } else { path = basedir + File.separator + src_attr; } File file = new File(path); int override = getOverrideValue (f); List osList = OsConstraint.getOsList (f); String target_attr = f.getAttribute ("target"); if (target_attr == null) { throw new Exception ("missing \"target\" attribute for <file> in line "+f.getLineNr()); } addSingleFile(file, target_attr, osList, override, pack.packFiles); } // We get the fileset list iter = el.getChildrenNamed("fileset").iterator(); while (iter.hasNext()) { XMLElement f = (XMLElement) iter.next(); String dir_attr = f.getAttribute ("dir"); if (dir_attr == null) { throw new Exception ("missing \"dir\" attribute for fileset in line "+f.getLineNr()); } String path; if (new File(dir_attr).isAbsolute()) { path = dir_attr; } else { path = basedir + File.separator + dir_attr; } String casesensitive = f.getAttribute("casesensitive"); // get includes and excludes Vector xcludesList = f.getChildrenNamed("include"); String[] includes = null; XMLElement xclude = null; if (xcludesList.size() > 0) { includes = new String[xcludesList.size()]; for (int j = 0; j < xcludesList.size(); j++) { xclude = (XMLElement) xcludesList.get(j); includes[j] = xclude.getAttribute("name"); } } xcludesList = f.getChildrenNamed("exclude"); String[] excludes = null; xclude = null; if (xcludesList.size() > 0) { excludes = new String[xcludesList.size()]; for (int j = 0; j < xcludesList.size(); j++) { xclude = (XMLElement) xcludesList.get(j); excludes[j] = xclude.getAttribute("name"); } } int override = getOverrideValue (f); String targetdir_attr = f.getAttribute ("targetdir"); if (targetdir_attr == null) { throw new Exception ("missing \"targetdir\" attribute for <fileset> in line "+f.getLineNr()); } List osList = OsConstraint.getOsList (f); addFileSet(path, includes, excludes, targetdir_attr, osList, pack.packFiles, casesensitive, override); } // We add the pack packs.add(pack); } // We return the ArrayList return packs; }
protected ArrayList getPacks(XMLElement data) throws Exception { // Initialisation ArrayList packs = new ArrayList(); XMLElement root = data.getFirstChildNamed("packs"); if (root == null) { throw new Exception ("no packs specified"); } // dummy variable used for values from XML String val; // We process each pack markup int npacks = root.getChildrenCount(); for (int i = 0; i < npacks; i++) { XMLElement el = root.getChildAtIndex(i); // Trivial initialisations Pack pack = new Pack(); pack.number = i; pack.name = el.getAttribute("name"); if (pack.name == null) { throw new Exception ("missing \"name\" attribute for <pack> in line "+el.getLineNr()); } pack.osConstraints = OsConstraint.getOsList (el); pack.required = el.getAttribute("required").equalsIgnoreCase("yes"); pack.description = el.getFirstChildNamed("description").getContent(); pack.preselected = true; val = el.getAttribute ("preselected"); if ((null != val) && ("no".compareToIgnoreCase (val) == 0)) pack.preselected = false; // We get the parsables list Iterator iter = null; Vector children = el.getChildrenNamed("parsable"); if (null != children && !children.isEmpty()) { iter = children.iterator(); while (iter.hasNext()) { XMLElement p = (XMLElement) iter.next(); String targetFile = p.getAttribute("targetfile"); if (targetFile == null) throw new Exception ("missing \"targetfile\" attribute for <parsable> in line "+p.getLineNr()); List osList = OsConstraint.getOsList (p); pack.parsables.add (new ParsableFile(targetFile, p.getAttribute("type", "plain"), p.getAttribute("encoding", null), osList)); } } // We get the executables list children = el.getChildrenNamed("executable"); if (null != children && !children.isEmpty()) { iter = children.iterator(); while (iter.hasNext()) { XMLElement e = (XMLElement) iter.next(); // when to execute this executable int executeOn = ExecutableFile.NEVER; val = e.getAttribute("stage", "never"); if ("postinstall".compareToIgnoreCase(val) == 0) executeOn = ExecutableFile.POSTINSTALL; else if ("uninstall".compareToIgnoreCase(val) == 0) executeOn = ExecutableFile.UNINSTALL; // main class of this executable String executeClass = e.getAttribute("class"); // type of this executable int executeType = ExecutableFile.BIN; val = e.getAttribute("type", "bin"); if ("jar".compareToIgnoreCase(val) == 0) executeType = ExecutableFile.JAR; // what to do if execution fails int onFailure = ExecutableFile.ASK; val = e.getAttribute("failure", "ask"); if ("abort".compareToIgnoreCase(val) == 0) onFailure = ExecutableFile.ABORT; else if ("warn".compareToIgnoreCase(val) == 0) onFailure = ExecutableFile.WARN; // whether to keep the executable after executing it boolean keepFile = false; val = e.getAttribute ("keep"); if ((null != val) && ("true".compareToIgnoreCase(val) == 0)) keepFile = true; // get arguments for this executable ArrayList argList = new ArrayList(); XMLElement args = e.getFirstChildNamed("args"); if (null != args) { argList = new ArrayList(); Iterator argIterator = args.getChildrenNamed("arg").iterator(); while (argIterator.hasNext()) { XMLElement arg = (XMLElement) argIterator.next(); argList.add(arg.getAttribute("value")); } } List osList = OsConstraint.getOsList(e); String targetfile_attr = e.getAttribute("targetfile"); if (targetfile_attr == null) { throw new Exception ("missing \"targetfile\" attribute for <parsable> in line "+e.getLineNr()); } pack.executables.add(new ExecutableFile(targetfile_attr, executeType, executeClass, executeOn, onFailure, argList, osList, keepFile)); } } // We get the files list iter = el.getChildrenNamed("file").iterator(); while (iter.hasNext()) { XMLElement f = (XMLElement) iter.next(); String src_attr = f.getAttribute ("src"); if (src_attr == null) { throw new Exception ("missing \"src\" attribute for <file> in line "+f.getLineNr()); } String path; if (new File(src_attr).isAbsolute()) { path = src_attr; } else { path = basedir + File.separator + src_attr; } File file = new File(path); int override = getOverrideValue (f); List osList = OsConstraint.getOsList (f); String targetdir_attr = f.getAttribute ("targetdir"); if (targetdir_attr == null) { throw new Exception ("missing \"targetdir\" attribute for <file> in line "+f.getLineNr()); } addFile(file, targetdir_attr, osList, override, pack.packFiles); } // We get the singlefiles list iter = el.getChildrenNamed("singlefile").iterator(); while (iter.hasNext()) { XMLElement f = (XMLElement) iter.next(); String src_attr = f.getAttribute ("src"); if (src_attr == null) { throw new Exception ("missing \"src\" attribute for <file> in line "+f.getLineNr()); } String path; if (new File (src_attr).isAbsolute ()) { path = src_attr; } else { path = basedir + File.separator + src_attr; } File file = new File(path); int override = getOverrideValue (f); List osList = OsConstraint.getOsList (f); String target_attr = f.getAttribute ("target"); if (target_attr == null) { throw new Exception ("missing \"target\" attribute for <file> in line "+f.getLineNr()); } addSingleFile(file, target_attr, osList, override, pack.packFiles); } // We get the fileset list iter = el.getChildrenNamed("fileset").iterator(); while (iter.hasNext()) { XMLElement f = (XMLElement) iter.next(); String dir_attr = f.getAttribute ("dir"); if (dir_attr == null) { throw new Exception ("missing \"dir\" attribute for fileset in line "+f.getLineNr()); } String path; if (new File(dir_attr).isAbsolute()) { path = dir_attr; } else { path = basedir + File.separator + dir_attr; } String casesensitive = f.getAttribute("casesensitive"); // get includes and excludes Vector xcludesList = f.getChildrenNamed("include"); String[] includes = null; XMLElement xclude = null; if (xcludesList.size() > 0) { includes = new String[xcludesList.size()]; for (int j = 0; j < xcludesList.size(); j++) { xclude = (XMLElement) xcludesList.get(j); includes[j] = xclude.getAttribute("name"); } } xcludesList = f.getChildrenNamed("exclude"); String[] excludes = null; xclude = null; if (xcludesList.size() > 0) { excludes = new String[xcludesList.size()]; for (int j = 0; j < xcludesList.size(); j++) { xclude = (XMLElement) xcludesList.get(j); excludes[j] = xclude.getAttribute("name"); } } int override = getOverrideValue (f); String targetdir_attr = f.getAttribute ("targetdir"); if (targetdir_attr == null) { throw new Exception ("missing \"targetdir\" attribute for <fileset> in line "+f.getLineNr()); } List osList = OsConstraint.getOsList (f); addFileSet(path, includes, excludes, targetdir_attr, osList, pack.packFiles, casesensitive, override); } // We add the pack packs.add(pack); } // We return the ArrayList return packs; }
3,239,798
public Unpacker( AutomatedInstallData idata, AbstractUIProgressHandler handler) { super("IzPack - Unpacker thread"); this.idata = idata; this.handler = handler; // Initialize the variable substitutor vs = new VariableSubstitutor(idata.getVariableValueMap()); }
public Unpacker( AutomatedInstallData idata, AbstractUIProgressHandler handler) { super("IzPack - Unpacker thread"); this.idata = idata; this.handler = handler; // Initialize the variable substitutor vs = new VariableSubstitutor(idata.getVariables()); }
3,239,799
public Pack(String name, String description, boolean required) { this.name = name; this.description = description; this.required = required; nbytes = 0; }
public Pack(String name, String description, String targetOs, boolean required) { this.name = name; this.description = description; this.required = required; nbytes = 0; }
3,239,800
public void writeSkeletonInstaller (JarOutputStream out) throws Exception { ZipInputStream skeleton_is = new ZipInputStream (getClass().getResourceAsStream("/lib/installer.jar")); if (skeleton_is == null) { skeleton_is = new JarInputStream (new FileInputStream ( Compiler.IZPACK_HOME + "lib" + File.separator + "installer.jar")); } ZipEntry zentry; while ((zentry = skeleton_is.getNextEntry()) != null) { // Puts a new entry out.putNextEntry(new ZipEntry(zentry.getName())); // Copy the data copyStream(skeleton_is, out); out.closeEntry(); skeleton_is.closeEntry(); } }
public void writeSkeletonInstaller (JarOutputStream out) throws Exception { InputStream is = getClass().getResourceAsStream("lib/installer.jar"); ZipInputStream skeleton_is = null; if (is != null) { skeleton_is = new ZipInputStream (is); } if (skeleton_is == null) { skeleton_is = new JarInputStream (new FileInputStream ( Compiler.IZPACK_HOME + "lib" + File.separator + "installer.jar")); } ZipEntry zentry; while ((zentry = skeleton_is.getNextEntry()) != null) { // Puts a new entry out.putNextEntry(new ZipEntry(zentry.getName())); // Copy the data copyStream(skeleton_is, out); out.closeEntry(); skeleton_is.closeEntry(); } }
3,239,802
private void initvalues() { // name to pack position map namesPos = new HashMap(); for (int i = 0; i < packs.size(); i++) { Pack pack = (Pack) packs.get(i); namesPos.put(pack.name, new Integer(i)); } // Init to the first values for (int i = 0; i < packs.size(); i++) { Pack pack = (Pack) packs.get(i); if (packsToInstall.contains(pack)) checkValues[i] = 1; } // Check out and disable the ones that are excluded by non fullfiled // deps for (int i = 0; i < packs.size(); i++) { Pack pack = (Pack) packs.get(i); if (checkValues[i] == 0) { List deps = pack.revDependencies; for (int j = 0; deps != null && j < deps.size(); j++) { String name = (String) deps.get(j); int pos = getPos(name); checkValues[pos] = -2; } } } // The required ones must propagate their required status to all the // ones // that they depend on for (int i = 0; i < packs.size(); i++) { Pack pack = (Pack) packs.get(i); if (pack.required == true) propRequirement(pack.name); } }
private void initvalues() { // name to pack position map namesPos = new HashMap(); for (int i = 0; i < packs.size(); i++) { Pack pack = (Pack) packs.get(i); namesPos.put(pack.name, new Integer(i)); } // Init to the first values for (int i = 0; i < packs.size(); i++) { Pack pack = (Pack) packs.get(i); if (packsToInstall.contains(pack)) checkValues[i] = 1; } // Check out and disable the ones that are excluded by non fullfiled // deps for (int i = 0; i < packs.size(); i++) { Pack pack = (Pack) packs.get(i); if (checkValues[i] == 0) { List deps = pack.revDependencies; for (int j = 0; deps != null && j < deps.size(); j++) { String name = (String) deps.get(j); int pos = getPos(name); checkValues[pos] = -2; } } } // The required ones must propagate their required status to all the // ones // that they depend on for (int i = 0; i < packs.size(); i++) { Pack pack = (Pack) packs.get(i); if (pack.required) propRequirement(pack.name); } }
3,239,803
public boolean isCellEditable(int rowIndex, int columnIndex) { if (checkValues[rowIndex] < 0) { return false; } else if (columnIndex == 0) { return true; } else { return false; } }
public boolean isCellEditable(int rowIndex, int columnIndex) { if (checkValues[rowIndex] < 0) { return false; } else if (columnIndex == 0) { return true; } else { return false; } }
3,239,804
public CompileWorker(AutomatedInstallData idata, CompileHandler handler) throws IOException { this.idata = idata; this.handler = handler; this.vs = new VariableSubstitutor(idata.getVariableValueMap()); this.compilationThread = null; if (!readSpec()) throw new IOException("Error reading compilation specification"); }
public CompileWorker(AutomatedInstallData idata, CompileHandler handler) throws IOException { this.idata = idata; this.handler = handler; this.vs = new VariableSubstitutor(idata.getVariables()); this.compilationThread = null; if (!readSpec()) throw new IOException("Error reading compilation specification"); }
3,239,805
public void makeXMLData(AutomatedInstallData idata, XMLElement panelRoot) { // We add each pack to the panelRoot element for (int i = 0; i < idata.availablePacks.size(); i++) { Pack pack = (Pack) idata.availablePacks.get(i); XMLElement el = new XMLElement("pack"); el.setAttribute("index", new Integer(i).toString()); el.setAttribute("name", pack.name); Boolean selected = Boolean.valueOf(idata.selectedPacks.contains(pack)); el.setAttribute("selected", selected.toString()); panelRoot.addChild(el); } }
public void makeXMLData(AutomatedInstallData idata, XMLElement panelRoot) { // We add each pack to the panelRoot element for (int i = 0; i < idata.availablePacks.size(); i++) { Pack pack = (Pack) idata.availablePacks.get(i); XMLElement el = new XMLElement("pack"); el.setAttribute("index", Integer.toString(i)); el.setAttribute("name", pack.name); Boolean selected = Boolean.valueOf(idata.selectedPacks.contains(pack)); el.setAttribute("selected", selected.toString()); panelRoot.addChild(el); } }
3,239,806
public void runAutomated(AutomatedInstallData idata, XMLElement panelRoot) { // We first get the <selected> child (new from version 3.7.0). XMLElement selectedPacks = panelRoot.getFirstChildNamed("selected"); // We get the packs markups Vector pm = selectedPacks.getChildrenNamed("pack"); // We figure out the selected ones int size = pm.size(); idata.selectedPacks.clear(); for (int i = 0; i < size; i++) { XMLElement el = (XMLElement) pm.get(i); Boolean selected = new Boolean(true); // No longer needed. if (selected.booleanValue()) { String index_str = el.getAttribute("index"); // be liberal in what we accept // (For example, this allows auto-installer files to be fitted // to automatically // generated installers, yes I need this! tisc.) if (index_str != null) { try { int index = Integer.parseInt(index_str); if ((index >= 0) && (index < idata.availablePacks.size())) { idata.selectedPacks.add(idata.availablePacks.get(index)); } else { System.err.println("Invalid pack index \"" + index_str + "\" in line " + el.getLineNr()); } } catch (NumberFormatException e) { System.err.println("Invalid pack index \"" + index_str + "\" in line " + el.getLineNr()); } } else { String name = el.getAttribute("name"); if (name != null) { // search for pack with that name Iterator pack_it = idata.availablePacks.iterator(); boolean found = false; while ((!found) && pack_it.hasNext()) { Pack pack = (Pack) pack_it.next(); if (pack.name.equals(name)) { idata.selectedPacks.add(pack); found = true; } } if (!found) { System.err.println("Could not find selected pack named \"" + name + "\" in line " + el.getLineNr()); } } } } } }
public void runAutomated(AutomatedInstallData idata, XMLElement panelRoot) { // We first get the <selected> child (new from version 3.7.0). XMLElement selectedPacks = panelRoot.getFirstChildNamed("selected"); // We get the packs markups Vector pm = selectedPacks.getChildrenNamed("pack"); // We figure out the selected ones int size = pm.size(); idata.selectedPacks.clear(); for (int i = 0; i < size; i++) { XMLElement el = (XMLElement) pm.get(i); Boolean selected = Boolean.TRUE; // No longer needed. if (selected.booleanValue()) { String index_str = el.getAttribute("index"); // be liberal in what we accept // (For example, this allows auto-installer files to be fitted // to automatically // generated installers, yes I need this! tisc.) if (index_str != null) { try { int index = Integer.parseInt(index_str); if ((index >= 0) && (index < idata.availablePacks.size())) { idata.selectedPacks.add(idata.availablePacks.get(index)); } else { System.err.println("Invalid pack index \"" + index_str + "\" in line " + el.getLineNr()); } } catch (NumberFormatException e) { System.err.println("Invalid pack index \"" + index_str + "\" in line " + el.getLineNr()); } } else { String name = el.getAttribute("name"); if (name != null) { // search for pack with that name Iterator pack_it = idata.availablePacks.iterator(); boolean found = false; while ((!found) && pack_it.hasNext()) { Pack pack = (Pack) pack_it.next(); if (pack.name.equals(name)) { idata.selectedPacks.add(pack); found = true; } } if (!found) { System.err.println("Could not find selected pack named \"" + name + "\" in line " + el.getLineNr()); } } } } } }
3,239,807
public void returnObject(Object obj) throws Exception { assertOpen(); boolean success = true; if(_testOnReturn && !(_factory.validateObject(obj))) { success = false; } else { try { _factory.passivateObject(obj); } catch(Exception e) { success = false; } } boolean shouldDestroy = !success; synchronized(this) { _numActive--; if((_maxIdle > 0) && (_pool.size() >= _maxIdle)) { shouldDestroy = true; } else if(success) { _pool.addFirst(new ObjectTimestampPair(obj)); } notifyAll(); // _numActive has changed } if(shouldDestroy) { try { _factory.destroyObject(obj); } catch(Exception e) { // ignored } } }
public void returnObject(Object obj) throws Exception { assertOpen(); boolean success = true; if(_testOnReturn && !(_factory.validateObject(obj))) { success = false; } else { try { _factory.passivateObject(obj); } catch(Exception e) { success = false; } } boolean shouldDestroy = !success; synchronized(this) { _numActive--; if((_maxIdle >= 0) && (_pool.size() >= _maxIdle)) { shouldDestroy = true; } else if(success) { _pool.addFirst(new ObjectTimestampPair(obj)); } notifyAll(); // _numActive has changed } if(shouldDestroy) { try { _factory.destroyObject(obj); } catch(Exception e) { // ignored } } }
3,239,808
public HelloPanel(InstallerFrame parent, InstallData idata) { super(parent, idata); // The 'super' layout GridBagLayout superLayout = new GridBagLayout(); setLayout(superLayout); GridBagConstraints gbConstraints = new GridBagConstraints(); gbConstraints.insets = new Insets(0, 0, 0, 0); gbConstraints.fill = GridBagConstraints.NONE; gbConstraints.anchor = GridBagConstraints.CENTER; // We initialize our 'real' layout JPanel centerPanel = new JPanel(); layout = new BoxLayout(centerPanel, BoxLayout.Y_AXIS); centerPanel.setLayout(layout); superLayout.addLayoutComponent(centerPanel, gbConstraints); add(centerPanel); // We create and put the labels String str; centerPanel.add(Box.createVerticalStrut(10)); str = parent.langpack.getString("HelloPanel.welcome1") + idata.info.getAppName() + " " + idata.info.getAppVersion() + parent.langpack.getString("HelloPanel.welcome2"); welcomeLabel = LabelFactory.create(str, parent.icons.getImageIcon("host"), JLabel.TRAILING); centerPanel.add(welcomeLabel); centerPanel.add(Box.createVerticalStrut(20)); ArrayList authors = idata.info.getAuthors(); int size = authors.size(); if (size > 0) { str = parent.langpack.getString("HelloPanel.authors"); appAuthorsLabel = LabelFactory.create(str, parent.icons.getImageIcon("information"), JLabel.TRAILING); centerPanel.add(appAuthorsLabel); JLabel label; for (int i = 0; i < size; i++) { Info.Author a = (Info.Author) authors.get(i); String email = (a.getEmail() != null && a.getEmail().length() > 0) ? (" <" + a.getEmail() + ">") : ""; label = LabelFactory.create(" - " + a.getName() + email, parent.icons .getImageIcon("empty"), JLabel.TRAILING); centerPanel.add(label); } centerPanel.add(Box.createVerticalStrut(20)); } if (idata.info.getAppURL() != null) { str = parent.langpack.getString("HelloPanel.url") + idata.info.getAppURL(); appURLLabel = LabelFactory.create(str, parent.icons.getImageIcon("bookmark"), JLabel.TRAILING); centerPanel.add(appURLLabel); } }
public HelloPanel(InstallerFrame parent, InstallData idata) { super(parent, idata); // The 'super' layout GridBagLayout superLayout = new GridBagLayout(); setLayout(superLayout); GridBagConstraints gbConstraints = new GridBagConstraints(); gbConstraints.insets = new Insets(0, 0, 0, 0); gbConstraints.fill = GridBagConstraints.NONE; gbConstraints.anchor = GridBagConstraints.CENTER; // We initialize our 'real' layout JPanel centerPanel = new JPanel(); BoxLayout layout = new BoxLayout(centerPanel, BoxLayout.Y_AXIS); centerPanel.setLayout(layout); superLayout.addLayoutComponent(centerPanel, gbConstraints); add(centerPanel); // We create and put the labels String str; centerPanel.add(Box.createVerticalStrut(10)); str = parent.langpack.getString("HelloPanel.welcome1") + idata.info.getAppName() + " " + idata.info.getAppVersion() + parent.langpack.getString("HelloPanel.welcome2"); welcomeLabel = LabelFactory.create(str, parent.icons.getImageIcon("host"), JLabel.TRAILING); centerPanel.add(welcomeLabel); centerPanel.add(Box.createVerticalStrut(20)); ArrayList authors = idata.info.getAuthors(); int size = authors.size(); if (size > 0) { str = parent.langpack.getString("HelloPanel.authors"); appAuthorsLabel = LabelFactory.create(str, parent.icons.getImageIcon("information"), JLabel.TRAILING); centerPanel.add(appAuthorsLabel); JLabel label; for (int i = 0; i < size; i++) { Info.Author a = (Info.Author) authors.get(i); String email = (a.getEmail() != null && a.getEmail().length() > 0) ? (" <" + a.getEmail() + ">") : ""; label = LabelFactory.create(" - " + a.getName() + email, parent.icons .getImageIcon("empty"), JLabel.TRAILING); centerPanel.add(label); } centerPanel.add(Box.createVerticalStrut(20)); } if (idata.info.getAppURL() != null) { str = parent.langpack.getString("HelloPanel.url") + idata.info.getAppURL(); appURLLabel = LabelFactory.create(str, parent.icons.getImageIcon("bookmark"), JLabel.TRAILING); centerPanel.add(appURLLabel); } }
3,239,809
public HelloPanel(InstallerFrame parent, InstallData idata) { super(parent, idata); // The 'super' layout GridBagLayout superLayout = new GridBagLayout(); setLayout(superLayout); GridBagConstraints gbConstraints = new GridBagConstraints(); gbConstraints.insets = new Insets(0, 0, 0, 0); gbConstraints.fill = GridBagConstraints.NONE; gbConstraints.anchor = GridBagConstraints.CENTER; // We initialize our 'real' layout JPanel centerPanel = new JPanel(); layout = new BoxLayout(centerPanel, BoxLayout.Y_AXIS); centerPanel.setLayout(layout); superLayout.addLayoutComponent(centerPanel, gbConstraints); add(centerPanel); // We create and put the labels String str; centerPanel.add(Box.createVerticalStrut(10)); str = parent.langpack.getString("HelloPanel.welcome1") + idata.info.getAppName() + " " + idata.info.getAppVersion() + parent.langpack.getString("HelloPanel.welcome2"); welcomeLabel = LabelFactory.create(str, parent.icons.getImageIcon("host"), JLabel.TRAILING); centerPanel.add(welcomeLabel); centerPanel.add(Box.createVerticalStrut(20)); ArrayList authors = idata.info.getAuthors(); int size = authors.size(); if (size > 0) { str = parent.langpack.getString("HelloPanel.authors"); appAuthorsLabel = LabelFactory.create(str, parent.icons.getImageIcon("information"), JLabel.TRAILING); centerPanel.add(appAuthorsLabel); JLabel label; for (int i = 0; i < size; i++) { Info.Author a = (Info.Author) authors.get(i); String email = (a.getEmail() != null && a.getEmail().length() > 0) ? (" <" + a.getEmail() + ">") : ""; label = LabelFactory.create(" - " + a.getName() + email, parent.icons .getImageIcon("empty"), JLabel.TRAILING); centerPanel.add(label); } centerPanel.add(Box.createVerticalStrut(20)); } if (idata.info.getAppURL() != null) { str = parent.langpack.getString("HelloPanel.url") + idata.info.getAppURL(); appURLLabel = LabelFactory.create(str, parent.icons.getImageIcon("bookmark"), JLabel.TRAILING); centerPanel.add(appURLLabel); } }
public HelloPanel(InstallerFrame parent, InstallData idata) { super(parent, idata); // The 'super' layout GridBagLayout superLayout = new GridBagLayout(); setLayout(superLayout); GridBagConstraints gbConstraints = new GridBagConstraints(); gbConstraints.insets = new Insets(0, 0, 0, 0); gbConstraints.fill = GridBagConstraints.NONE; gbConstraints.anchor = GridBagConstraints.CENTER; // We initialize our 'real' layout JPanel centerPanel = new JPanel(); layout = new BoxLayout(centerPanel, BoxLayout.Y_AXIS); centerPanel.setLayout(layout); superLayout.addLayoutComponent(centerPanel, gbConstraints); add(centerPanel); // We create and put the labels String str; centerPanel.add(Box.createVerticalStrut(10)); str = parent.langpack.getString("HelloPanel.welcome1") + idata.info.getAppName() + " " + idata.info.getAppVersion() + parent.langpack.getString("HelloPanel.welcome2"); JLabel welcomeLabel = LabelFactory.create(str, parent.icons.getImageIcon("host"), JLabel.TRAILING); centerPanel.add(welcomeLabel); centerPanel.add(Box.createVerticalStrut(20)); ArrayList authors = idata.info.getAuthors(); int size = authors.size(); if (size > 0) { str = parent.langpack.getString("HelloPanel.authors"); appAuthorsLabel = LabelFactory.create(str, parent.icons.getImageIcon("information"), JLabel.TRAILING); centerPanel.add(appAuthorsLabel); JLabel label; for (int i = 0; i < size; i++) { Info.Author a = (Info.Author) authors.get(i); String email = (a.getEmail() != null && a.getEmail().length() > 0) ? (" <" + a.getEmail() + ">") : ""; label = LabelFactory.create(" - " + a.getName() + email, parent.icons .getImageIcon("empty"), JLabel.TRAILING); centerPanel.add(label); } centerPanel.add(Box.createVerticalStrut(20)); } if (idata.info.getAppURL() != null) { str = parent.langpack.getString("HelloPanel.url") + idata.info.getAppURL(); appURLLabel = LabelFactory.create(str, parent.icons.getImageIcon("bookmark"), JLabel.TRAILING); centerPanel.add(appURLLabel); } }
3,239,810
public HelloPanel(InstallerFrame parent, InstallData idata) { super(parent, idata); // The 'super' layout GridBagLayout superLayout = new GridBagLayout(); setLayout(superLayout); GridBagConstraints gbConstraints = new GridBagConstraints(); gbConstraints.insets = new Insets(0, 0, 0, 0); gbConstraints.fill = GridBagConstraints.NONE; gbConstraints.anchor = GridBagConstraints.CENTER; // We initialize our 'real' layout JPanel centerPanel = new JPanel(); layout = new BoxLayout(centerPanel, BoxLayout.Y_AXIS); centerPanel.setLayout(layout); superLayout.addLayoutComponent(centerPanel, gbConstraints); add(centerPanel); // We create and put the labels String str; centerPanel.add(Box.createVerticalStrut(10)); str = parent.langpack.getString("HelloPanel.welcome1") + idata.info.getAppName() + " " + idata.info.getAppVersion() + parent.langpack.getString("HelloPanel.welcome2"); welcomeLabel = LabelFactory.create(str, parent.icons.getImageIcon("host"), JLabel.TRAILING); centerPanel.add(welcomeLabel); centerPanel.add(Box.createVerticalStrut(20)); ArrayList authors = idata.info.getAuthors(); int size = authors.size(); if (size > 0) { str = parent.langpack.getString("HelloPanel.authors"); appAuthorsLabel = LabelFactory.create(str, parent.icons.getImageIcon("information"), JLabel.TRAILING); centerPanel.add(appAuthorsLabel); JLabel label; for (int i = 0; i < size; i++) { Info.Author a = (Info.Author) authors.get(i); String email = (a.getEmail() != null && a.getEmail().length() > 0) ? (" <" + a.getEmail() + ">") : ""; label = LabelFactory.create(" - " + a.getName() + email, parent.icons .getImageIcon("empty"), JLabel.TRAILING); centerPanel.add(label); } centerPanel.add(Box.createVerticalStrut(20)); } if (idata.info.getAppURL() != null) { str = parent.langpack.getString("HelloPanel.url") + idata.info.getAppURL(); appURLLabel = LabelFactory.create(str, parent.icons.getImageIcon("bookmark"), JLabel.TRAILING); centerPanel.add(appURLLabel); } }
public HelloPanel(InstallerFrame parent, InstallData idata) { super(parent, idata); // The 'super' layout GridBagLayout superLayout = new GridBagLayout(); setLayout(superLayout); GridBagConstraints gbConstraints = new GridBagConstraints(); gbConstraints.insets = new Insets(0, 0, 0, 0); gbConstraints.fill = GridBagConstraints.NONE; gbConstraints.anchor = GridBagConstraints.CENTER; // We initialize our 'real' layout JPanel centerPanel = new JPanel(); layout = new BoxLayout(centerPanel, BoxLayout.Y_AXIS); centerPanel.setLayout(layout); superLayout.addLayoutComponent(centerPanel, gbConstraints); add(centerPanel); // We create and put the labels String str; centerPanel.add(Box.createVerticalStrut(10)); str = parent.langpack.getString("HelloPanel.welcome1") + idata.info.getAppName() + " " + idata.info.getAppVersion() + parent.langpack.getString("HelloPanel.welcome2"); welcomeLabel = LabelFactory.create(str, parent.icons.getImageIcon("host"), JLabel.TRAILING); centerPanel.add(welcomeLabel); centerPanel.add(Box.createVerticalStrut(20)); ArrayList authors = idata.info.getAuthors(); int size = authors.size(); if (size > 0) { str = parent.langpack.getString("HelloPanel.authors"); JLabel appAuthorsLabel = LabelFactory.create(str, parent.icons.getImageIcon("information"), JLabel.TRAILING); centerPanel.add(appAuthorsLabel); JLabel label; for (int i = 0; i < size; i++) { Info.Author a = (Info.Author) authors.get(i); String email = (a.getEmail() != null && a.getEmail().length() > 0) ? (" <" + a.getEmail() + ">") : ""; label = LabelFactory.create(" - " + a.getName() + email, parent.icons .getImageIcon("empty"), JLabel.TRAILING); centerPanel.add(label); } centerPanel.add(Box.createVerticalStrut(20)); } if (idata.info.getAppURL() != null) { str = parent.langpack.getString("HelloPanel.url") + idata.info.getAppURL(); appURLLabel = LabelFactory.create(str, parent.icons.getImageIcon("bookmark"), JLabel.TRAILING); centerPanel.add(appURLLabel); } }
3,239,811
public HelloPanel(InstallerFrame parent, InstallData idata) { super(parent, idata); // The 'super' layout GridBagLayout superLayout = new GridBagLayout(); setLayout(superLayout); GridBagConstraints gbConstraints = new GridBagConstraints(); gbConstraints.insets = new Insets(0, 0, 0, 0); gbConstraints.fill = GridBagConstraints.NONE; gbConstraints.anchor = GridBagConstraints.CENTER; // We initialize our 'real' layout JPanel centerPanel = new JPanel(); layout = new BoxLayout(centerPanel, BoxLayout.Y_AXIS); centerPanel.setLayout(layout); superLayout.addLayoutComponent(centerPanel, gbConstraints); add(centerPanel); // We create and put the labels String str; centerPanel.add(Box.createVerticalStrut(10)); str = parent.langpack.getString("HelloPanel.welcome1") + idata.info.getAppName() + " " + idata.info.getAppVersion() + parent.langpack.getString("HelloPanel.welcome2"); welcomeLabel = LabelFactory.create(str, parent.icons.getImageIcon("host"), JLabel.TRAILING); centerPanel.add(welcomeLabel); centerPanel.add(Box.createVerticalStrut(20)); ArrayList authors = idata.info.getAuthors(); int size = authors.size(); if (size > 0) { str = parent.langpack.getString("HelloPanel.authors"); appAuthorsLabel = LabelFactory.create(str, parent.icons.getImageIcon("information"), JLabel.TRAILING); centerPanel.add(appAuthorsLabel); JLabel label; for (int i = 0; i < size; i++) { Info.Author a = (Info.Author) authors.get(i); String email = (a.getEmail() != null && a.getEmail().length() > 0) ? (" <" + a.getEmail() + ">") : ""; label = LabelFactory.create(" - " + a.getName() + email, parent.icons .getImageIcon("empty"), JLabel.TRAILING); centerPanel.add(label); } centerPanel.add(Box.createVerticalStrut(20)); } if (idata.info.getAppURL() != null) { str = parent.langpack.getString("HelloPanel.url") + idata.info.getAppURL(); appURLLabel = LabelFactory.create(str, parent.icons.getImageIcon("bookmark"), JLabel.TRAILING); centerPanel.add(appURLLabel); } }
public HelloPanel(InstallerFrame parent, InstallData idata) { super(parent, idata); // The 'super' layout GridBagLayout superLayout = new GridBagLayout(); setLayout(superLayout); GridBagConstraints gbConstraints = new GridBagConstraints(); gbConstraints.insets = new Insets(0, 0, 0, 0); gbConstraints.fill = GridBagConstraints.NONE; gbConstraints.anchor = GridBagConstraints.CENTER; // We initialize our 'real' layout JPanel centerPanel = new JPanel(); layout = new BoxLayout(centerPanel, BoxLayout.Y_AXIS); centerPanel.setLayout(layout); superLayout.addLayoutComponent(centerPanel, gbConstraints); add(centerPanel); // We create and put the labels String str; centerPanel.add(Box.createVerticalStrut(10)); str = parent.langpack.getString("HelloPanel.welcome1") + idata.info.getAppName() + " " + idata.info.getAppVersion() + parent.langpack.getString("HelloPanel.welcome2"); welcomeLabel = LabelFactory.create(str, parent.icons.getImageIcon("host"), JLabel.TRAILING); centerPanel.add(welcomeLabel); centerPanel.add(Box.createVerticalStrut(20)); ArrayList authors = idata.info.getAuthors(); int size = authors.size(); if (size > 0) { str = parent.langpack.getString("HelloPanel.authors"); appAuthorsLabel = LabelFactory.create(str, parent.icons.getImageIcon("information"), JLabel.TRAILING); centerPanel.add(appAuthorsLabel); JLabel label; for (int i = 0; i < size; i++) { Info.Author a = (Info.Author) authors.get(i); String email = (a.getEmail() != null && a.getEmail().length() > 0) ? (" <" + a.getEmail() + ">") : ""; label = LabelFactory.create(" - " + a.getName() + email, parent.icons .getImageIcon("empty"), JLabel.TRAILING); centerPanel.add(label); } centerPanel.add(Box.createVerticalStrut(20)); } if (idata.info.getAppURL() != null) { str = parent.langpack.getString("HelloPanel.url") + idata.info.getAppURL(); JLabel appURLLabel = LabelFactory.create(str, parent.icons.getImageIcon("bookmark"), JLabel.TRAILING); centerPanel.add(appURLLabel); } }
3,239,812
public boolean validateObject(Object key, Object obj) { return true; }
public boolean validateObject(Object key, Object obj) { return true; }
3,239,813
public void copyStackAcrossT(int from, int to, int sizeZ) { PlaneArea pa; ROI3D roi3D = logicalROI.getStack(from); for (int z = 0; z < sizeZ; z++) { pa = roi3D.getPlaneArea(z); for (int t = from+1; t <= to; t++) { if (pa != null) logicalROI.setPlaneArea( (PlaneArea) (pa.copy()), z, t); } } }
public void copyStackAcrossT(int from, int to, int sizeZ) { PlaneArea pa; ROI3D roi3D = logicalROI.getStack(from); for (int z = 0; z < sizeZ; z++) { pa = roi3D.getPlaneArea(z); for (int t = from; t <= to; t++) { if (pa != null) logicalROI.setPlaneArea( (PlaneArea) (pa.copy()), z, t); } } }
3,239,814
public String[] getValues() { return new String[] { Compiler.STANDARD, Compiler.WEB}; }
public String[] getValues() { return new String[] { CompilerConfig.STANDARD, CompilerConfig.WEB}; }
3,239,815
public void execute() throws org.apache.tools.ant.BuildException { if (input == null) throw new BuildException(ResourceBundle.getBundle( "com/izforge/izpack/ant/langpacks/messages").getString( "input_must_be_specified")); if (output == null) throw new BuildException(ResourceBundle.getBundle( "com/izforge/izpack/ant/langpacks/messages").getString( "output_must_be_specified")); // if (installerType == null) now optional if (basedir == null) throw new BuildException(ResourceBundle.getBundle( "com/izforge/izpack/ant/langpacks/messages").getString( "basedir_must_be_specified")); // if (izPackDir == null) // throw new // BuildException(java.util.ResourceBundle.getBundle("com/izforge/izpack/ant/langpacks/messages").getString("izPackDir_must_be_specified")); String kind = (installerType == null ? null : installerType.getValue()); Compiler c = new Compiler(input, basedir, kind, output);// Create the // compiler Compiler.IZPACK_HOME = izPackDir; c.setPackagerListener(this);// Listen to the compiler messages if (properties != null) { Enumeration e = properties.keys(); while (e.hasMoreElements()) { String name = (String) e.nextElement(); String value = properties.getProperty(name); c.addProperty(name, value); } } if (inheritAll == true) { Hashtable projectProps = getProject().getProperties(); Enumeration e = projectProps.keys(); while (e.hasMoreElements()) { String name = (String) e.nextElement(); String value = (String) projectProps.get(name); c.addProperty(name, value); } } try { c.executeCompiler(); } catch (Exception e) { throw new BuildException(e);// Throw an exception if compilation // failed } }
public void execute() throws org.apache.tools.ant.BuildException { if (input == null && config == null) throw new BuildException(ResourceBundle.getBundle( "com/izforge/izpack/ant/langpacks/messages").getString( "input_must_be_specified")); if (output == null) throw new BuildException(ResourceBundle.getBundle( "com/izforge/izpack/ant/langpacks/messages").getString( "output_must_be_specified")); // if (installerType == null) now optional if (basedir == null) throw new BuildException(ResourceBundle.getBundle( "com/izforge/izpack/ant/langpacks/messages").getString( "basedir_must_be_specified")); // if (izPackDir == null) // throw new // BuildException(java.util.ResourceBundle.getBundle("com/izforge/izpack/ant/langpacks/messages").getString("izPackDir_must_be_specified")); String kind = (installerType == null ? null : installerType.getValue()); Compiler c = new Compiler(input, basedir, kind, output);// Create the // compiler Compiler.IZPACK_HOME = izPackDir; c.setPackagerListener(this);// Listen to the compiler messages if (properties != null) { Enumeration e = properties.keys(); while (e.hasMoreElements()) { String name = (String) e.nextElement(); String value = properties.getProperty(name); c.addProperty(name, value); } } if (inheritAll == true) { Hashtable projectProps = getProject().getProperties(); Enumeration e = projectProps.keys(); while (e.hasMoreElements()) { String name = (String) e.nextElement(); String value = (String) projectProps.get(name); c.addProperty(name, value); } } try { c.executeCompiler(); } catch (Exception e) { throw new BuildException(e);// Throw an exception if compilation // failed } }
3,239,817
public void execute() throws org.apache.tools.ant.BuildException { if (input == null) throw new BuildException(ResourceBundle.getBundle( "com/izforge/izpack/ant/langpacks/messages").getString( "input_must_be_specified")); if (output == null) throw new BuildException(ResourceBundle.getBundle( "com/izforge/izpack/ant/langpacks/messages").getString( "output_must_be_specified")); // if (installerType == null) now optional if (basedir == null) throw new BuildException(ResourceBundle.getBundle( "com/izforge/izpack/ant/langpacks/messages").getString( "basedir_must_be_specified")); // if (izPackDir == null) // throw new // BuildException(java.util.ResourceBundle.getBundle("com/izforge/izpack/ant/langpacks/messages").getString("izPackDir_must_be_specified")); String kind = (installerType == null ? null : installerType.getValue()); Compiler c = new Compiler(input, basedir, kind, output);// Create the // compiler Compiler.IZPACK_HOME = izPackDir; c.setPackagerListener(this);// Listen to the compiler messages if (properties != null) { Enumeration e = properties.keys(); while (e.hasMoreElements()) { String name = (String) e.nextElement(); String value = properties.getProperty(name); c.addProperty(name, value); } } if (inheritAll == true) { Hashtable projectProps = getProject().getProperties(); Enumeration e = projectProps.keys(); while (e.hasMoreElements()) { String name = (String) e.nextElement(); String value = (String) projectProps.get(name); c.addProperty(name, value); } } try { c.executeCompiler(); } catch (Exception e) { throw new BuildException(e);// Throw an exception if compilation // failed } }
public void execute() throws org.apache.tools.ant.BuildException { if (input == null) throw new BuildException(ResourceBundle.getBundle( "com/izforge/izpack/ant/langpacks/messages").getString( "input_must_be_specified")); if (output == null) throw new BuildException(ResourceBundle.getBundle( "com/izforge/izpack/ant/langpacks/messages").getString( "output_must_be_specified")); // if (installerType == null) now optional if (basedir == null) throw new BuildException(ResourceBundle.getBundle( "com/izforge/izpack/ant/langpacks/messages").getString( "basedir_must_be_specified")); // if (izPackDir == null) // throw new // BuildException(java.util.ResourceBundle.getBundle("com/izforge/izpack/ant/langpacks/messages").getString("izPackDir_must_be_specified")); String kind = (installerType == null ? null : installerType.getValue()); Compiler c = new Compiler(input, basedir, kind, output);// Create the // compiler Compiler.IZPACK_HOME = izPackDir; c.setPackagerListener(this);// Listen to the compiler messages if (properties != null) { Enumeration e = properties.keys(); while (e.hasMoreElements()) { String name = (String) e.nextElement(); String value = properties.getProperty(name); c.addProperty(name, value); } } if (inheritAll == true) { Hashtable projectProps = getProject().getProperties(); Enumeration e = projectProps.keys(); while (e.hasMoreElements()) { String name = (String) e.nextElement(); String value = (String) projectProps.get(name); c.addProperty(name, value); } } try { c.executeCompiler(); } catch (Exception e) { throw new BuildException(e);// Throw an exception if compilation // failed } }
3,239,818
public void execute() throws org.apache.tools.ant.BuildException { if (input == null) throw new BuildException(ResourceBundle.getBundle( "com/izforge/izpack/ant/langpacks/messages").getString( "input_must_be_specified")); if (output == null) throw new BuildException(ResourceBundle.getBundle( "com/izforge/izpack/ant/langpacks/messages").getString( "output_must_be_specified")); // if (installerType == null) now optional if (basedir == null) throw new BuildException(ResourceBundle.getBundle( "com/izforge/izpack/ant/langpacks/messages").getString( "basedir_must_be_specified")); // if (izPackDir == null) // throw new // BuildException(java.util.ResourceBundle.getBundle("com/izforge/izpack/ant/langpacks/messages").getString("izPackDir_must_be_specified")); String kind = (installerType == null ? null : installerType.getValue()); Compiler c = new Compiler(input, basedir, kind, output);// Create the // compiler Compiler.IZPACK_HOME = izPackDir; c.setPackagerListener(this);// Listen to the compiler messages if (properties != null) { Enumeration e = properties.keys(); while (e.hasMoreElements()) { String name = (String) e.nextElement(); String value = properties.getProperty(name); c.addProperty(name, value); } } if (inheritAll == true) { Hashtable projectProps = getProject().getProperties(); Enumeration e = projectProps.keys(); while (e.hasMoreElements()) { String name = (String) e.nextElement(); String value = (String) projectProps.get(name); c.addProperty(name, value); } } try { c.executeCompiler(); } catch (Exception e) { throw new BuildException(e);// Throw an exception if compilation // failed } }
public void execute() throws org.apache.tools.ant.BuildException { if (input == null) throw new BuildException(ResourceBundle.getBundle( "com/izforge/izpack/ant/langpacks/messages").getString( "input_must_be_specified")); if (output == null) throw new BuildException(ResourceBundle.getBundle( "com/izforge/izpack/ant/langpacks/messages").getString( "output_must_be_specified")); // if (installerType == null) now optional if (basedir == null) throw new BuildException(ResourceBundle.getBundle( "com/izforge/izpack/ant/langpacks/messages").getString( "basedir_must_be_specified")); // if (izPackDir == null) // throw new // BuildException(java.util.ResourceBundle.getBundle("com/izforge/izpack/ant/langpacks/messages").getString("izPackDir_must_be_specified")); String kind = (installerType == null ? null : installerType.getValue()); Compiler c = new Compiler(input, basedir, kind, output);// Create the // compiler Compiler.IZPACK_HOME = izPackDir; c.setPackagerListener(this);// Listen to the compiler messages if (properties != null) { Enumeration e = properties.keys(); while (e.hasMoreElements()) { String name = (String) e.nextElement(); String value = properties.getProperty(name); c.addProperty(name, value); } } if (inheritAll == true) { Hashtable projectProps = getProject().getProperties(); Enumeration e = projectProps.keys(); while (e.hasMoreElements()) { String name = (String) e.nextElement(); String value = (String) projectProps.get(name); c.addProperty(name, value); } } try { c.executeCompiler(); } catch (Exception e) { throw new BuildException(e);// Throw an exception if compilation // failed } }
3,239,819
public CustomSuite(final String projectName, final String suiteName, final Map parameters, final String annotationType) { super(true); m_projectName= projectName; m_suiteName= suiteName; m_parameters= parameters; if("1.4".equals(annotationType) || TestNG.JAVADOC_ANNOTATION_TYPE.equals(annotationType)) { m_annotationType= TestNG.JAVADOC_ANNOTATION_TYPE; } else { m_annotationType= TestNG.JDK5_ANNOTATION_TYPE; } }
public CustomSuite(final String projectName, final String suiteName, final Map parameters, final String annotationType) { super(true); m_projectName= projectName; m_suiteName= suiteName; m_parameters= parameters; if("1.4".equals(annotationType) || TestNG.JAVADOC_ANNOTATION_TYPE.equals(annotationType)) { m_annotationType= TestNG.JAVADOC_ANNOTATION_TYPE; } else { m_annotationType= TestNG.JDK_ANNOTATION_TYPE; } }
3,239,821
private static PrintWriter createLogFile( ) { String tempDir = System.getProperty( "java.io.tmpdir" ); File tempDirFile = new File( tempDir ); try { tempDirFile.mkdirs( ); } catch( RuntimeException e1 ) { e1.printStackTrace( ); } String logfilename = LOGFILENAME; System.out.println( "creating Logfile: '" + logfilename + "' in: '" + tempDir + "'" ); File out = new File( tempDir, logfilename ); PrintWriter logfile; if( tempDirFile.canWrite( ) ) { try { BufferedWriter fw = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(out), "UTF-8")); logfile = setLogFile( new PrintWriter( fw ) ); } catch( Exception e ) { logfile = null; e.printStackTrace( ); } } else { logfile = null; System.err.println( "Fatal: cannot write File: '" + logfilename + "' into: " + tempDirFile ); } return logfile; }
private static PrintWriter createLogFile( ) { String tempDir = System.getProperty( "java.io.tmpdir" ); File tempDirFile = new File( tempDir ); try { tempDirFile.mkdirs( ); } catch( RuntimeException e1 ) { e1.printStackTrace( ); } String logfilename = LOGFILENAME; System.out.println( "creating Logfile: '" + logfilename + "' in: '" + tempDir + "'" ); File out = new File( tempDir, logfilename ); PrintWriter logfile; if( tempDirFile.canWrite( ) ) { try { BufferedWriter fw = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(out), "UTF-8")); logfile = setLogFile( new PrintWriter( fw ) ); } catch( Exception e ) { logfile = null; e.printStackTrace( ); } } else { logfile = null; System.err.println( "Fatal: cannot write File: '" + logfilename + "' into: " + tempDirFile ); } return logfile; }
3,239,823
private static PrintWriter createLogFile( ) { String tempDir = System.getProperty( "java.io.tmpdir" ); File tempDirFile = new File( tempDir ); try { tempDirFile.mkdirs( ); } catch( RuntimeException e1 ) { e1.printStackTrace( ); } String logfilename = LOGFILENAME; System.out.println( "creating Logfile: '" + logfilename + "' in: '" + tempDir + "'" ); File out = new File( tempDir, logfilename ); PrintWriter logfile; if( tempDirFile.canWrite( ) ) { try { BufferedWriter fw = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(out), "UTF-8")); logfile = setLogFile( new PrintWriter( fw ) ); } catch( Exception e ) { logfile = null; e.printStackTrace( ); } } else { logfile = null; System.err.println( "Fatal: cannot write File: '" + logfilename + "' into: " + tempDirFile ); } return logfile; }
private static PrintWriter createLogFile( ) { String tempDir = System.getProperty( "java.io.tmpdir" ); File tempDirFile = new File(tempDir); try { tempDirFile.mkdirs( ); } catch( RuntimeException e1 ) { e1.printStackTrace( ); } String logfilename = LOGFILENAME; System.out.println( "creating Logfile: '" + logfilename + "' in: '" + tempDir + "'" ); File out = new File( tempDir, logfilename ); PrintWriter logfile; if( tempDirFile.canWrite( ) ) { try { BufferedWriter fw = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(out), "UTF-8")); logfile = setLogFile( new PrintWriter( fw ) ); } catch( Exception e ) { logfile = null; e.printStackTrace( ); } } else { logfile = null; System.err.println( "Fatal: cannot write File: '" + logfilename + "' into: " + tempDirFile ); } return logfile; }
3,239,824
private static PrintWriter createLogFile( ) { String tempDir = System.getProperty( "java.io.tmpdir" ); File tempDirFile = new File( tempDir ); try { tempDirFile.mkdirs( ); } catch( RuntimeException e1 ) { e1.printStackTrace( ); } String logfilename = LOGFILENAME; System.out.println( "creating Logfile: '" + logfilename + "' in: '" + tempDir + "'" ); File out = new File( tempDir, logfilename ); PrintWriter logfile; if( tempDirFile.canWrite( ) ) { try { BufferedWriter fw = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(out), "UTF-8")); logfile = setLogFile( new PrintWriter( fw ) ); } catch( Exception e ) { logfile = null; e.printStackTrace( ); } } else { logfile = null; System.err.println( "Fatal: cannot write File: '" + logfilename + "' into: " + tempDirFile ); } return logfile; }
private static PrintWriter createLogFile( ) { String tempDir = System.getProperty( "java.io.tmpdir" ); File tempDirFile = new File( tempDir ); try { tempDirFile.mkdirs( ); } catch( RuntimeException e1 ) { e1.printStackTrace( ); } String logfilename = LOGFILENAME; System.out.println( "creating Logfile: '" + logfilename + "' in: '" + tempDir + "'" ); File out = new File( tempDir, logfilename ); PrintWriter logfile; if( tempDirFile.canWrite( ) ) { try { BufferedWriter fw = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(out), "UTF-8")); logfile = setLogFile( new PrintWriter( fw ) ); } catch( Exception e ) { logfile = null; e.printStackTrace( ); } } else { logfile = null; System.err.println( "Fatal: cannot write File: '" + logfilename + "' into: " + tempDirFile ); } return logfile; }
3,239,825
private static PrintWriter createLogFile( ) { String tempDir = System.getProperty( "java.io.tmpdir" ); File tempDirFile = new File( tempDir ); try { tempDirFile.mkdirs( ); } catch( RuntimeException e1 ) { e1.printStackTrace( ); } String logfilename = LOGFILENAME; System.out.println( "creating Logfile: '" + logfilename + "' in: '" + tempDir + "'" ); File out = new File( tempDir, logfilename ); PrintWriter logfile; if( tempDirFile.canWrite( ) ) { try { BufferedWriter fw = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(out), "UTF-8")); logfile = setLogFile( new PrintWriter( fw ) ); } catch( Exception e ) { logfile = null; e.printStackTrace( ); } } else { logfile = null; System.err.println( "Fatal: cannot write File: '" + logfilename + "' into: " + tempDirFile ); } return logfile; }
private static PrintWriter createLogFile( ) { String tempDir = System.getProperty( "java.io.tmpdir" ); File tempDirFile = new File( tempDir ); try { tempDirFile.mkdirs( ); } catch( RuntimeException e1 ) { e1.printStackTrace( ); } String logfilename = LOGFILENAME; System.out.println( "creating Logfile: '" + logfilename + "' in: '" + tempDir + "'" ); File out = new File( tempDir, logfilename ); PrintWriter logfile; if( tempDirFile.canWrite( ) ) { try { BufferedWriter fw = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(out), "UTF-8")); logfile = setLogFile( new PrintWriter( fw ) ); } catch( Exception e ) { logfile = null; e.printStackTrace( ); } } else { logfile = null; System.err.println( "Fatal: cannot write File: '" + logfilename + "' into: " + tempDirFile ); } return logfile; }
3,239,826
private static PrintWriter createLogFile( ) { String tempDir = System.getProperty( "java.io.tmpdir" ); File tempDirFile = new File( tempDir ); try { tempDirFile.mkdirs( ); } catch( RuntimeException e1 ) { e1.printStackTrace( ); } String logfilename = LOGFILENAME; System.out.println( "creating Logfile: '" + logfilename + "' in: '" + tempDir + "'" ); File out = new File( tempDir, logfilename ); PrintWriter logfile; if( tempDirFile.canWrite( ) ) { try { BufferedWriter fw = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(out), "UTF-8")); logfile = setLogFile( new PrintWriter( fw ) ); } catch( Exception e ) { logfile = null; e.printStackTrace( ); } } else { logfile = null; System.err.println( "Fatal: cannot write File: '" + logfilename + "' into: " + tempDirFile ); } return logfile; }
private static PrintWriter createLogFile( ) { String tempDir = System.getProperty( "java.io.tmpdir" ); File tempDirFile = new File( tempDir ); try { tempDirFile.mkdirs( ); } catch( RuntimeException e1 ) { e1.printStackTrace( ); } String logfilename = LOGFILENAME; System.out.println( "creating Logfile: '" + logfilename + "' in: '" + tempDir + "'" ); File out = new File( tempDir, logfilename ); PrintWriter logfile; if( tempDirFile.canWrite( ) ) { try { BufferedWriter fw = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(out), "UTF-8")); logfile = setLogFile( new PrintWriter( fw ) ); } catch (RuntimeException e1) { logfile = null; e.printStackTrace( ); } } else { logfile = null; System.err.println( "Fatal: cannot write File: '" + logfilename + "' into: " + tempDirFile ); } return logfile; }
3,239,827
private static PrintWriter createLogFile( ) { String tempDir = System.getProperty( "java.io.tmpdir" ); File tempDirFile = new File( tempDir ); try { tempDirFile.mkdirs( ); } catch( RuntimeException e1 ) { e1.printStackTrace( ); } String logfilename = LOGFILENAME; System.out.println( "creating Logfile: '" + logfilename + "' in: '" + tempDir + "'" ); File out = new File( tempDir, logfilename ); PrintWriter logfile; if( tempDirFile.canWrite( ) ) { try { BufferedWriter fw = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(out), "UTF-8")); logfile = setLogFile( new PrintWriter( fw ) ); } catch( Exception e ) { logfile = null; e.printStackTrace( ); } } else { logfile = null; System.err.println( "Fatal: cannot write File: '" + logfilename + "' into: " + tempDirFile ); } return logfile; }
private static PrintWriter createLogFile( ) { String tempDir = System.getProperty( "java.io.tmpdir" ); File tempDirFile = new File( tempDir ); try { tempDirFile.mkdirs( ); } catch( RuntimeException e1 ) { e1.printStackTrace( ); } String logfilename = LOGFILENAME; System.out.println( "creating Logfile: '" + logfilename + "' in: '" + tempDir + "'" ); File out = new File( tempDir, logfilename ); PrintWriter logfile; if( tempDirFile.canWrite( ) ) { try { BufferedWriter fw = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(out), "UTF-8")); logfile = setLogFile( new PrintWriter( fw ) ); } catch( Exception e ) { logfile = null; e.printStackTrace( ); } } else { logfile = null; System.err.println( "Fatal: cannot write File: '" + logfilename + "' into: " + tempDirFile ); } return logfile; }
3,239,828
private static PrintWriter createLogFile( ) { String tempDir = System.getProperty( "java.io.tmpdir" ); File tempDirFile = new File( tempDir ); try { tempDirFile.mkdirs( ); } catch( RuntimeException e1 ) { e1.printStackTrace( ); } String logfilename = LOGFILENAME; System.out.println( "creating Logfile: '" + logfilename + "' in: '" + tempDir + "'" ); File out = new File( tempDir, logfilename ); PrintWriter logfile; if( tempDirFile.canWrite( ) ) { try { BufferedWriter fw = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(out), "UTF-8")); logfile = setLogFile( new PrintWriter( fw ) ); } catch( Exception e ) { logfile = null; e.printStackTrace( ); } } else { logfile = null; System.err.println( "Fatal: cannot write File: '" + logfilename + "' into: " + tempDirFile ); } return logfile; }
private static PrintWriter createLogFile( ) { String tempDir = System.getProperty( "java.io.tmpdir" ); File tempDirFile = new File( tempDir ); try { tempDirFile.mkdirs( ); } catch( RuntimeException e1 ) { e1.printStackTrace( ); } String logfilename = LOGFILENAME; System.out.println( "creating Logfile: '" + logfilename + "' in: '" + tempDir + "'" ); File out = new File( tempDir, logfilename ); PrintWriter logfile; if( tempDirFile.canWrite( ) ) { try { BufferedWriter fw = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(out), "UTF-8")); logfile = setLogFile( new PrintWriter( fw ) ); } catch( Exception e ) { logfile = null; e.printStackTrace( ); } } else { logfile = null; System.err.println( "Fatal: cannot write File: '" + logfilename + "' into: " + tempDirFile ); } return logfile; }
3,239,829
private static PrintWriter createLogFile( ) { String tempDir = System.getProperty( "java.io.tmpdir" ); File tempDirFile = new File( tempDir ); try { tempDirFile.mkdirs( ); } catch( RuntimeException e1 ) { e1.printStackTrace( ); } String logfilename = LOGFILENAME; System.out.println( "creating Logfile: '" + logfilename + "' in: '" + tempDir + "'" ); File out = new File( tempDir, logfilename ); PrintWriter logfile; if( tempDirFile.canWrite( ) ) { try { BufferedWriter fw = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(out), "UTF-8")); logfile = setLogFile( new PrintWriter( fw ) ); } catch( Exception e ) { logfile = null; e.printStackTrace( ); } } else { logfile = null; System.err.println( "Fatal: cannot write File: '" + logfilename + "' into: " + tempDirFile ); } return logfile; }
private static PrintWriter createLogFile( ) { String tempDir = System.getProperty( "java.io.tmpdir" ); File tempDirFile = new File( tempDir ); try { tempDirFile.mkdirs( ); } catch( RuntimeException e1 ) { e1.printStackTrace( ); } String logfilename = LOGFILENAME; System.out.println( "creating Logfile: '" + logfilename + "' in: '" + tempDir + "'" ); File out = new File( tempDir, logfilename ); PrintWriter logfile; if( tempDirFile.canWrite( ) ) { try { BufferedWriter fw = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(out), "UTF-8")); logfile = setLogFile( new PrintWriter( fw ) ); } catch( Exception e ) { logfile = null; e.printStackTrace( ); } } else { logfile = null; System.err.println( "Fatal: cannot write File: '" + logfilename + "' into: " + tempDirFile ); } return logfile; }
3,239,830
public static void error( Object s ) { trace( s ); System.err.println( s ); System.err.flush( ); log( s ); }
public static void error( Object s ) { trace( s ); System.err.println( s ); System.err.flush( ); log( s ); }
3,239,831
public static PrintWriter getLogFile( ) { PrintWriter logfile = (PrintWriter) System.getProperties().get(IZPACK_LOGFILE); return logfile; }
public static PrintWriter getLogFile( ) { PrintWriter logfile = (PrintWriter) System.getProperties().get(IZPACK_LOGFILE); return logfile; }
3,239,832
public static PrintWriter getLogFile( ) { PrintWriter logfile = (PrintWriter) System.getProperties().get(IZPACK_LOGFILE); return logfile; }
public static PrintWriter getLogFile( ) { PrintWriter logfile = (PrintWriter) System.getProperties().get(IZPACK_LOGFILE); return logfile; }
3,239,833
public static boolean isLOG( ) { return LOG; }
public static boolean isLOG( ) { return LOG; }
3,239,834
public static boolean isSTACKTRACE( ) { return STACKTRACE; }
public static boolean isSTACKTRACE( ) { return STACKTRACE; }
3,239,835
public static boolean isTRACE( ) { return TRACE; }
public static boolean isTRACE( ) { return TRACE; }
3,239,836
public static void log( Object o ) { //if LOG was given if(LOG ) { PrintWriter logfile; if( ( logfile = getLogFile( ) ) == null ) { logfile = createLogFile( ); } if( logfile != null ) { if( o == null ) { o = "null"; } logfile.println( o ); if( o instanceof Throwable ) { ( (Throwable) o ).printStackTrace( logfile ); } logfile.flush( ); //logfile.close(); //logFile = null; } else { System.err.println( "Cannot write into logfile: (" + logfile + ") <- '" + o + "'" ); } } }
public static void log( Object o ) { //if LOG was given if(LOG ) { PrintWriter logfile; if( ( logfile = getLogFile( ) ) == null ) { logfile = createLogFile( ); } if( logfile != null ) { if( o == null ) { o = "null"; } logfile.println( o ); if( o instanceof Throwable ) { ( (Throwable) o ).printStackTrace( logfile ); } logfile.flush( ); //logfile.close(); //logFile = null; } else { System.err.println( "Cannot write into logfile: (" + logfile + ") <- '" + o + "'" ); } } }
3,239,837
public static void log( Object o ) { //if LOG was given if(LOG ) { PrintWriter logfile; if( ( logfile = getLogFile( ) ) == null ) { logfile = createLogFile( ); } if( logfile != null ) { if( o == null ) { o = "null"; } logfile.println( o ); if( o instanceof Throwable ) { ( (Throwable) o ).printStackTrace( logfile ); } logfile.flush( ); //logfile.close(); //logFile = null; } else { System.err.println( "Cannot write into logfile: (" + logfile + ") <- '" + o + "'" ); } } }
public static void log( Object o ) { //if LOG was given if(LOG ) { PrintWriter logfile; if( ( logfile = getLogFile( ) ) == null ) { logfile = createLogFile( ); } if( logfile != null ) { if( o == null ) { o = "null"; } logfile.println( o ); if( o instanceof Throwable ) { ( (Throwable) o ).printStackTrace( logfile ); } logfile.flush( ); //logfile.close(); //logFile = null; } else { System.err.println( "Cannot write into logfile: (" + logfile + ") <- '" + o + "'" ); } } }
3,239,838
public static void log( Object o ) { //if LOG was given if(LOG ) { PrintWriter logfile; if( ( logfile = getLogFile( ) ) == null ) { logfile = createLogFile( ); } if( logfile != null ) { if( o == null ) { o = "null"; } logfile.println( o ); if( o instanceof Throwable ) { ( (Throwable) o ).printStackTrace( logfile ); } logfile.flush( ); //logfile.close(); //logFile = null; } else { System.err.println( "Cannot write into logfile: (" + logfile + ") <- '" + o + "'" ); } } }
public static void log( Object o ) { //if LOG was given if(LOG ) { PrintWriter logfile; if( ( logfile = getLogFile( ) ) == null ) { logfile = createLogFile( ); if( logfile != null ) { if( o == null ) { o = "null"; logfile.println( o ); if( o instanceof Throwable ) { ( (Throwable) o ).printStackTrace( logfile ); logfile.flush( ); //logfile.close(); //logFile = null; else { System.err.println( "Cannot write into logfile: (" + logfile + ") <- '" + o + "'" ); }
3,239,839
public static void setLOG( boolean aFlag ) { System.out.println( DLOG + " = " + aFlag ); LOG = aFlag; }
public static void setLOG( boolean aFlag ) { System.out.println( DLOG + " = " + aFlag ); LOG = aFlag; }
3,239,840
public static synchronized PrintWriter setLogFile( PrintWriter aLogFile ) { System.getProperties( ).put( IZPACK_LOGFILE, aLogFile ); PrintWriter logfile = (PrintWriter) System.getProperties().get(IZPACK_LOGFILE); if( logfile == null ) { System.err.println( "Set::logfile == null" ); } return logfile; }
public static synchronized PrintWriter setLogFile( PrintWriter aLogFile ) { System.getProperties( ).put( IZPACK_LOGFILE, aLogFile ); PrintWriter logfile = (PrintWriter) System.getProperties().get(IZPACK_LOGFILE); if( logfile == null ) { System.err.println( "Set::logfile == null" ); } return logfile; }
3,239,841
public static synchronized PrintWriter setLogFile( PrintWriter aLogFile ) { System.getProperties( ).put( IZPACK_LOGFILE, aLogFile ); PrintWriter logfile = (PrintWriter) System.getProperties().get(IZPACK_LOGFILE); if( logfile == null ) { System.err.println( "Set::logfile == null" ); } return logfile; }
public static synchronized PrintWriter setLogFile( PrintWriter aLogFile ) { System.getProperties( ).put( IZPACK_LOGFILE, aLogFile ); PrintWriter logfile = (PrintWriter) System.getProperties().get(IZPACK_LOGFILE); if( logfile == null ) { System.err.println( "Set::logfile == null" ); } return logfile; }
3,239,842
public static synchronized PrintWriter setLogFile( PrintWriter aLogFile ) { System.getProperties( ).put( IZPACK_LOGFILE, aLogFile ); PrintWriter logfile = (PrintWriter) System.getProperties().get(IZPACK_LOGFILE); if( logfile == null ) { System.err.println( "Set::logfile == null" ); } return logfile; }
public static synchronized PrintWriter setLogFile( PrintWriter aLogFile ) { System.getProperties( ).put( IZPACK_LOGFILE, aLogFile ); PrintWriter logfile = (PrintWriter) System.getProperties().get(IZPACK_LOGFILE); if( logfile == null ) { System.err.println( "Set::logfile == null" ); } return logfile; }
3,239,843
public static synchronized PrintWriter setLogFile( PrintWriter aLogFile ) { System.getProperties( ).put( IZPACK_LOGFILE, aLogFile ); PrintWriter logfile = (PrintWriter) System.getProperties().get(IZPACK_LOGFILE); if( logfile == null ) { System.err.println( "Set::logfile == null" ); } return logfile; }
public static synchronized PrintWriter setLogFile( PrintWriter aLogFile ) { System.getProperties( ).put( IZPACK_LOGFILE, aLogFile ); PrintWriter logfile = (PrintWriter) System.getProperties().get(IZPACK_LOGFILE); if( logfile == null ) { System.err.println( "Set::logfile == null" ); } return logfile; }
3,239,844
public static void setSTACKTRACE( boolean aFlag ) { System.out.println( DSTACKTRACE + " = " + aFlag ); STACKTRACE = aFlag; }
public static void setSTACKTRACE( boolean aFlag ) { System.out.println( DSTACKTRACE + " = " + aFlag ); STACKTRACE = aFlag; }
3,239,845
public static void setTRACE( boolean aFlag ) { System.out.println( DTRACE + " = " + aFlag ); TRACE = aFlag; }
public static void setTRACE( boolean aFlag ) { System.out.println( DTRACE + " = " + aFlag ); TRACE = aFlag; }
3,239,846
public static boolean stackTracing( ) { return STACKTRACE; }
public static boolean stackTracing( ) { return STACKTRACE; }
3,239,847
public static void trace( Object s ) { if( TRACE ) { // console.println(s.toString()); System.out.println( s ); if( STACKTRACE && ( s instanceof Throwable ) ) { // StringWriter sw = new StringWriter(); // PrintWriter pw = new PrintWriter(sw); // ((Throwable)s).printStackTrace(pw); // console.println(sw.toString()); ( (Throwable) s ).printStackTrace( ); } System.out.flush( ); } }
public static void trace( Object s ) { if( TRACE ) { // console.println(s.toString()); System.out.println( s ); if( STACKTRACE && ( s instanceof Throwable ) ) { // StringWriter sw = new StringWriter(); // PrintWriter pw = new PrintWriter(sw); // ((Throwable)s).printStackTrace(pw); // console.println(sw.toString()); ( (Throwable) s ).printStackTrace( ); } System.out.flush( ); } }
3,239,848
public static void trace( Object s ) { if( TRACE ) { // console.println(s.toString()); System.out.println( s ); if( STACKTRACE && ( s instanceof Throwable ) ) { // StringWriter sw = new StringWriter(); // PrintWriter pw = new PrintWriter(sw); // ((Throwable)s).printStackTrace(pw); // console.println(sw.toString()); ( (Throwable) s ).printStackTrace( ); } System.out.flush( ); } }
public static void trace( Object s ) { if( TRACE ) { // console.println(s.toString()); if (TRACE) { System.out.println(s); if( STACKTRACE && ( s instanceof Throwable ) ) { // StringWriter sw = new StringWriter(); // PrintWriter pw = new PrintWriter(sw); // ((Throwable)s).printStackTrace(pw); // console.println(sw.toString()); ( (Throwable) s ).printStackTrace( ); } System.out.flush( ); } }
3,239,849
public static void trace( Object s ) { if( TRACE ) { // console.println(s.toString()); System.out.println( s ); if( STACKTRACE && ( s instanceof Throwable ) ) { // StringWriter sw = new StringWriter(); // PrintWriter pw = new PrintWriter(sw); // ((Throwable)s).printStackTrace(pw); // console.println(sw.toString()); ( (Throwable) s ).printStackTrace( ); } System.out.flush( ); } }
public static void trace( Object s ) { if( TRACE ) { // console.println(s.toString()); System.out.println( s ); if( STACKTRACE && ( s instanceof Throwable ) ) { // StringWriter sw = new StringWriter(); // PrintWriter pw = new PrintWriter(sw); // ((Throwable)s).printStackTrace(pw); // console.println(sw.toString()); ( (Throwable) s ).printStackTrace( ); } System.out.flush( ); } }
3,239,850
public static void trace( Object s ) { if( TRACE ) { // console.println(s.toString()); System.out.println( s ); if( STACKTRACE && ( s instanceof Throwable ) ) { // StringWriter sw = new StringWriter(); // PrintWriter pw = new PrintWriter(sw); // ((Throwable)s).printStackTrace(pw); // console.println(sw.toString()); ( (Throwable) s ).printStackTrace( ); } System.out.flush( ); } }
public static void trace( Object s ) { if( TRACE ) { // console.println(s.toString()); System.out.println( s ); if( STACKTRACE && ( s instanceof Throwable ) ) { // StringWriter sw = new StringWriter(); // PrintWriter pw = new PrintWriter(sw); // ((Throwable)s).printStackTrace(pw); // console.println(sw.toString()); ( (Throwable) s ).printStackTrace( ); } System.out.flush(); } } }
3,239,851
public static void trace( Object s ) { if( TRACE ) { // console.println(s.toString()); System.out.println( s ); if( STACKTRACE && ( s instanceof Throwable ) ) { // StringWriter sw = new StringWriter(); // PrintWriter pw = new PrintWriter(sw); // ((Throwable)s).printStackTrace(pw); // console.println(sw.toString()); ( (Throwable) s ).printStackTrace( ); } System.out.flush( ); } }
public static void trace( Object s ) { if( TRACE ) { // console.println(s.toString()); System.out.println( s ); if( STACKTRACE && ( s instanceof Throwable ) ) { // StringWriter sw = new StringWriter(); // PrintWriter pw = new PrintWriter(sw); // ((Throwable)s).printStackTrace(pw); // console.println(sw.toString()); ( (Throwable) s ).printStackTrace( ); System.out.flush( ); }
3,239,852
public static boolean tracing( ) { return TRACE; }
public static boolean tracing( ) { return TRACE; }
3,239,853
IdentityKey(final int ident) { this.ident = ident; }
IdentityKey(final int ident) { this.ident = ident; }
3,239,854