bugged
stringlengths 6
599k
| fixed
stringlengths 6
40.8M
| __index_level_0__
int64 0
3.24M
|
---|---|---|
public void errorUnpack(String error) { this.packOpLabel.setText(error); idata.installSuccess = false; JOptionPane.showMessageDialog(this, error.toString(), parent.langpack.getString("installer.error"), JOptionPane.ERROR_MESSAGE); } | public void errorUnpack(String error) { this.packOpLabel.setText(error); idata.installSuccess = false; JOptionPane.showMessageDialog( this, error.toString(), parent.langpack.getString("installer.error"), JOptionPane.ERROR_MESSAGE); } | 3,241,872 |
public void nextStep(String packName, int stepno, int max) { this.packProgressBar.setValue(0); this.packProgressBar.setMinimum(0); this.packProgressBar.setMaximum(max); this.packProgressBar.setString(packName); this.overallProgressBar.setValue(stepno - 1); this.overallProgressBar.setString(Integer.toString (stepno) + " / " + Integer.toString (this.noOfPacks)); } | public void nextStep(String packName, int stepno, int max) { this.packProgressBar.setValue(0); this.packProgressBar.setMinimum(0); this.packProgressBar.setMaximum(max); this.packProgressBar.setString(packName); this.overallProgressBar.setValue(stepno - 1); this.overallProgressBar.setString( Integer.toString(stepno) + " / " + Integer.toString(this.noOfPacks)); } | 3,241,873 |
public void startAction (String name, int noOfJobs) { parent.blockGUI(); // figure out how many packs there are to install this.noOfPacks = noOfJobs; this.overallProgressBar.setMinimum (0); this.overallProgressBar.setMaximum (this.noOfPacks); this.overallProgressBar.setString ("0 / " + Integer.toString (this.noOfPacks)); } | public void startAction(String name, int noOfJobs) { parent.blockGUI(); // figure out how many packs there are to install this.noOfPacks = noOfJobs; this.overallProgressBar.setMinimum (0); this.overallProgressBar.setMaximum (this.noOfPacks); this.overallProgressBar.setString ("0 / " + Integer.toString (this.noOfPacks)); } | 3,241,874 |
public void startAction (String name, int noOfJobs) { parent.blockGUI(); // figure out how many packs there are to install this.noOfPacks = noOfJobs; this.overallProgressBar.setMinimum (0); this.overallProgressBar.setMaximum (this.noOfPacks); this.overallProgressBar.setString ("0 / " + Integer.toString (this.noOfPacks)); } | public void startAction (String name, int noOfJobs) { parent.blockGUI(); // figure out how many packs there are to install this.noOfPacks = noOfJobs; this.overallProgressBar.setMinimum (0); this.overallProgressBar.setMaximum (this.noOfPacks); this.overallProgressBar.setString ("0 / " + Integer.toString (this.noOfPacks)); } | 3,241,875 |
public void stopAction() { parent.releaseGUI(); parent.lockPrevButton(); this.overallProgressBar.setValue(this.overallProgressBar.getValue() + 1); this.packProgressBar.setString(parent.langpack.getString("InstallPanel.finished")); this.packProgressBar.setEnabled(false); String no_of_packs = Integer.toString (this.noOfPacks); this.overallProgressBar.setString (no_of_packs + " / " + no_of_packs); this.overallProgressBar.setEnabled (false); this.packOpLabel.setText(" "); this.packOpLabel.setEnabled(false); idata.installSuccess = true; idata.canClose = true; this.validated = true; if (idata.panels.indexOf(this) != (idata.panels.size() - 1)) parent.unlockNextButton(); } | public void stopAction() { parent.releaseGUI(); parent.lockPrevButton(); this.overallProgressBar.setValue(this.overallProgressBar.getValue() + 1); this.packProgressBar.setString( parent.langpack.getString("InstallPanel.finished")); this.packProgressBar.setEnabled(false); String no_of_packs = Integer.toString (this.noOfPacks); this.overallProgressBar.setString (no_of_packs + " / " + no_of_packs); this.overallProgressBar.setEnabled (false); this.packOpLabel.setText(" "); this.packOpLabel.setEnabled(false); idata.installSuccess = true; idata.canClose = true; this.validated = true; if (idata.panels.indexOf(this) != (idata.panels.size() - 1)) parent.unlockNextButton(); } | 3,241,876 |
public void stopAction() { parent.releaseGUI(); parent.lockPrevButton(); this.overallProgressBar.setValue(this.overallProgressBar.getValue() + 1); this.packProgressBar.setString(parent.langpack.getString("InstallPanel.finished")); this.packProgressBar.setEnabled(false); String no_of_packs = Integer.toString (this.noOfPacks); this.overallProgressBar.setString (no_of_packs + " / " + no_of_packs); this.overallProgressBar.setEnabled (false); this.packOpLabel.setText(" "); this.packOpLabel.setEnabled(false); idata.installSuccess = true; idata.canClose = true; this.validated = true; if (idata.panels.indexOf(this) != (idata.panels.size() - 1)) parent.unlockNextButton(); } | public void stopAction() { parent.releaseGUI(); parent.lockPrevButton(); this.overallProgressBar.setValue(this.overallProgressBar.getValue() + 1); this.packProgressBar.setString(parent.langpack.getString("InstallPanel.finished")); this.packProgressBar.setEnabled(false); String no_of_packs = Integer.toString (this.noOfPacks); this.overallProgressBar.setString (no_of_packs + " / " + no_of_packs); this.overallProgressBar.setEnabled (false); this.packOpLabel.setText(" "); this.packOpLabel.setEnabled(false); idata.installSuccess = true; idata.canClose = true; this.validated = true; if (idata.panels.indexOf(this) != (idata.panels.size() - 1)) parent.unlockNextButton(); } | 3,241,877 |
protected void addFile(File file, String relPath, String targetOs, boolean override, ArrayList list) throws Exception { // We check if 'file' is correct if (!file.exists()) throw new Exception(file.toString() + " does not exist"); // Recursive part if (file.isDirectory()) { File[] files = file.listFiles(); if (files == null) return; int size = files.length; String np = relPath + "/" + file.getName(); for (int i = 0; i < size; i++) addFile(files[i], np, targetOs, override, list); } else { PackSource nf = new PackSource(); nf.src = file.getAbsolutePath(); nf.targetdir = relPath; nf.os = targetOs; nf.override = override; list.add(nf); } } | protected void addFile(File file, String relPath, String targetOs, boolean override, ArrayList list) throws Exception { // We check if 'file' is correct if (!file.exists()) throw new Exception(file.toString() + " does not exist"); // Recursive part if (file.isDirectory()) { File[] files = file.listFiles(); if (files == null) return; int size = files.length; String np = relPath + "/" + file.getName(); for (int i = 0; i < size; i++) addFile(files[i], np, targetOs, override, list); } else { PackSource nf = new PackSource(); nf.src = file.getAbsolutePath(); nf.targetdir = relPath; nf.os = targetOs; nf.override = override; list.add(nf); } } | 3,241,879 |
protected void addFileSet(String path, String[] includes, String[] excludes, String relPath, String targetOs, ArrayList list, String casesensitive) throws Exception { boolean bCasesensitive = false; File test = new File(path); if (test.isDirectory()) { if (casesensitive != null) bCasesensitive = casesensitive.equalsIgnoreCase("Yes"); DirectoryScanner ds = new DirectoryScanner(); ds.setIncludes(includes); ds.setExcludes(excludes); ds.setBasedir(new File(path)); ds.setCaseSensitive(bCasesensitive); ds.scan(); String[] files = ds.getIncludedFiles(); String newRelativePath = null; String absolutBasePath = test.getParent(); String absolutPath = test.getAbsolutePath(); String absolutFilePath = null; int copyPathFrom = absolutBasePath.length() + 1; for (int i = 0; i < files.length; i++) { File file = new File(absolutPath + File.separator + (String) files[i]); absolutFilePath = file.getParent(); newRelativePath = relPath + File.separator + absolutFilePath.substring(copyPathFrom); //FIX ME: the override for fileset is by default true, needs to be changed addFile(file, newRelativePath, targetOs, true, list); } } else throw new Exception("\"dir\" attribute of fileset is not valide :" + path); } | protected void addFileSet(String path, String[] includes, String[] excludes, String relPath, String targetOs, ArrayList list, String casesensitive) throws Exception { boolean bCasesensitive = false; File test = new File(path); if (test.isDirectory()) { if (casesensitive != null) bCasesensitive = casesensitive.equalsIgnoreCase("Yes"); DirectoryScanner ds = new DirectoryScanner(); ds.setIncludes(includes); ds.setExcludes(excludes); ds.setBasedir(new File(path)); ds.setCaseSensitive(bCasesensitive); ds.scan(); String[] files = ds.getIncludedFiles(); String[] dirs = ds.getIncludedDirectories(); /* Old buggy code String newRelativePath = null; String absolutBasePath = test.getParent(); String absolutPath = test.getAbsolutePath(); String absolutFilePath = null; int copyPathFrom = absolutBasePath.length() + 1; for (int i = 0; i < files.length; i++) { File file = new File(absolutPath + File.separator + (String) files[i]); absolutFilePath = file.getParent(); newRelativePath = relPath + File.separator + absolutFilePath.substring(copyPathFrom); //FIX ME: the override for fileset is by default true, needs to be changed addFile(file, newRelativePath, targetOs, true, list); } } else throw new Exception("\"dir\" attribute of fileset is not valide :" + path); } | 3,241,880 |
protected void addFileSet(String path, String[] includes, String[] excludes, String relPath, String targetOs, ArrayList list, String casesensitive) throws Exception { boolean bCasesensitive = false; File test = new File(path); if (test.isDirectory()) { if (casesensitive != null) bCasesensitive = casesensitive.equalsIgnoreCase("Yes"); DirectoryScanner ds = new DirectoryScanner(); ds.setIncludes(includes); ds.setExcludes(excludes); ds.setBasedir(new File(path)); ds.setCaseSensitive(bCasesensitive); ds.scan(); String[] files = ds.getIncludedFiles(); String newRelativePath = null; String absolutBasePath = test.getParent(); String absolutPath = test.getAbsolutePath(); String absolutFilePath = null; int copyPathFrom = absolutBasePath.length() + 1; for (int i = 0; i < files.length; i++) { File file = new File(absolutPath + File.separator + (String) files[i]); absolutFilePath = file.getParent(); newRelativePath = relPath + File.separator + absolutFilePath.substring(copyPathFrom); //FIX ME: the override for fileset is by default true, needs to be changed addFile(file, newRelativePath, targetOs, true, list); } } else throw new Exception("\"dir\" attribute of fileset is not valide :" + path); } | protected void addFileSet(String path, String[] includes, String[] excludes, String relPath, String targetOs, ArrayList list, String casesensitive) throws Exception { boolean bCasesensitive = false; File test = new File(path); if (test.isDirectory()) { if (casesensitive != null) bCasesensitive = casesensitive.equalsIgnoreCase("Yes"); DirectoryScanner ds = new DirectoryScanner(); ds.setIncludes(includes); ds.setExcludes(excludes); ds.setBasedir(new File(path)); ds.setCaseSensitive(bCasesensitive); ds.scan(); String[] files = ds.getIncludedFiles(); String newRelativePath = null; String absolutBasePath = test.getParentFile().getAbsolutePath(); String absolutPath = test.getAbsolutePath(); String absolutFilePath = null; int copyPathFrom = absolutBasePath.length() + 1; for (int i = 0; i < files.length; i++) { File file = new File(absolutPath + File.separator + (String) files[i]); absolutFilePath = file.getParent(); newRelativePath = relPath + File.separator + absolutFilePath.substring(copyPathFrom); //FIX ME: the override for fileset is by default true, needs to be changed addFile(file, newRelativePath, targetOs, true, list); } } else throw new Exception("\"dir\" attribute of fileset is not valide :" + path); } | 3,241,881 |
protected void addFileSet(String path, String[] includes, String[] excludes, String relPath, String targetOs, ArrayList list, String casesensitive) throws Exception { boolean bCasesensitive = false; File test = new File(path); if (test.isDirectory()) { if (casesensitive != null) bCasesensitive = casesensitive.equalsIgnoreCase("Yes"); DirectoryScanner ds = new DirectoryScanner(); ds.setIncludes(includes); ds.setExcludes(excludes); ds.setBasedir(new File(path)); ds.setCaseSensitive(bCasesensitive); ds.scan(); String[] files = ds.getIncludedFiles(); String newRelativePath = null; String absolutBasePath = test.getParent(); String absolutPath = test.getAbsolutePath(); String absolutFilePath = null; int copyPathFrom = absolutBasePath.length() + 1; for (int i = 0; i < files.length; i++) { File file = new File(absolutPath + File.separator + (String) files[i]); absolutFilePath = file.getParent(); newRelativePath = relPath + File.separator + absolutFilePath.substring(copyPathFrom); //FIX ME: the override for fileset is by default true, needs to be changed addFile(file, newRelativePath, targetOs, true, list); } } else throw new Exception("\"dir\" attribute of fileset is not valide :" + path); } | protected void addFileSet(String path, String[] includes, String[] excludes, String relPath, String targetOs, ArrayList list, String casesensitive) throws Exception { boolean bCasesensitive = false; File test = new File(path); if (test.isDirectory()) { if (casesensitive != null) bCasesensitive = casesensitive.equalsIgnoreCase("Yes"); DirectoryScanner ds = new DirectoryScanner(); ds.setIncludes(includes); ds.setExcludes(excludes); ds.setBasedir(new File(path)); ds.setCaseSensitive(bCasesensitive); ds.scan(); String[] files = ds.getIncludedFiles(); String newRelativePath = null; String absolutBasePath = test.getParent(); String absolutPath = test.getAbsolutePath(); String absolutFilePath = null; int copyPathFrom = absolutBasePath.length() + 1; for (int i = 0; i < files.length; i++) { File file = new File(absolutPath + File.separator + (String) files[i]); absolutFilePath = file.getParentFile().getAbsolutePath(); newRelativePath = relPath + File.separator + absolutFilePath.substring(copyPathFrom); //FIX ME: the override for fileset is by default true, needs to be changed addFile(file, newRelativePath, targetOs, true, list); } } else throw new Exception("\"dir\" attribute of fileset is not valide :" + path); } | 3,241,882 |
protected void addFileSet(String path, String[] includes, String[] excludes, String relPath, String targetOs, ArrayList list, String casesensitive) throws Exception { boolean bCasesensitive = false; File test = new File(path); if (test.isDirectory()) { if (casesensitive != null) bCasesensitive = casesensitive.equalsIgnoreCase("Yes"); DirectoryScanner ds = new DirectoryScanner(); ds.setIncludes(includes); ds.setExcludes(excludes); ds.setBasedir(new File(path)); ds.setCaseSensitive(bCasesensitive); ds.scan(); String[] files = ds.getIncludedFiles(); String newRelativePath = null; String absolutBasePath = test.getParent(); String absolutPath = test.getAbsolutePath(); String absolutFilePath = null; int copyPathFrom = absolutBasePath.length() + 1; for (int i = 0; i < files.length; i++) { File file = new File(absolutPath + File.separator + (String) files[i]); absolutFilePath = file.getParent(); newRelativePath = relPath + File.separator + absolutFilePath.substring(copyPathFrom); //FIX ME: the override for fileset is by default true, needs to be changed addFile(file, newRelativePath, targetOs, true, list); } } else throw new Exception("\"dir\" attribute of fileset is not valide :" + path); } | protected void addFileSet(String path, String[] includes, String[] excludes, String relPath, String targetOs, ArrayList list, String casesensitive) throws Exception { boolean bCasesensitive = false; File test = new File(path); if (test.isDirectory()) { if (casesensitive != null) bCasesensitive = casesensitive.equalsIgnoreCase("Yes"); DirectoryScanner ds = new DirectoryScanner(); ds.setIncludes(includes); ds.setExcludes(excludes); ds.setBasedir(new File(path)); ds.setCaseSensitive(bCasesensitive); ds.scan(); String[] files = ds.getIncludedFiles(); String newRelativePath = null; String absolutBasePath = test.getParent(); String absolutPath = test.getAbsolutePath(); String absolutFilePath = null; int copyPathFrom = absolutBasePath.length() + 1; for (int i = 0; i < files.length; i++) { File file = new File(absolutPath + File.separator + (String) files[i]); absolutFilePath = file.getParent(); newRelativePath = relPath + File.separator + absolutFilePath.substring(copyPathFrom); //FIX ME: the override for fileset is by default true, needs to be changed addFile(file, newRelativePath, targetOs, true, list); } } else throw new Exception("\"dir\" attribute of fileset is not valid: " + path); } | 3,241,883 |
protected ArrayList getPacks(XMLElement data) throws Exception { // Initialisation ArrayList packs = new ArrayList(); Vector v; 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 { } // 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; else { } // 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; else { } // get arguments for this executable ArrayList argList = null; 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] = (String) 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] = (String) 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(); Vector v; 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 { } // 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; else { } // 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; else { } // get arguments for this executable ArrayList argList = null; 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] = (String) 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] = (String) 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,241,884 |
protected ArrayList getPacks(XMLElement data) throws Exception { // Initialisation ArrayList packs = new ArrayList(); Vector v; 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 { } // 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; else { } // 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; else { } // get arguments for this executable ArrayList argList = null; 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] = (String) 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] = (String) 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(); Vector v; 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 { } // 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; else { } // 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; else { } // get arguments for this executable ArrayList argList = null; 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] = (String) 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] = (String) 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,241,885 |
protected ArrayList getPacks(XMLElement data) throws Exception { // Initialisation ArrayList packs = new ArrayList(); Vector v; 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 { } // 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; else { } // 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; else { } // get arguments for this executable ArrayList argList = null; 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] = (String) 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] = (String) 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(); Vector v; 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 { } // 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; else { } // 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; else { } // get arguments for this executable ArrayList argList = null; 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] = (String) 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] = (String) 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,241,886 |
protected ArrayList getPacks(XMLElement data) throws Exception { // Initialisation ArrayList packs = new ArrayList(); Vector v; 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 { } // 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; else { } // 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; else { } // get arguments for this executable ArrayList argList = null; 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] = (String) 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] = (String) 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(); Vector v; 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 { } // 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; else { } // 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; else { } // get arguments for this executable ArrayList argList = null; 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] = (String) 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] = (String) 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,241,887 |
private void setUniqueUninstallKey() throws Exception { // Let us play a little bit with the regstry again... // Now we search for an unique uninstall key. // First we need a handler. There is no overhead at a // secound call of getInstance, therefore we do not buffer // the handler in this class. RegistryHandler rh = RegistryDefaultHandler.getInstance(); int oldVal = rh.getRoot(); // Only for security... // We know, that the product is already installed, else we // would not in this method. First we get the // "default" uninstall key. String uninstallName = rh.getUninstallName(); int uninstallModifier = 1; while (true) { if (uninstallName == null) break; // Should never be... // Now we define a new uninstall name. String newUninstallName = uninstallName + "(" + Integer.toString(uninstallModifier) + ")"; // Then we "create" the reg key with it. String keyName = RegistryHandler.UNINSTALL_ROOT + newUninstallName; rh.setRoot(RegistryImpl.HKEY_LOCAL_MACHINE); if (!rh.keyExist(keyName)) { // That's the name for which we searched. // Change the uninstall name in the reg helper. rh.setUninstallName(newUninstallName); // Now let us inform the user. emitNotification(parent.langpack .getString("CheckedHelloPanel.infoOverUninstallKey") + newUninstallName); // Now a little hack if the registry spec file contains // the pack "UninstallStuff". idata.setVariable("UNINSTALL_NAME", newUninstallName); break; } uninstallModifier++; } } | private void setUniqueUninstallKey() throws Exception { // Let us play a little bit with the regstry again... // Now we search for an unique uninstall key. // First we need a handler. There is no overhead at a // secound call of getInstance, therefore we do not buffer // the handler in this class. RegistryHandler rh = RegistryDefaultHandler.getInstance(); int oldVal = rh.getRoot(); // Only for security... // We know, that the product is already installed, else we // would not in this method. First we get the // "default" uninstall key. String uninstallName = rh.getUninstallName(); int uninstallModifier = 1; while (true) { if (uninstallName == null) break; // Should never be... // Now we define a new uninstall name. String newUninstallName = uninstallName + "(" + Integer.toString(uninstallModifier) + ")"; // Then we "create" the reg key with it. String keyName = RegistryHandler.UNINSTALL_ROOT + newUninstallName; rh.setRoot(RegistryImpl.HKEY_LOCAL_MACHINE); if (!rh.keyExist(keyName)) { // That's the name for which we searched. // Change the uninstall name in the reg helper. rh.setUninstallName(newUninstallName); // Now let us inform the user. emitNotification(parent.langpack .getString("CheckedHelloPanel.infoOverUninstallKey") + newUninstallName); // Now a little hack if the registry spec file contains // the pack "UninstallStuff". break; } uninstallModifier++; } } | 3,241,889 |
protected void aboutToLaunch(final String message) { String msg = ResourceUtil.getFormattedString("TestRunnerViewPart.message.launching", message); //$NON-NLS-1$// setInfoMessage(msg); firePropertyChange(IWorkbenchPart.PROP_TITLE); } | protectedvoidaboutToLaunch(finalStringmessage){Stringmsg=ResourceUtil.getFormattedString("TestRunnerViewPart.message.launching",message);//$NON-NLS-1$//setInfoMessage(msg);firePropertyChange(IWorkbenchPart.PROP_TITLE);} | 3,241,890 |
private SashForm createSashForm(Composite parent) { m_sashForm = new SashForm(parent, SWT.VERTICAL); ViewForm top = new ViewForm(m_sashForm, SWT.NONE); m_tabFolder = createTestRunTabs(top); m_tabFolder.setLayoutData(new Layout() { protected Point computeSize (Composite composite, int wHint, int hHint, boolean flushCache) { if (wHint != SWT.DEFAULT && hHint != SWT.DEFAULT) return new Point(wHint, hHint); Control [] children = composite.getChildren (); int count = children.length; int maxWidth = 0, maxHeight = 0; for (int i=0; i<count; i++) { Control child = children [i]; Point pt = child.computeSize (SWT.DEFAULT, SWT.DEFAULT, flushCache); maxWidth = Math.max (maxWidth, pt.x); maxHeight = Math.max (maxHeight, pt.y); } if (wHint != SWT.DEFAULT) maxWidth= wHint; if (hHint != SWT.DEFAULT) maxHeight= hHint; return new Point(maxWidth, maxHeight); } protected void layout (Composite composite, boolean flushCache) { Rectangle rect= composite.getClientArea(); Control[] children = composite.getChildren(); for (int i = 0; i < children.length; i++) { children[i].setBounds(rect); } } }); top.setContent(m_tabFolder); ViewForm bottom = new ViewForm(m_sashForm, SWT.NONE); CLabel label = new CLabel(bottom, SWT.NONE); label.setText(ResourceUtil.getString("TestRunnerViewPart.label.failure")); //$NON-NLS-1$ label.setImage(fStackViewIcon); bottom.setTopLeft(label); ToolBar failureToolBar = new ToolBar(bottom, SWT.FLAT | SWT.WRAP); bottom.setTopCenter(failureToolBar); m_failureTraceComponent = new FailureTrace(bottom, this, failureToolBar); bottom.setContent(m_failureTraceComponent.getComposite()); m_sashForm.setWeights(new int[] { 50, 50 }); return m_sashForm; } | private SashForm createSashForm(Composite parent) { m_sashForm = new SashForm(parent, SWT.VERTICAL); ViewForm top = new ViewForm(m_sashForm, SWT.NONE); m_tabFolder = createTestRunTabs(top); m_tabFolder.setLayoutData(new Layout() { protected Point computeSize (Composite composite, int wHint, int hHint, boolean flushCache) { if (wHint != SWT.DEFAULT && hHint != SWT.DEFAULT) return new Point(wHint, hHint); Control [] children = composite.getChildren (); int count = children.length; int maxWidth = 0, maxHeight = 0; for (int i=0; i<count; i++) { Control child = children [i]; Point pt = child.computeSize (SWT.DEFAULT, SWT.DEFAULT, flushCache); maxWidth = Math.max (maxWidth, pt.x); maxHeight = Math.max (maxHeight, pt.y); } if (wHint != SWT.DEFAULT) maxWidth= wHint; if (hHint != SWT.DEFAULT) maxHeight= hHint; return new Point(maxWidth, maxHeight); } protected void layout (Composite composite, boolean flushCache) { Rectangle rect= composite.getClientArea(); Control[] children = composite.getChildren(); for (int i = 0; i < children.length; i++) { children[i].setBounds(rect); } } }); top.setContent(m_tabFolder); ViewForm bottom = new ViewForm(m_sashForm, SWT.NONE); CLabel label = new CLabel(bottom, SWT.NONE); label.setText(ResourceUtil.getString("TestRunnerViewPart.label.failure")); //$NON-NLS-1$ label.setImage(fStackViewIcon); bottom.setTopLeft(label); ToolBar failureToolBar = new ToolBar(bottom, SWT.FLAT | SWT.WRAP); bottom.setTopCenter(failureToolBar); m_failureTraceComponent = new FailureTrace(bottom, this, failureToolBar); bottom.setContent(m_failureTraceComponent.getComposite()); m_sashForm.setWeights(new int[] { 50, 50 }); return m_sashForm; } | 3,241,891 |
private SashForm createSashForm(Composite parent) { m_sashForm = new SashForm(parent, SWT.VERTICAL); ViewForm top = new ViewForm(m_sashForm, SWT.NONE); m_tabFolder = createTestRunTabs(top); m_tabFolder.setLayoutData(new Layout() { protected Point computeSize (Composite composite, int wHint, int hHint, boolean flushCache) { if (wHint != SWT.DEFAULT && hHint != SWT.DEFAULT) return new Point(wHint, hHint); Control [] children = composite.getChildren (); int count = children.length; int maxWidth = 0, maxHeight = 0; for (int i=0; i<count; i++) { Control child = children [i]; Point pt = child.computeSize (SWT.DEFAULT, SWT.DEFAULT, flushCache); maxWidth = Math.max (maxWidth, pt.x); maxHeight = Math.max (maxHeight, pt.y); } if (wHint != SWT.DEFAULT) maxWidth= wHint; if (hHint != SWT.DEFAULT) maxHeight= hHint; return new Point(maxWidth, maxHeight); } protected void layout (Composite composite, boolean flushCache) { Rectangle rect= composite.getClientArea(); Control[] children = composite.getChildren(); for (int i = 0; i < children.length; i++) { children[i].setBounds(rect); } } }); top.setContent(m_tabFolder); ViewForm bottom = new ViewForm(m_sashForm, SWT.NONE); CLabel label = new CLabel(bottom, SWT.NONE); label.setText(ResourceUtil.getString("TestRunnerViewPart.label.failure")); //$NON-NLS-1$ label.setImage(fStackViewIcon); bottom.setTopLeft(label); ToolBar failureToolBar = new ToolBar(bottom, SWT.FLAT | SWT.WRAP); bottom.setTopCenter(failureToolBar); m_failureTraceComponent = new FailureTrace(bottom, this, failureToolBar); bottom.setContent(m_failureTraceComponent.getComposite()); m_sashForm.setWeights(new int[] { 50, 50 }); return m_sashForm; } | privateSashFormcreateSashForm(Compositeparent){m_sashForm=newSashForm(parent,SWT.VERTICAL);ViewFormtop=newViewForm(m_sashForm,SWT.NONE);m_tabFolder=createTestRunTabs(top);m_tabFolder.setLayoutData(newLayout(){protectedPointcomputeSize(Compositecomposite,intwHint,inthHint,booleanflushCache){if(wHint!=SWT.DEFAULT&&hHint!=SWT.DEFAULT)returnnewPoint(wHint,hHint);Control[]children=composite.getChildren();intcount=children.length;intmaxWidth=0,maxHeight=0;for(inti=0;i<count;i++){Controlchild=children[i];Pointpt=child.computeSize(SWT.DEFAULT,SWT.DEFAULT,flushCache);maxWidth=Math.max(maxWidth,pt.x);maxHeight=Math.max(maxHeight,pt.y);}if(wHint!=SWT.DEFAULT)maxWidth=wHint;if(hHint!=SWT.DEFAULT)maxHeight=hHint;returnnewPoint(maxWidth,maxHeight);}protectedvoidlayout(Compositecomposite,booleanflushCache){Rectanglerect=composite.getClientArea();Control[]children=composite.getChildren();for(inti=0;i<children.length;i++){children[i].setBounds(rect);}}});top.setContent(m_tabFolder);ViewFormbottom=newViewForm(m_sashForm,SWT.NONE);CLabellabel=newCLabel(bottom,SWT.NONE);label.setText(ResourceUtil.getString("TestRunnerViewPart.label.failure"));//$NON-NLS-1$label.setImage(fStackViewIcon);bottom.setTopLeft(label);ToolBarfailureToolBar=newToolBar(bottom,SWT.FLAT|SWT.WRAP);bottom.setTopCenter(failureToolBar);m_failureTraceComponent=newFailureTrace(bottom,this,failureToolBar);bottom.setContent(m_failureTraceComponent.getComposite());m_sashForm.setWeights(newint[]{50,50});returnm_sashForm;} | 3,241,892 |
protected Point computeSize (Composite composite, int wHint, int hHint, boolean flushCache) { if (wHint != SWT.DEFAULT && hHint != SWT.DEFAULT) return new Point(wHint, hHint); Control [] children = composite.getChildren (); int count = children.length; int maxWidth = 0, maxHeight = 0; for (int i=0; i<count; i++) { Control child = children [i]; Point pt = child.computeSize (SWT.DEFAULT, SWT.DEFAULT, flushCache); maxWidth = Math.max (maxWidth, pt.x); maxHeight = Math.max (maxHeight, pt.y); } if (wHint != SWT.DEFAULT) maxWidth= wHint; if (hHint != SWT.DEFAULT) maxHeight= hHint; return new Point(maxWidth, maxHeight); } | protected Point computeSize (Composite composite, int wHint, int hHint, boolean flushCache) { if (wHint != SWT.DEFAULT && hHint != SWT.DEFAULT) return new Point(wHint, hHint); Control [] children = composite.getChildren (); int count = children.length; int maxWidth = 0, maxHeight = 0; for (int i=0; i<count; i++) { Control child = children [i]; Point pt = child.computeSize (SWT.DEFAULT, SWT.DEFAULT, flushCache); maxWidth = Math.max (maxWidth, pt.x); maxHeight = Math.max (maxHeight, pt.y); } if (wHint != SWT.DEFAULT) maxWidth= wHint; if (hHint != SWT.DEFAULT) maxHeight= hHint; return new Point(maxWidth, maxHeight); } | 3,241,893 |
protected void layout (Composite composite, boolean flushCache) { Rectangle rect= composite.getClientArea(); Control[] children = composite.getChildren(); for (int i = 0; i < children.length; i++) { children[i].setBounds(rect); } } | protectedvoidlayout(Compositecomposite,booleanflushCache){Rectanglerect=composite.getClientArea();Control[]children=composite.getChildren();for(inti=0;i<children.length;i++){children[i].setBounds(rect);}} | 3,241,894 |
protected CTabFolder createTestRunTabs(Composite parent) { CTabFolder tabFolder = new CTabFolder(parent, SWT.TOP); tabFolder.setLayoutData(new GridData(GridData.FILL_BOTH | GridData.GRAB_VERTICAL)); loadTestRunTabs(tabFolder); tabFolder.setSelection(0); m_activeRunTab = (TestRunTab) m_tabsList.firstElement(); tabFolder.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent event) {// ppp("widgetSelected"); testTabChanged(event); } }); return tabFolder; } | protectedCTabFoldercreateTestRunTabs(Compositeparent){CTabFoldertabFolder=newCTabFolder(parent,SWT.TOP);tabFolder.setLayoutData(newGridData(GridData.FILL_BOTH|GridData.GRAB_VERTICAL));loadTestRunTabs(tabFolder);tabFolder.setSelection(0);m_activeRunTab=(TestRunTab)m_tabsList.firstElement();tabFolder.addSelectionListener(newSelectionAdapter(){publicvoidwidgetSelected(SelectionEventevent){//ppp("widgetSelected");testTabChanged(event);}});returntabFolder;} | 3,241,895 |
public void widgetSelected(SelectionEvent event) {// ppp("widgetSelected"); testTabChanged(event); } | publicvoidwidgetSelected(SelectionEventevent){//ppp("widgetSelected");testTabChanged(event);} | 3,241,896 |
private void handleStopped() { postSyncRunnable(new Runnable() { public void run() { if(isDisposed()) { return; } fProgressBar.stopped();// updateProgressBar(m_progressBar.getMaximum(), false); } }); stopUpdateJobs(); } | privatevoidhandleStopped(){postSyncRunnable(newRunnable(){publicvoidrun(){if(isDisposed()){return;}fProgressBar.stopped();//updateProgressBar(m_progressBar.getMaximum(),false);}});stopUpdateJobs();} | 3,241,897 |
public void run() { if(isDisposed()) { return; } fProgressBar.stopped();// updateProgressBar(m_progressBar.getMaximum(), false); } | publicvoidrun(){if(isDisposed()){return;}fProgressBar.stopped();//updateProgressBar(m_progressBar.getMaximum(),false);} | 3,241,898 |
private void postEndTest(final String testId, final String testName) { postSyncRunnable(new Runnable() { public void run() { if(isDisposed()) { return; } m_testIsRunning = false;// updateProgressBar(m_progressBar.getSelection() + 1, false); if(hasErrors()) { fNextAction.setEnabled(true); fPrevAction.setEnabled(true); } } }); } | privatevoidpostEndTest(finalStringtestId,finalStringtestName){postSyncRunnable(newRunnable(){publicvoidrun(){if(isDisposed()){return;}m_testIsRunning=false;//updateProgressBar(m_progressBar.getSelection()+1,false);if(hasErrors()){fNextAction.setEnabled(true);fPrevAction.setEnabled(true);}}});} | 3,241,899 |
public void run() { if(isDisposed()) { return; } m_testIsRunning = false;// updateProgressBar(m_progressBar.getSelection() + 1, false); if(hasErrors()) { fNextAction.setEnabled(true); fPrevAction.setEnabled(true); } } | publicvoidrun(){if(isDisposed()){return;}m_testIsRunning=false;//updateProgressBar(m_progressBar.getSelection()+1,false);if(hasErrors()){fNextAction.setEnabled(true);fPrevAction.setEnabled(true);}} | 3,241,900 |
private void refreshCounters() {// m_counterPanel.setSuiteCount(m_suiteCount);// m_counterPanel.setTestCount(m_testCount);// m_counterPanel.setMethodTotalCount(m_methodTotalCount); m_counterPanel.setMethodCount(m_methodCount); m_counterPanel.setPassedCount(m_passedCount); m_counterPanel.setFailedCount(m_failedCount); m_counterPanel.setSkippedCount(m_skippedCount); fProgressBar.refresh(hasErrors()); } | private void refreshCounters() {// m_counterPanel.setSuiteCount(m_suiteCount);// m_counterPanel.setTestCount(m_testCount);// m_counterPanel.setMethodTotalCount(m_methodTotalCount); m_counterPanel.setMethodCount(m_methodCount); m_counterPanel.setPassedCount(m_passedCount); m_counterPanel.setFailedCount(m_failedCount); m_counterPanel.setSkippedCount(m_skippedCount); fProgressBar.refresh(hasErrors()); } | 3,241,901 |
public void run() { if(isDisposed()) { return; } m_counterPanel.reset(); m_failureTraceComponent.clear(); fProgressBar.reset(testCount);// m_progressBar.setSelection(0);// m_progressBar.setMaximum(0); clearStatus(); for(Enumeration e = m_tabsList.elements(); e.hasMoreElements();) { TestRunTab v = (TestRunTab) e.nextElement(); v.aboutToStart(); } } | public void run() {if(isDisposed()) {return;}m_counterPanel.reset();m_failureTraceComponent.clear();fProgressBar.reset(testCount);//m_progressBar.setSelection(0);//m_progressBar.setMaximum(0);clearStatus();for(Enumeration e = m_tabsList.elements(); e.hasMoreElements();) {TestRunTab v = (TestRunTab) e.nextElement();v.aboutToStart();}} | 3,241,902 |
private void resetProgressBar(final int total) { fProgressBar.reset(total); fProgressBar.setMaximum(total, total);// m_progressBar.setForeground(fOKColor);// m_progressBar.setMinimum(0);// m_progressBar.setMaximum(total);// m_progressBar.setSelection(0); } | private void resetProgressBar(final int total) { fProgressBar.reset(total); fProgressBar.setMaximum(total, total);// m_progressBar.setForeground(fOKColor);// m_progressBar.setMinimum(0);// m_progressBar.setMaximum(total);// m_progressBar.setSelection(0); } | 3,241,903 |
protected void selectFirstFailure() {// OldTestRunInfo firstFailure = (OldTestRunInfo) fFailures.get(0);// if((firstFailure != null) && (m_activeRunTab.getSelectedTestId() == null)) {// m_activeRunTab.setSelectedTest(firstFailure.getTestId());// handleTestSelected(firstFailure.getTestId());// } } | protected void selectFirstFailure() {// OldTestRunInfo firstFailure = (OldTestRunInfo) fFailures.get(0);// if((firstFailure != null) && (m_activeRunTab.getSelectedTestId() == null)) {// m_activeRunTab.setSelectedTest(firstFailure.getTestId());// handleTestSelected(firstFailure.getTestId());// } } | 3,241,904 |
public void startTestRunListening(IJavaProject project, String subName, int port, ILaunch launch) { m_LastLaunch = launch; m_workingProject = project; m_hasFailures= false; aboutToLaunch(subName); if(null != fTestRunnerClient) { stopTest(); } fTestRunnerClient = new EclipseTestRunnerClient(); fTestRunnerClient.startListening(this, this, port); // setContentDescription(project.getElementName());// setTitleToolTip("TestNG runs " + project.getElementName() + " " + subName); m_rerunAction.setEnabled(true); m_rerunFailedAction.setEnabled(false); } | public void startTestRunListening(IJavaProject project, String subName, int port, ILaunch launch) {m_LastLaunch = launch;m_workingProject = project;m_hasFailures= false;aboutToLaunch(subName);if(null != fTestRunnerClient) {stopTest();}fTestRunnerClient = new EclipseTestRunnerClient();fTestRunnerClient.startListening(this, this, port);//setContentDescription(project.getElementName());//setTitleToolTip("TestNG runs " + project.getElementName() + " " + subName);m_rerunAction.setEnabled(true);m_rerunFailedAction.setEnabled(false);} | 3,241,905 |
public String getDefaultInstallPath (String appName) { String path = null; InputStream input = null; String keyFragment = "/res/" + INSTALL_PATH_RESOURCE_KEY [GENERIC][STANDARD]; // ---------------------------------------------------- // attempt to get an input stream through a resource // based on a key which is specific to the target OS // ---------------------------------------------------- input = getClass ().getResourceAsStream ("/res/" + INSTALL_PATH_RESOURCE_KEY [os][osFlavor]); // ---------------------------------------------------- // attempt to get an input stream through a resource // based on a key which is made specific to the target // OS by using the string returned by // System.getProperty ("os.name").toLowerCase () // ---------------------------------------------------- if (input == null) { String key = osName.replace (' ', '_'); // avoid spaces in file names key = keyFragment + key.toLowerCase (); // for consistency among TargetPanel res files input = getClass ().getResourceAsStream (key); } // ---------------------------------------------------- // attempt to get an input stream through a resource // based on a key which is not specific to any target OS // ---------------------------------------------------- if (input == null) { input = getClass ().getResourceAsStream (keyFragment); } // ---------------------------------------------------- // If we got an input stream try to read the path // from the file // ---------------------------------------------------- if (input != null) { InputStreamReader streamReader = null; BufferedReader reader = null; String line = null; try { streamReader = new InputStreamReader (input); reader = new BufferedReader (streamReader); line = reader.readLine (); while (line != null) { line = line.trim (); if (!line.equals ("")) { break; } line = reader.readLine (); } path = line; } catch (Throwable exception) { } finally { try { reader.close (); } catch (Throwable exception) { } } } // ---------------------------------------------------- // if we were unable to obtain a path from a resource, // use the default for the traget operating system. // ---------------------------------------------------- if ((path == null) || (path.equals (""))) { path = ""; // -------------------------------------------------- // if we run on windows, we need a valid drive letter // to put in front of the path. The drive that // contains the user's home directory is usually the // drive that also contains the install directory, // so this seems the best choice here. // -------------------------------------------------- if (os == WINDOWS) { String home = System.getProperty ("user.home"); // take everything up to and including the first '\' path = home.substring (0, (home.indexOf (File.separatorChar) + 1)); } path = path + INSTALL_PATH_FRAGMENT [os] + appName; } return (path); } | public String getDefaultInstallPath (String appName) { String path = null; InputStream input = null; String keyFragment = "/res/" + INSTALL_PATH_RESOURCE_KEY [GENERIC][STANDARD]; // ---------------------------------------------------- // attempt to get an input stream through a resource // based on a key which is specific to the target OS // ---------------------------------------------------- input = getClass ().getResourceAsStream ("/res/" + INSTALL_PATH_RESOURCE_KEY [os][osFlavor]); // ---------------------------------------------------- // attempt to get an input stream through a resource // based on a key which is made specific to the target // OS by using the string returned by // System.getProperty ("os.name").toLowerCase () // ---------------------------------------------------- if (input == null) { String key = osName.replace (' ', '_'); // avoid spaces in file names key = keyFragment + key.toLowerCase (); // for consistency among TargetPanel res files input = getClass ().getResourceAsStream (key); } // ---------------------------------------------------- // attempt to get an input stream through a resource // based on a key which is not specific to any target OS // ---------------------------------------------------- if (input == null) { input = getClass ().getResourceAsStream (keyFragment); } // ---------------------------------------------------- // If we got an input stream try to read the path // from the file // ---------------------------------------------------- if (input != null) { InputStreamReader streamReader = null; BufferedReader reader = null; String line = null; try { streamReader = new InputStreamReader (input); reader = new BufferedReader (streamReader); line = reader.readLine (); while (line != null) { line = line.trim (); if (!line.equals ("")) { break; } line = reader.readLine (); } path = line; } catch (Throwable exception) { } finally { try { reader.close (); } catch (Throwable exception) { } } } // ---------------------------------------------------- // if we were unable to obtain a path from a resource, // use the default for the traget operating system. // ---------------------------------------------------- if ((path == null) || (path.equals (""))) { path = ""; // -------------------------------------------------- // if we run on windows, we need a valid drive letter // to put in front of the path. The drive that // contains the user's home directory is usually the // drive that also contains the install directory, // so this seems the best choice here. // -------------------------------------------------- if (os == WINDOWS) { String home = System.getProperty ("user.home"); // take everything up to and including the first '\' path = home.substring (0, (home.indexOf (File.separatorChar) + 1)); } path = path + INSTALL_PATH_FRAGMENT [os] + appName; } return (path); } | 3,241,906 |
public String getDefaultInstallPath (String appName) { String path = null; InputStream input = null; String keyFragment = "/res/" + INSTALL_PATH_RESOURCE_KEY [GENERIC][STANDARD]; // ---------------------------------------------------- // attempt to get an input stream through a resource // based on a key which is specific to the target OS // ---------------------------------------------------- input = getClass ().getResourceAsStream ("/res/" + INSTALL_PATH_RESOURCE_KEY [os][osFlavor]); // ---------------------------------------------------- // attempt to get an input stream through a resource // based on a key which is made specific to the target // OS by using the string returned by // System.getProperty ("os.name").toLowerCase () // ---------------------------------------------------- if (input == null) { String key = osName.replace (' ', '_'); // avoid spaces in file names key = keyFragment + key.toLowerCase (); // for consistency among TargetPanel res files input = getClass ().getResourceAsStream (key); } // ---------------------------------------------------- // attempt to get an input stream through a resource // based on a key which is not specific to any target OS // ---------------------------------------------------- if (input == null) { input = getClass ().getResourceAsStream (keyFragment); } // ---------------------------------------------------- // If we got an input stream try to read the path // from the file // ---------------------------------------------------- if (input != null) { InputStreamReader streamReader = null; BufferedReader reader = null; String line = null; try { streamReader = new InputStreamReader (input); reader = new BufferedReader (streamReader); line = reader.readLine (); while (line != null) { line = line.trim (); if (!line.equals ("")) { break; } line = reader.readLine (); } path = line; } catch (Throwable exception) { } finally { try { reader.close (); } catch (Throwable exception) { } } } // ---------------------------------------------------- // if we were unable to obtain a path from a resource, // use the default for the traget operating system. // ---------------------------------------------------- if ((path == null) || (path.equals (""))) { path = ""; // -------------------------------------------------- // if we run on windows, we need a valid drive letter // to put in front of the path. The drive that // contains the user's home directory is usually the // drive that also contains the install directory, // so this seems the best choice here. // -------------------------------------------------- if (os == WINDOWS) { String home = System.getProperty ("user.home"); // take everything up to and including the first '\' path = home.substring (0, (home.indexOf (File.separatorChar) + 1)); } path = path + INSTALL_PATH_FRAGMENT [os] + appName; } return (path); } | public String getDefaultInstallPath (String appName) { String path = null; InputStream input = null; String keyFragment = "/res/" + INSTALL_PATH_RESOURCE_KEY [GENERIC][STANDARD]; // ---------------------------------------------------- // attempt to get an input stream through a resource // based on a key which is specific to the target OS // ---------------------------------------------------- input = getClass ().getResourceAsStream ("/res/" + INSTALL_PATH_RESOURCE_KEY [os][osFlavor]); // ---------------------------------------------------- // attempt to get an input stream through a resource // based on a key which is made specific to the target // OS by using the string returned by // System.getProperty ("os.name").toLowerCase () // ---------------------------------------------------- if (input == null) { String key = osName.replace (' ', '_'); // avoid spaces in file names key = keyFragment + key.toLowerCase (); // for consistency among TargetPanel res files input = getClass ().getResourceAsStream (key); } // ---------------------------------------------------- // attempt to get an input stream through a resource // based on a key which is not specific to any target OS // ---------------------------------------------------- if (input == null) { input = getClass ().getResourceAsStream (keyFragment); } // ---------------------------------------------------- // If we got an input stream try to read the path // from the file // ---------------------------------------------------- if (input != null) { InputStreamReader streamReader = null; BufferedReader reader = null; String line = null; try { streamReader = new InputStreamReader (input); reader = new BufferedReader (streamReader); line = reader.readLine (); while (line != null) { line = line.trim (); if (!line.equals ("")) { break; } line = reader.readLine (); } path = line; } catch (Throwable exception) { } finally { try { reader.close (); } catch (Throwable exception) { } } } // ---------------------------------------------------- // if we were unable to obtain a path from a resource, // use the default for the traget operating system. // ---------------------------------------------------- if ((path == null) || (path.equals (""))) { path = ""; // -------------------------------------------------- // if we run on windows, we need a valid drive letter // to put in front of the path. The drive that // contains the user's home directory is usually the // drive that also contains the install directory, // so this seems the best choice here. // -------------------------------------------------- if (os == WINDOWS) { String home = System.getProperty ("user.home"); // take everything up to and including the first '\' path = home.substring (0, (home.indexOf (File.separatorChar) + 1)); } path = path + INSTALL_PATH_FRAGMENT [os] + appName; } return (path); } | 3,241,907 |
public String getDefaultInstallPath (String appName) { String path = null; InputStream input = null; String keyFragment = "/res/" + INSTALL_PATH_RESOURCE_KEY [GENERIC][STANDARD]; // ---------------------------------------------------- // attempt to get an input stream through a resource // based on a key which is specific to the target OS // ---------------------------------------------------- input = getClass ().getResourceAsStream ("/res/" + INSTALL_PATH_RESOURCE_KEY [os][osFlavor]); // ---------------------------------------------------- // attempt to get an input stream through a resource // based on a key which is made specific to the target // OS by using the string returned by // System.getProperty ("os.name").toLowerCase () // ---------------------------------------------------- if (input == null) { String key = osName.replace (' ', '_'); // avoid spaces in file names key = keyFragment + key.toLowerCase (); // for consistency among TargetPanel res files input = getClass ().getResourceAsStream (key); } // ---------------------------------------------------- // attempt to get an input stream through a resource // based on a key which is not specific to any target OS // ---------------------------------------------------- if (input == null) { input = getClass ().getResourceAsStream (keyFragment); } // ---------------------------------------------------- // If we got an input stream try to read the path // from the file // ---------------------------------------------------- if (input != null) { InputStreamReader streamReader = null; BufferedReader reader = null; String line = null; try { streamReader = new InputStreamReader (input); reader = new BufferedReader (streamReader); line = reader.readLine (); while (line != null) { line = line.trim (); if (!line.equals ("")) { break; } line = reader.readLine (); } path = line; } catch (Throwable exception) { } finally { try { reader.close (); } catch (Throwable exception) { } } } // ---------------------------------------------------- // if we were unable to obtain a path from a resource, // use the default for the traget operating system. // ---------------------------------------------------- if ((path == null) || (path.equals (""))) { path = ""; // -------------------------------------------------- // if we run on windows, we need a valid drive letter // to put in front of the path. The drive that // contains the user's home directory is usually the // drive that also contains the install directory, // so this seems the best choice here. // -------------------------------------------------- if (os == WINDOWS) { String home = System.getProperty ("user.home"); // take everything up to and including the first '\' path = home.substring (0, (home.indexOf (File.separatorChar) + 1)); } path = path + INSTALL_PATH_FRAGMENT [os] + appName; } return (path); } | public String getDefaultInstallPath (String appName) { String path = null; InputStream input = null; String keyFragment = "/res/" + INSTALL_PATH_RESOURCE_KEY [GENERIC][STANDARD]; // ---------------------------------------------------- // attempt to get an input stream through a resource // based on a key which is specific to the target OS // ---------------------------------------------------- input = getClass ().getResourceAsStream ("/res/" + INSTALL_PATH_RESOURCE_KEY [os][osFlavor]); // ---------------------------------------------------- // attempt to get an input stream through a resource // based on a key which is made specific to the target // OS by using the string returned by // System.getProperty ("os.name").toLowerCase () // ---------------------------------------------------- if (input == null) { String key = osName.replace (' ', '_'); // avoid spaces in file names key = keyFragment + key.toLowerCase (); // for consistency among TargetPanel res files input = getClass ().getResourceAsStream (key); } // ---------------------------------------------------- // attempt to get an input stream through a resource // based on a key which is not specific to any target OS // ---------------------------------------------------- if (input == null) { input = getClass ().getResourceAsStream (keyFragment); } // ---------------------------------------------------- // If we got an input stream try to read the path // from the file // ---------------------------------------------------- if (input != null) { InputStreamReader streamReader = null; BufferedReader reader = null; String line = null; try { streamReader = new InputStreamReader (input); reader = new BufferedReader (streamReader); line = reader.readLine (); while (line != null) { line = line.trim (); if (!line.equals ("")) { break; } line = reader.readLine (); } path = line; } catch (Throwable exception) { } finally { try { reader.close (); } catch (Throwable exception) { } } } // ---------------------------------------------------- // if we were unable to obtain a path from a resource, // use the default for the traget operating system. // ---------------------------------------------------- if ((path == null) || (path.equals (""))) { path = ""; // -------------------------------------------------- // if we run on windows, we need a valid drive letter // to put in front of the path. The drive that // contains the user's home directory is usually the // drive that also contains the install directory, // so this seems the best choice here. // -------------------------------------------------- if (os == WINDOWS) { String home = System.getProperty ("user.home"); // take everything up to and including the first '\' path = home.substring (0, (home.indexOf (File.separatorChar) + 1)); } path = path + INSTALL_PATH_FRAGMENT [os] + appName; } return (path); } | 3,241,908 |
public String getDefaultInstallPath (String appName) { String path = null; InputStream input = null; String keyFragment = "/res/" + INSTALL_PATH_RESOURCE_KEY [GENERIC][STANDARD]; // ---------------------------------------------------- // attempt to get an input stream through a resource // based on a key which is specific to the target OS // ---------------------------------------------------- input = getClass ().getResourceAsStream ("/res/" + INSTALL_PATH_RESOURCE_KEY [os][osFlavor]); // ---------------------------------------------------- // attempt to get an input stream through a resource // based on a key which is made specific to the target // OS by using the string returned by // System.getProperty ("os.name").toLowerCase () // ---------------------------------------------------- if (input == null) { String key = osName.replace (' ', '_'); // avoid spaces in file names key = keyFragment + key.toLowerCase (); // for consistency among TargetPanel res files input = getClass ().getResourceAsStream (key); } // ---------------------------------------------------- // attempt to get an input stream through a resource // based on a key which is not specific to any target OS // ---------------------------------------------------- if (input == null) { input = getClass ().getResourceAsStream (keyFragment); } // ---------------------------------------------------- // If we got an input stream try to read the path // from the file // ---------------------------------------------------- if (input != null) { InputStreamReader streamReader = null; BufferedReader reader = null; String line = null; try { streamReader = new InputStreamReader (input); reader = new BufferedReader (streamReader); line = reader.readLine (); while (line != null) { line = line.trim (); if (!line.equals ("")) { break; } line = reader.readLine (); } path = line; } catch (Throwable exception) { } finally { try { reader.close (); } catch (Throwable exception) { } } } // ---------------------------------------------------- // if we were unable to obtain a path from a resource, // use the default for the traget operating system. // ---------------------------------------------------- if ((path == null) || (path.equals (""))) { path = ""; // -------------------------------------------------- // if we run on windows, we need a valid drive letter // to put in front of the path. The drive that // contains the user's home directory is usually the // drive that also contains the install directory, // so this seems the best choice here. // -------------------------------------------------- if (os == WINDOWS) { String home = System.getProperty ("user.home"); // take everything up to and including the first '\' path = home.substring (0, (home.indexOf (File.separatorChar) + 1)); } path = path + INSTALL_PATH_FRAGMENT [os] + appName; } return (path); } | public String getDefaultInstallPath (String appName) { String path = null; InputStream input = null; String keyFragment = "/res/" + INSTALL_PATH_RESOURCE_KEY [GENERIC][STANDARD]; // ---------------------------------------------------- // attempt to get an input stream through a resource // based on a key which is specific to the target OS // ---------------------------------------------------- input = getClass ().getResourceAsStream ("/res/" + INSTALL_PATH_RESOURCE_KEY [os][osFlavor]); // ---------------------------------------------------- // attempt to get an input stream through a resource // based on a key which is made specific to the target // OS by using the string returned by // System.getProperty ("os.name").toLowerCase () // ---------------------------------------------------- if (input == null) { String key = osName.replace (' ', '_'); // avoid spaces in file names key = keyFragment + key.toLowerCase (); // for consistency among TargetPanel res files input = getClass ().getResourceAsStream (key); } // ---------------------------------------------------- // attempt to get an input stream through a resource // based on a key which is not specific to any target OS // ---------------------------------------------------- if (input == null) { input = getClass ().getResourceAsStream (keyFragment); } // ---------------------------------------------------- // If we got an input stream try to read the path // from the file // ---------------------------------------------------- if (input != null) { InputStreamReader streamReader = null; BufferedReader reader = null; String line = null; try { streamReader = new InputStreamReader (input); reader = new BufferedReader (streamReader); line = reader.readLine (); while (line != null) { line = line.trim (); if (!line.equals ("")) { break; } line = reader.readLine (); } path = line; } catch (Throwable exception) { } finally { try { reader.close (); } catch (Throwable exception) { } } } // ---------------------------------------------------- // if we were unable to obtain a path from a resource, // use the default for the traget operating system. // ---------------------------------------------------- if ((path == null) || (path.equals (""))) { path = ""; // -------------------------------------------------- // if we run on windows, we need a valid drive letter // to put in front of the path. The drive that // contains the user's home directory is usually the // drive that also contains the install directory, // so this seems the best choice here. // -------------------------------------------------- if (os == WINDOWS) { String home = System.getProperty ("user.home"); // take everything up to and including the first '\' path = home.substring (0, (home.indexOf (File.separatorChar) + 1)); } path = path + INSTALL_PATH_FRAGMENT [os] + appName; } return (path); } | 3,241,909 |
public String getDefaultInstallPath (String appName) { String path = null; InputStream input = null; String keyFragment = "/res/" + INSTALL_PATH_RESOURCE_KEY [GENERIC][STANDARD]; // ---------------------------------------------------- // attempt to get an input stream through a resource // based on a key which is specific to the target OS // ---------------------------------------------------- input = getClass ().getResourceAsStream ("/res/" + INSTALL_PATH_RESOURCE_KEY [os][osFlavor]); // ---------------------------------------------------- // attempt to get an input stream through a resource // based on a key which is made specific to the target // OS by using the string returned by // System.getProperty ("os.name").toLowerCase () // ---------------------------------------------------- if (input == null) { String key = osName.replace (' ', '_'); // avoid spaces in file names key = keyFragment + key.toLowerCase (); // for consistency among TargetPanel res files input = getClass ().getResourceAsStream (key); } // ---------------------------------------------------- // attempt to get an input stream through a resource // based on a key which is not specific to any target OS // ---------------------------------------------------- if (input == null) { input = getClass ().getResourceAsStream (keyFragment); } // ---------------------------------------------------- // If we got an input stream try to read the path // from the file // ---------------------------------------------------- if (input != null) { InputStreamReader streamReader = null; BufferedReader reader = null; String line = null; try { streamReader = new InputStreamReader (input); reader = new BufferedReader (streamReader); line = reader.readLine (); while (line != null) { line = line.trim (); if (!line.equals ("")) { break; } line = reader.readLine (); } path = line; } catch (Throwable exception) { } finally { try { reader.close (); } catch (Throwable exception) { } } } // ---------------------------------------------------- // if we were unable to obtain a path from a resource, // use the default for the traget operating system. // ---------------------------------------------------- if ((path == null) || (path.equals (""))) { path = ""; // -------------------------------------------------- // if we run on windows, we need a valid drive letter // to put in front of the path. The drive that // contains the user's home directory is usually the // drive that also contains the install directory, // so this seems the best choice here. // -------------------------------------------------- if (os == WINDOWS) { String home = System.getProperty ("user.home"); // take everything up to and including the first '\' path = home.substring (0, (home.indexOf (File.separatorChar) + 1)); } path = path + INSTALL_PATH_FRAGMENT [os] + appName; } return (path); } | public String getDefaultInstallPath (String appName) { String path = null; InputStream input = null; String keyFragment = "/res/" + INSTALL_PATH_RESOURCE_KEY [GENERIC][STANDARD]; // ---------------------------------------------------- // attempt to get an input stream through a resource // based on a key which is specific to the target OS // ---------------------------------------------------- input = getClass ().getResourceAsStream ("/res/" + INSTALL_PATH_RESOURCE_KEY [os][osFlavor]); // ---------------------------------------------------- // attempt to get an input stream through a resource // based on a key which is made specific to the target // OS by using the string returned by // System.getProperty ("os.name").toLowerCase () // ---------------------------------------------------- if (input == null) { String key = osName.replace (' ', '_'); // avoid spaces in file names key = keyFragment + key.toLowerCase (); // for consistency among TargetPanel res files input = getClass ().getResourceAsStream (key); } // ---------------------------------------------------- // attempt to get an input stream through a resource // based on a key which is not specific to any target OS // ---------------------------------------------------- if (input == null) { input = getClass ().getResourceAsStream (keyFragment); } // ---------------------------------------------------- // If we got an input stream try to read the path // from the file // ---------------------------------------------------- if (input != null) { InputStreamReader streamReader = null; BufferedReader reader = null; String line = null; try { streamReader = new InputStreamReader (input); reader = new BufferedReader (streamReader); line = reader.readLine (); while (line != null) { line = line.trim (); if (!line.equals ("")) { break; } line = reader.readLine (); } path = line; } catch (Throwable exception) { } finally { try { reader.close (); } catch (Throwable exception) { } } } // ---------------------------------------------------- // if we were unable to obtain a path from a resource, // use the default for the traget operating system. // ---------------------------------------------------- if ((path == null) || (path.equals (""))) { path = ""; // -------------------------------------------------- // if we run on windows, we need a valid drive letter // to put in front of the path. The drive that // contains the user's home directory is usually the // drive that also contains the install directory, // so this seems the best choice here. // -------------------------------------------------- if (os == WINDOWS) { String home = System.getProperty ("user.home"); // take everything up to and including the first '\' path = home.substring (0, (home.indexOf (File.separatorChar) + 1)); } path = path + INSTALL_PATH_FRAGMENT [os] + appName; } return (path); } | 3,241,910 |
public String getDefaultInstallPath (String appName) { String path = null; InputStream input = null; String keyFragment = "/res/" + INSTALL_PATH_RESOURCE_KEY [GENERIC][STANDARD]; // ---------------------------------------------------- // attempt to get an input stream through a resource // based on a key which is specific to the target OS // ---------------------------------------------------- input = getClass ().getResourceAsStream ("/res/" + INSTALL_PATH_RESOURCE_KEY [os][osFlavor]); // ---------------------------------------------------- // attempt to get an input stream through a resource // based on a key which is made specific to the target // OS by using the string returned by // System.getProperty ("os.name").toLowerCase () // ---------------------------------------------------- if (input == null) { String key = osName.replace (' ', '_'); // avoid spaces in file names key = keyFragment + key.toLowerCase (); // for consistency among TargetPanel res files input = getClass ().getResourceAsStream (key); } // ---------------------------------------------------- // attempt to get an input stream through a resource // based on a key which is not specific to any target OS // ---------------------------------------------------- if (input == null) { input = getClass ().getResourceAsStream (keyFragment); } // ---------------------------------------------------- // If we got an input stream try to read the path // from the file // ---------------------------------------------------- if (input != null) { InputStreamReader streamReader = null; BufferedReader reader = null; String line = null; try { streamReader = new InputStreamReader (input); reader = new BufferedReader (streamReader); line = reader.readLine (); while (line != null) { line = line.trim (); if (!line.equals ("")) { break; } line = reader.readLine (); } path = line; } catch (Throwable exception) { } finally { try { reader.close (); } catch (Throwable exception) { } } } // ---------------------------------------------------- // if we were unable to obtain a path from a resource, // use the default for the traget operating system. // ---------------------------------------------------- if ((path == null) || (path.equals (""))) { path = ""; // -------------------------------------------------- // if we run on windows, we need a valid drive letter // to put in front of the path. The drive that // contains the user's home directory is usually the // drive that also contains the install directory, // so this seems the best choice here. // -------------------------------------------------- if (os == WINDOWS) { String home = System.getProperty ("user.home"); // take everything up to and including the first '\' path = home.substring (0, (home.indexOf (File.separatorChar) + 1)); } path = path + INSTALL_PATH_FRAGMENT [os] + appName; } return (path); } | public String getDefaultInstallPath (String appName) { String path = null; InputStream input = null; String keyFragment = "/res/" + INSTALL_PATH_RESOURCE_KEY [GENERIC][STANDARD]; // ---------------------------------------------------- // attempt to get an input stream through a resource // based on a key which is specific to the target OS // ---------------------------------------------------- input = getClass ().getResourceAsStream ("/res/" + INSTALL_PATH_RESOURCE_KEY [os][osFlavor]); // ---------------------------------------------------- // attempt to get an input stream through a resource // based on a key which is made specific to the target // OS by using the string returned by // System.getProperty ("os.name").toLowerCase () // ---------------------------------------------------- if (input == null) { String key = osName.replace (' ', '_'); // avoid spaces in file names key = keyFragment + key.toLowerCase (); // for consistency among TargetPanel res files input = getClass ().getResourceAsStream (key); } // ---------------------------------------------------- // attempt to get an input stream through a resource // based on a key which is not specific to any target OS // ---------------------------------------------------- if (input == null) { input = getClass ().getResourceAsStream (keyFragment); } // ---------------------------------------------------- // If we got an input stream try to read the path // from the file // ---------------------------------------------------- if (input != null) { InputStreamReader streamReader = null; BufferedReader reader = null; String line = null; try { streamReader = new InputStreamReader (input); reader = new BufferedReader (streamReader); line = reader.readLine (); while (line != null) { line = line.trim (); if (!line.equals ("")) { break; } line = reader.readLine (); } path = line; } catch (Throwable exception) { } finally { try { reader.close (); } catch (Throwable exception) { } } } // ---------------------------------------------------- // if we were unable to obtain a path from a resource, // use the default for the traget operating system. // ---------------------------------------------------- if ((path == null) || (path.equals (""))) { path = ""; // -------------------------------------------------- // if we run on windows, we need a valid drive letter // to put in front of the path. The drive that // contains the user's home directory is usually the // drive that also contains the install directory, // so this seems the best choice here. // -------------------------------------------------- if (os == WINDOWS) { String home = System.getProperty ("user.home"); // take everything up to and including the first '\' path = home.substring (0, (home.indexOf (File.separatorChar) + 1)); } path = path + INSTALL_PATH_FRAGMENT [os] + appName; } return (path); } | 3,241,911 |
private void readFiles() { File file = new File( _graphmlFileName ); if ( file.isFile() ) { _graph = parseFile( _graphmlFileName ); } else if ( file.isDirectory() ) { // Only accpets files which suffix is .graphml FilenameFilter filter = new FilenameFilter() { public boolean accept( File dir, String name ) { return name.endsWith( ".graphml" ); } }; File [] allChildren = file.listFiles( filter ); for ( int i = 0; i < allChildren.length; ++i ) { _graphList.add( parseFile( allChildren[ i ].getAbsolutePath() ) ); } analyseSubGraphs(); } else { throw new RuntimeException( "\"" + _graphmlFileName + "\" is not a file or a directory. Please specify a valid .graphml file or a directory containing .graphml files" ); } } | private void readFiles() { File file = new File( _graphmlFileName ); if ( file.isFile() ) { _graph = parseFile( _graphmlFileName ); } else if ( file.isDirectory() ) { // Only accpets files which suffix is .graphml FilenameFilter filter = new FilenameFilter() { public boolean accept( File dir, String name ) { return name.endsWith( ".graphml" ); } }; File [] allChildren = file.listFiles( filter ); for ( int i = 0; i < allChildren.length; ++i ) { _graphList.add( parseFile( allChildren[ i ].getAbsolutePath() ) ); } analyseSubGraphs(); } else { throw new RuntimeException( "\"" + _graphmlFileName + "\" is not a file or a directory. Please specify a valid .graphml file or a directory containing .graphml files" ); } } | 3,241,912 |
private void readFiles() { File file = new File( _graphmlFileName ); if ( file.isFile() ) { _graph = parseFile( _graphmlFileName ); } else if ( file.isDirectory() ) { // Only accpets files which suffix is .graphml FilenameFilter filter = new FilenameFilter() { public boolean accept( File dir, String name ) { return name.endsWith( ".graphml" ); } }; File [] allChildren = file.listFiles( filter ); for ( int i = 0; i < allChildren.length; ++i ) { _graphList.add( parseFile( allChildren[ i ].getAbsolutePath() ) ); } analyseSubGraphs(); } else { throw new RuntimeException( "\"" + _graphmlFileName + "\" is not a file or a directory. Please specify a valid .graphml file or a directory containing .graphml files" ); } } | privatevoidreadFiles() { Filefile=newFile(_graphmlFileName); if(file.isFile()) { _graph=parseFile(_graphmlFileName); } elseif(file.isDirectory()) { //Onlyaccpetsfileswhichsuffixis.graphml FilenameFilterfilter=newFilenameFilter() { publicbooleanaccept(Filedir,Stringname) { returnname.endsWith(".graphml"); } }; File[]allChildren=file.listFiles(filter); for(inti=0;i<allChildren.length;++i) { _graphList.add(parseFile(allChildren[i].getAbsolutePath())); } analyseSubGraphs(); } else { thrownewRuntimeException("\""+_graphmlFileName+"\"isnotafileoradirectory.Pleasespecifyavalid.graphmlfileoradirectorycontaining.graphmlfiles"); } } | 3,241,913 |
private void readFiles() { File file = new File( _graphmlFileName ); if ( file.isFile() ) { _graph = parseFile( _graphmlFileName ); } else if ( file.isDirectory() ) { // Only accpets files which suffix is .graphml FilenameFilter filter = new FilenameFilter() { public boolean accept( File dir, String name ) { return name.endsWith( ".graphml" ); } }; File [] allChildren = file.listFiles( filter ); for ( int i = 0; i < allChildren.length; ++i ) { _graphList.add( parseFile( allChildren[ i ].getAbsolutePath() ) ); } analyseSubGraphs(); } else { throw new RuntimeException( "\"" + _graphmlFileName + "\" is not a file or a directory. Please specify a valid .graphml file or a directory containing .graphml files" ); } } | private void readFiles() { File file = new File( _graphmlFileName ); if ( file.isFile() ) { _graph = parseFile( _graphmlFileName ); } else if ( file.isDirectory() ) { // Only accpets files which suffix is .graphml FilenameFilter filter = new FilenameFilter() { public boolean accept( File dir, String name ) { return name.endsWith( ".graphml" ); } }; File [] allChildren = file.listFiles( filter ); for ( int i = 0; i < allChildren.length; ++i ) { _graphList.add( parseFile( allChildren[ i ].getAbsolutePath() ) ); } analyseSubGraphs(); } else { throw new RuntimeException( "\"" + _graphmlFileName + "\" is not a file or a directory. Please specify a valid .graphml file or a directory containing .graphml files" ); } } | 3,241,914 |
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 = new JLabel(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 = new JLabel(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); label = new JLabel(" - " + a.getName() + " <" + a.getEmail() + ">", parent.icons.getImageIcon("empty"), JLabel.TRAILING); centerPanel.add(label); } centerPanel.add(Box.createVerticalStrut(20)); } str = parent.langpack.getString("HelloPanel.url") + idata.info.getAppURL(); appURLLabel = new JLabel(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 = new JLabel(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 = new JLabel(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); label = new JLabel(" - " + a.getName() + " <" + a.getEmail() + ">", parent.icons.getImageIcon("empty"), JLabel.TRAILING); centerPanel.add(label); } centerPanel.add(Box.createVerticalStrut(20)); } str = parent.langpack.getString("HelloPanel.url") + idata.info.getAppURL(); appURLLabel = new JLabel(str, parent.icons.getImageIcon("bookmark"), JLabel.TRAILING); centerPanel.add(appURLLabel); } | 3,241,916 |
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 = new JLabel(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 = new JLabel(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); label = new JLabel(" - " + a.getName() + " <" + a.getEmail() + ">", parent.icons.getImageIcon("empty"), JLabel.TRAILING); centerPanel.add(label); } centerPanel.add(Box.createVerticalStrut(20)); } str = parent.langpack.getString("HelloPanel.url") + idata.info.getAppURL(); appURLLabel = new JLabel(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 = new JLabel(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 = new JLabel(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); label = new JLabel(" - " + a.getName() + " <" + a.getEmail() + ">", parent.icons.getImageIcon("empty"), JLabel.TRAILING); centerPanel.add(label); } centerPanel.add(Box.createVerticalStrut(20)); } str = parent.langpack.getString("HelloPanel.url") + idata.info.getAppURL(); appURLLabel = new JLabel(str, parent.icons.getImageIcon("bookmark"), JLabel.TRAILING); centerPanel.add(appURLLabel); } | 3,241,917 |
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()) objIn.skip(pf.length()); continue; } } // We copy the file out = new FileOutputStream(pathFile); byte[] buffer = new byte[5120]; long bytesCopied = 0; ObjectInputStream 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) } while (bytesCopied < pf.length()) { int maxBytes = (pf.length() - bytesCopied < buffer.length ? (int) (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; ObjectInputStream 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) } while (bytesCopied < pf.length()) { int maxBytes = (pf.length() - bytesCopied < buffer.length ? (int) (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() && !((Pack)packs.get(i)).loose) 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,241,918 |
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()) objIn.skip(pf.length()); continue; } } // We copy the file out = new FileOutputStream(pathFile); byte[] buffer = new byte[5120]; long bytesCopied = 0; ObjectInputStream 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) } while (bytesCopied < pf.length()) { int maxBytes = (pf.length() - bytesCopied < buffer.length ? (int) (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()) 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) } while (bytesCopied < pf.length()) { int maxBytes = (pf.length() - bytesCopied < buffer.length ? (int) (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,241,919 |
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()) objIn.skip(pf.length()); continue; } } // We copy the file out = new FileOutputStream(pathFile); byte[] buffer = new byte[5120]; long bytesCopied = 0; ObjectInputStream 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) } while (bytesCopied < pf.length()) { int maxBytes = (pf.length() - bytesCopied < buffer.length ? (int) (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()) objIn.skip(pf.length()); continue; } } // We copy the file out = new FileOutputStream(pathFile); byte[] buffer = new byte[5120]; long bytesCopied = 0; ObjectInputStream 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) } while (bytesCopied < pf.length()) { int maxBytes = (pf.length() - bytesCopied < buffer.length ? (int) (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,241,920 |
public Component getListCellRendererComponent( JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { // We avoid that the icon is gray while the combo isn't deployed if (index == -1) isSelected = true; // We put the label String iso3 = (String) value; setText(iso3); if (isSelected) { if (lnf.equalsIgnoreCase("swing")) setOpaque(true); else if (index == -1) setOpaque(false); else setOpaque(true); setForeground(list.getSelectionForeground()); setBackground(list.getSelectionBackground()); } else setOpaque(false); // We put the icon if (!icons.containsKey(iso3)) { ImageIcon icon = new ImageIcon(this.getClass().getResource("/res/flag." + iso3)); icons.put(iso3, icon); grayIcons.put( iso3, new ImageIcon(GrayFilter.createDisabledImage(icon.getImage()))); } if (isSelected) setIcon((ImageIcon) icons.get(iso3)); else setIcon((ImageIcon) grayIcons.get(iso3)); // We return return this; } | public Component getListCellRendererComponent( JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { // We avoid that the icon is gray while the combo isn't deployed if (index == -1) isSelected = true; // We put the label String iso3 = (String) value; setText(iso3); if (isSelected) { if (lnf.equalsIgnoreCase("swing")) setOpaque(true); else if (index == -1) setOpaque(false); else setOpaque(true); setForeground(list.getSelectionForeground()); setBackground(list.getSelectionBackground()); } else { setOpaque(false); // We put the icon if (!icons.containsKey(iso3)) { ImageIcon icon = new ImageIcon(this.getClass().getResource("/res/flag." + iso3)); icons.put(iso3, icon); grayIcons.put( iso3, new ImageIcon(GrayFilter.createDisabledImage(icon.getImage()))); } if (isSelected) setIcon((ImageIcon) icons.get(iso3)); else setIcon((ImageIcon) grayIcons.get(iso3)); // We return return this; } | 3,241,921 |
public Component getListCellRendererComponent( JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { // We avoid that the icon is gray while the combo isn't deployed if (index == -1) isSelected = true; // We put the label String iso3 = (String) value; setText(iso3); if (isSelected) { if (lnf.equalsIgnoreCase("swing")) setOpaque(true); else if (index == -1) setOpaque(false); else setOpaque(true); setForeground(list.getSelectionForeground()); setBackground(list.getSelectionBackground()); } else setOpaque(false); // We put the icon if (!icons.containsKey(iso3)) { ImageIcon icon = new ImageIcon(this.getClass().getResource("/res/flag." + iso3)); icons.put(iso3, icon); grayIcons.put( iso3, new ImageIcon(GrayFilter.createDisabledImage(icon.getImage()))); } if (isSelected) setIcon((ImageIcon) icons.get(iso3)); else setIcon((ImageIcon) grayIcons.get(iso3)); // We return return this; } | setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } publicsetForeground(list.getForeground()); setBackground(list.getBackground()); } ComponentsetForeground(list.getForeground()); setBackground(list.getBackground()); } getListCellRendererComponent(setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } JListsetForeground(list.getForeground()); setBackground(list.getBackground()); } list,setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } ObjectsetForeground(list.getForeground()); setBackground(list.getBackground()); } value,setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } intsetForeground(list.getForeground()); setBackground(list.getBackground()); } index,setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } booleansetForeground(list.getForeground()); setBackground(list.getBackground()); } isSelected,setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } booleansetForeground(list.getForeground()); setBackground(list.getBackground()); } cellHasFocus)setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } {setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } //setForeground(list.getForeground()); setBackground(list.getBackground()); } WesetForeground(list.getForeground()); setBackground(list.getBackground()); } avoidsetForeground(list.getForeground()); setBackground(list.getBackground()); } thatsetForeground(list.getForeground()); setBackground(list.getBackground()); } thesetForeground(list.getForeground()); setBackground(list.getBackground()); } iconsetForeground(list.getForeground()); setBackground(list.getBackground()); } issetForeground(list.getForeground()); setBackground(list.getBackground()); } graysetForeground(list.getForeground()); setBackground(list.getBackground()); } whilesetForeground(list.getForeground()); setBackground(list.getBackground()); } thesetForeground(list.getForeground()); setBackground(list.getBackground()); } combosetForeground(list.getForeground()); setBackground(list.getBackground()); } isn'tsetForeground(list.getForeground()); setBackground(list.getBackground()); } deployedsetForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } ifsetForeground(list.getForeground()); setBackground(list.getBackground()); } (indexsetForeground(list.getForeground()); setBackground(list.getBackground()); } ==setForeground(list.getForeground()); setBackground(list.getBackground()); } -1)setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } isSelectedsetForeground(list.getForeground()); setBackground(list.getBackground()); } =setForeground(list.getForeground()); setBackground(list.getBackground()); } true;setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } //setForeground(list.getForeground()); setBackground(list.getBackground()); } WesetForeground(list.getForeground()); setBackground(list.getBackground()); } putsetForeground(list.getForeground()); setBackground(list.getBackground()); } thesetForeground(list.getForeground()); setBackground(list.getBackground()); } labelsetForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } StringsetForeground(list.getForeground()); setBackground(list.getBackground()); } iso3setForeground(list.getForeground()); setBackground(list.getBackground()); } =setForeground(list.getForeground()); setBackground(list.getBackground()); } (String)setForeground(list.getForeground()); setBackground(list.getBackground()); } value;setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setText(iso3);setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } ifsetForeground(list.getForeground()); setBackground(list.getBackground()); } (isSelected)setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } {setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } ifsetForeground(list.getForeground()); setBackground(list.getBackground()); } (lnf.equalsIgnoreCase("swing"))setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setOpaque(true);setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } elsesetForeground(list.getForeground()); setBackground(list.getBackground()); } ifsetForeground(list.getForeground()); setBackground(list.getBackground()); } (indexsetForeground(list.getForeground()); setBackground(list.getBackground()); } ==setForeground(list.getForeground()); setBackground(list.getBackground()); } -1)setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setOpaque(false);setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } elsesetForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setOpaque(true);setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getSelectionForeground());setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setBackground(list.getSelectionBackground());setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } }setForeground(list.getForeground()); setBackground(list.getBackground()); } elsesetForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setOpaque(false);setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } //setForeground(list.getForeground()); setBackground(list.getBackground()); } WesetForeground(list.getForeground()); setBackground(list.getBackground()); } putsetForeground(list.getForeground()); setBackground(list.getBackground()); } thesetForeground(list.getForeground()); setBackground(list.getBackground()); } iconsetForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } ifsetForeground(list.getForeground()); setBackground(list.getBackground()); } (!icons.containsKey(iso3))setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } {setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } ImageIconsetForeground(list.getForeground()); setBackground(list.getBackground()); } iconsetForeground(list.getForeground()); setBackground(list.getBackground()); } =setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } newsetForeground(list.getForeground()); setBackground(list.getBackground()); } ImageIcon(this.getClass().getResource("/res/flag."setForeground(list.getForeground()); setBackground(list.getBackground()); } +setForeground(list.getForeground()); setBackground(list.getBackground()); } iso3));setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } icons.put(iso3,setForeground(list.getForeground()); setBackground(list.getBackground()); } icon);setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } grayIcons.put(setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } iso3,setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } newsetForeground(list.getForeground()); setBackground(list.getBackground()); } ImageIcon(GrayFilter.createDisabledImage(icon.getImage())));setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } }setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } ifsetForeground(list.getForeground()); setBackground(list.getBackground()); } (isSelected)setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setIcon((ImageIcon)setForeground(list.getForeground()); setBackground(list.getBackground()); } icons.get(iso3));setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } elsesetForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setIcon((ImageIcon)setForeground(list.getForeground()); setBackground(list.getBackground()); } grayIcons.get(iso3));setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } //setForeground(list.getForeground()); setBackground(list.getBackground()); } WesetForeground(list.getForeground()); setBackground(list.getBackground()); } returnsetForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } returnsetForeground(list.getForeground()); setBackground(list.getBackground()); } this;setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } setForeground(list.getForeground()); setBackground(list.getBackground()); } } | 3,241,922 |
public Component getListCellRendererComponent( JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { // We avoid that the icon is gray while the combo isn't deployed if (index == -1) isSelected = true; // We put the label String iso3 = (String) value; setText(iso3); if (isSelected) { if (lnf.equalsIgnoreCase("swing")) setOpaque(true); else if (index == -1) setOpaque(false); else setOpaque(true); setForeground(list.getSelectionForeground()); setBackground(list.getSelectionBackground()); } else setOpaque(false); // We put the icon if (!icons.containsKey(iso3)) { ImageIcon icon = new ImageIcon(this.getClass().getResource("/res/flag." + iso3)); icons.put(iso3, icon); grayIcons.put( iso3, new ImageIcon(GrayFilter.createDisabledImage(icon.getImage()))); } if (isSelected) setIcon((ImageIcon) icons.get(iso3)); else setIcon((ImageIcon) grayIcons.get(iso3)); // We return return this; } | public Component getListCellRendererComponent( JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { // We avoid that the icon is gray while the combo isn't deployed if (index == -1) isSelected = true; // We put the label String iso3 = (String) value; setText(iso3); if (isSelected) { if (lnf.equalsIgnoreCase("swing")) setOpaque(true); else if (index == -1) setOpaque(false); else setOpaque(true); setForeground(list.getSelectionForeground()); setBackground(list.getSelectionBackground()); } else setOpaque(false); // We put the icon if (!icons.containsKey(iso3)) { ImageIcon icon = new ImageIcon(this.getClass().getResource("/res/flag." + iso3)); icons.put(iso3, icon); grayIcons.put( iso3, new ImageIcon(GrayFilter.createDisabledImage(icon.getImage()))); } if (isSelected) setIcon((ImageIcon) icons.get(iso3)); else setIcon((ImageIcon) grayIcons.get(iso3)); // We return return this; } | 3,241,923 |
public Component getListCellRendererComponent( JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { // We avoid that the icon is gray while the combo isn't deployed if (index == -1) isSelected = true; // We put the label String iso3 = (String) value; setText(iso3); if (isSelected) { if (lnf.equalsIgnoreCase("swing")) setOpaque(true); else if (index == -1) setOpaque(false); else setOpaque(true); setForeground(list.getSelectionForeground()); setBackground(list.getSelectionBackground()); } else setOpaque(false); // We put the icon if (!icons.containsKey(iso3)) { ImageIcon icon = new ImageIcon(this.getClass().getResource("/res/flag." + iso3)); icons.put(iso3, icon); grayIcons.put( iso3, new ImageIcon(GrayFilter.createDisabledImage(icon.getImage()))); } if (isSelected) setIcon((ImageIcon) icons.get(iso3)); else setIcon((ImageIcon) grayIcons.get(iso3)); // We return return this; } | public Component getListCellRendererComponent( JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { // We avoid that the icon is gray while the combo isn't deployed if (index == -1) isSelected = true; // We put the label String iso3 = (String) value; setText(iso3); if (isSelected) { if (lnf.equalsIgnoreCase("swing")) setOpaque(true); else if (index == -1) setOpaque(false); else setOpaque(true); setForeground(list.getSelectionForeground()); setBackground(list.getSelectionBackground()); } else setOpaque(false); // We put the icon if (!icons.containsKey(iso3)) { ImageIcon icon = new ImageIcon(this.getClass().getResource("/res/flag." + iso3)); icons.put(iso3, icon); grayIcons.put( iso3, new ImageIcon(GrayFilter.createDisabledImage(icon.getImage()))); } if (isSelected) setIcon((ImageIcon) icons.get(iso3)); else setIcon((ImageIcon) grayIcons.get(iso3)); // We return return this; } | 3,241,924 |
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 // TODO: this could be improved by only removing the oldest object if ((_maxTotal > 0) && (_totalActive + _totalIdle >= _maxTotal)) { clear(); } // 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; } } } | publicsynchronizedObjectborrowObject(Objectkey)throwsException{longstarttime=System.currentTimeMillis();booleannewlyCreated=false;for(;;){CursorableLinkedListpool=(CursorableLinkedList)(_poolMap.get(key));if(null==pool){pool=newCursorableLinkedList();_poolMap.put(key,pool);_poolList.add(key);}ObjectTimestampPairpair=null;//ifthereareanysleeping,justgraboneofthosetry{pair=(ObjectTimestampPair)(pool.removeFirst());if(null!=pair){_totalIdle--;}}catch(NoSuchElementExceptione){/*ignored*/}//otherwiseif(null==pair){//ifthereisatotalMaxActiveandweareatthelimitthen//wehavetomakeroom//TODO:thiscouldbeimprovedbyonlyremovingtheoldestobjectif((_maxTotal>0)&&(_totalActive+_totalIdle>=_maxTotal)){clear();}//checkifwecancreateone//(noteweknowthatthenumsleepingis0,elsewewouldn'tbehere)intactive=getActiveCount(key);if((_maxActive<=0||active<_maxActive)&&(_maxTotal<=0||_totalActive+_totalIdle<_maxTotal)){Objectobj=_factory.makeObject(key);pair=newObjectTimestampPair(obj);newlyCreated=true;}else{//thepoolisexhaustedswitch(_whenExhaustedAction){caseWHEN_EXHAUSTED_GROW:Objectobj=_factory.makeObject(key);pair=newObjectTimestampPair(obj);break;caseWHEN_EXHAUSTED_FAIL:thrownewNoSuchElementException();caseWHEN_EXHAUSTED_BLOCK:try{if(_maxWait<=0){wait();}else{wait(_maxWait);}}catch(InterruptedExceptione){//ignored}if(_maxWait>0&&((System.currentTimeMillis()-starttime)>=_maxWait)){thrownewNoSuchElementException("Timeoutwaitingforidleobject");}else{continue;//keeplooping}default:thrownewIllegalArgumentException("whenExhaustedAction"+_whenExhaustedAction+"notrecognized.");}}}_factory.activateObject(key,pair.value);if(_testOnBorrow&&!_factory.validateObject(key,pair.value)){_factory.destroyObject(key,pair.value);if(newlyCreated){thrownewNoSuchElementException("Couldnotcreateavalidatedobject");}//elsekeeplooping}else{incrementActiveCount(key);returnpair.value;}}} | 3,241,925 |
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 // TODO: this could be improved by only removing the oldest object if ((_maxTotal > 0) && (_totalActive + _totalIdle >= _maxTotal)) { clear(); } // 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 // TODO: this could be improved by only removing the oldest object 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,241,926 |
public Object clone () throws OutOfMemoryError { try { super.clone(); } catch (CloneNotSupportedException e) { e.printStackTrace(); } ShortcutData result = new ShortcutData (); result.type = type; result.iconIndex = iconIndex; result.initialState = initialState; result.addToGroup = addToGroup; result.name = cloneString (name); result.description = cloneString (description); result.target = cloneString (target); result.commandLine = cloneString (commandLine); result.subgroup = cloneString (subgroup); result.iconFile = cloneString (iconFile); result.workingDirectory = cloneString (workingDirectory); return (result); } | public Object clone () throws OutOfMemoryError { try { super.clone(); } catch (CloneNotSupportedException e) { e.printStackTrace(); } ShortcutData result = new ShortcutData (); result.type = type; result.iconIndex = iconIndex; result.initialState = initialState; result.addToGroup = addToGroup; result.name = cloneString (name); result.description = cloneString (description); result.target = cloneString (target); result.commandLine = cloneString (commandLine); result.subgroup = cloneString (subgroup); result.iconFile = cloneString (iconFile); result.workingDirectory = cloneString (workingDirectory); return (result); } | 3,241,927 |
public boolean validateObject(Object obj) { return true; } | public boolean validateObject(Object obj) { return true; } | 3,241,928 |
public String getLinkPath(int userType) { String result = null; if (userType == CURRENT_USER) { try { result = new String( currentUserLinkPath, "UTF-16" ); } catch (UnsupportedEncodingException e) { // TODO Auto-generated catch block e.printStackTrace(); } } else { try { result = new String(allUsersLinkPath, "UTF-16"); } catch (UnsupportedEncodingException e) { // TODO Auto-generated catch block e.printStackTrace(); } } return result; } | public String getLinkPath(int userType) { String result = null; if (userType == CURRENT_USER) { try { result = new String( currentUserLinkPath, "UTF-16" ); } catch (UnsupportedEncodingException e) { // TODO Auto-generated catch block e.printStackTrace(); } } else { try { result = new String(allUsersLinkPath, "UTF-16"); } catch (UnsupportedEncodingException e) { // TODO Auto-generated catch block e.printStackTrace(); } } return result; } | 3,241,929 |
public String getLinkPath(int userType) { String result = null; if (userType == CURRENT_USER) { try { result = new String( currentUserLinkPath, "UTF-16" ); } catch (UnsupportedEncodingException e) { // TODO Auto-generated catch block e.printStackTrace(); } } else { try { result = new String(allUsersLinkPath, "UTF-16"); } catch (UnsupportedEncodingException e) { // TODO Auto-generated catch block e.printStackTrace(); } } return result; } | public String getLinkPath(int userType) { String result = null; if (userType == CURRENT_USER) { try { result = new String( currentUserLinkPath, "UTF-16" ); } catch (UnsupportedEncodingException e) { // TODO Auto-generated catch block e.printStackTrace(); } } else { try { result = new String(allUsersLinkPath, "UTF-16"); } catch (UnsupportedEncodingException e) { // TODO Auto-generated catch block e.printStackTrace(); } } return result; } | 3,241,930 |
public String getallUsersLinkPath() { String result = null; try { result = new String(allUsersLinkPath, "UTF-16"); } catch (UnsupportedEncodingException e) { // TODO Auto-generated catch block e.printStackTrace(); } return result; } | public String getallUsersLinkPath() { String result = null; try { result = new String(allUsersLinkPath, "UTF-16"); } catch (UnsupportedEncodingException e) { // TODO Auto-generated catch block e.printStackTrace(); } return result; } | 3,241,931 |
public String getcurrentUserLinkPath() { String result =null; try { result = new String( currentUserLinkPath, "UTF-16"); } catch (UnsupportedEncodingException e) { // TODO Auto-generated catch block e.printStackTrace(); } return result; } | public String getcurrentUserLinkPath() { String result =null; try { result = new String( currentUserLinkPath, "UTF-16"); } catch (UnsupportedEncodingException e) { // TODO Auto-generated catch block e.printStackTrace(); } return result; } | 3,241,932 |
private void setAllLinkPaths() throws IllegalArgumentException, UnsupportedEncodingException { // sets currentUsersLinkPath and allUsersLinkPath GetFullLinkPath(CURRENT_USER, linkType); GetFullLinkPath(ALL_USERS, linkType); // be sure userType is valid. Override initial choice if not. if (userType == CURRENT_USER && new String(currentUserLinkPath, "UTF-16").length() == 0) { userType = ALL_USERS; } else if (userType == ALL_USERS && new String( allUsersLinkPath, "UTF-16").length() == 0) { userType = CURRENT_USER; } if ( new String(allUsersLinkPath, "UTF-16").length() == 0 && new String(currentUserLinkPath, "UTF-16").length() == 0) { throw (new IllegalArgumentException( "linkType " + linkType + " is invalid.")); } } | private void setAllLinkPaths() throws IllegalArgumentException { // sets currentUsersLinkPath and allUsersLinkPath GetFullLinkPath(CURRENT_USER, linkType); GetFullLinkPath(ALL_USERS, linkType); // be sure userType is valid. Override initial choice if not. if (userType == CURRENT_USER && new String(currentUserLinkPath, "UTF-16").length() == 0) { userType = ALL_USERS; } else if (userType == ALL_USERS && new String( allUsersLinkPath, "UTF-16").length() == 0) { userType = CURRENT_USER; } if ( new String(allUsersLinkPath, "UTF-16").length() == 0 && new String(currentUserLinkPath, "UTF-16").length() == 0) { throw (new IllegalArgumentException( "linkType " + linkType + " is invalid.")); } } | 3,241,933 |
private void setAllLinkPaths() throws IllegalArgumentException, UnsupportedEncodingException { // sets currentUsersLinkPath and allUsersLinkPath GetFullLinkPath(CURRENT_USER, linkType); GetFullLinkPath(ALL_USERS, linkType); // be sure userType is valid. Override initial choice if not. if (userType == CURRENT_USER && new String(currentUserLinkPath, "UTF-16").length() == 0) { userType = ALL_USERS; } else if (userType == ALL_USERS && new String( allUsersLinkPath, "UTF-16").length() == 0) { userType = CURRENT_USER; } if ( new String(allUsersLinkPath, "UTF-16").length() == 0 && new String(currentUserLinkPath, "UTF-16").length() == 0) { throw (new IllegalArgumentException( "linkType " + linkType + " is invalid.")); } } | private void setAllLinkPaths() throws IllegalArgumentException, UnsupportedEncodingException { // sets currentUsersLinkPath and allUsersLinkPath GetFullLinkPath(CURRENT_USER, linkType); GetFullLinkPath(ALL_USERS, linkType); // be sure userType is valid. Override initial choice if not. if (userType == CURRENT_USER && currentUserLinkPath.length() == 0) { userType = ALL_USERS; } else if (userType == ALL_USERS && new String( allUsersLinkPath, "UTF-16").length() == 0) { userType = CURRENT_USER; } if ( new String(allUsersLinkPath, "UTF-16").length() == 0 && new String(currentUserLinkPath, "UTF-16").length() == 0) { throw (new IllegalArgumentException( "linkType " + linkType + " is invalid.")); } } | 3,241,934 |
private void setAllLinkPaths() throws IllegalArgumentException, UnsupportedEncodingException { // sets currentUsersLinkPath and allUsersLinkPath GetFullLinkPath(CURRENT_USER, linkType); GetFullLinkPath(ALL_USERS, linkType); // be sure userType is valid. Override initial choice if not. if (userType == CURRENT_USER && new String(currentUserLinkPath, "UTF-16").length() == 0) { userType = ALL_USERS; } else if (userType == ALL_USERS && new String( allUsersLinkPath, "UTF-16").length() == 0) { userType = CURRENT_USER; } if ( new String(allUsersLinkPath, "UTF-16").length() == 0 && new String(currentUserLinkPath, "UTF-16").length() == 0) { throw (new IllegalArgumentException( "linkType " + linkType + " is invalid.")); } } | private void setAllLinkPaths() throws IllegalArgumentException, UnsupportedEncodingException { // sets currentUsersLinkPath and allUsersLinkPath GetFullLinkPath(CURRENT_USER, linkType); GetFullLinkPath(ALL_USERS, linkType); // be sure userType is valid. Override initial choice if not. if (userType == CURRENT_USER && new String(currentUserLinkPath, "UTF-16").length() == 0) { userType = ALL_USERS; } else if (userType == ALL_USERS && allUsersLinkPath.length() == 0) { userType = CURRENT_USER; } if ( new String(allUsersLinkPath, "UTF-16").length() == 0 && new String(currentUserLinkPath, "UTF-16").length() == 0) { throw (new IllegalArgumentException( "linkType " + linkType + " is invalid.")); } } | 3,241,935 |
private void setAllLinkPaths() throws IllegalArgumentException, UnsupportedEncodingException { // sets currentUsersLinkPath and allUsersLinkPath GetFullLinkPath(CURRENT_USER, linkType); GetFullLinkPath(ALL_USERS, linkType); // be sure userType is valid. Override initial choice if not. if (userType == CURRENT_USER && new String(currentUserLinkPath, "UTF-16").length() == 0) { userType = ALL_USERS; } else if (userType == ALL_USERS && new String( allUsersLinkPath, "UTF-16").length() == 0) { userType = CURRENT_USER; } if ( new String(allUsersLinkPath, "UTF-16").length() == 0 && new String(currentUserLinkPath, "UTF-16").length() == 0) { throw (new IllegalArgumentException( "linkType " + linkType + " is invalid.")); } } | private void setAllLinkPaths() throws IllegalArgumentException, UnsupportedEncodingException { // sets currentUsersLinkPath and allUsersLinkPath GetFullLinkPath(CURRENT_USER, linkType); GetFullLinkPath(ALL_USERS, linkType); // be sure userType is valid. Override initial choice if not. if (userType == CURRENT_USER && new String(currentUserLinkPath, "UTF-16").length() == 0) { userType = ALL_USERS; } else if (userType == ALL_USERS && new String( allUsersLinkPath, "UTF-16").length() == 0) { userType = CURRENT_USER; } if ( allUsersLinkPath.length() == 0 && currentUserLinkPath.length() == 0) { throw (new IllegalArgumentException( "linkType " + linkType + " is invalid.")); } } | 3,241,936 |
public synchronized Object borrowObject() throws Exception { assertOpen(); Object obj = null; try { obj = _pool.pop(); } catch(EmptyStackException e) { if(null == _factory) { throw new NoSuchElementException(); } else { obj = _factory.makeObject(); } } if(null != _factory && null != obj) { _factory.activateObject(obj); } _numActive++; return obj; } | public synchronized Object borrowObject() throws Exception { assertOpen(); Object obj = null; if (!_pool.empty()) { obj = _pool.pop(); } catch(EmptyStackException e) { if(null == _factory) { throw new NoSuchElementException(); } else { obj = _factory.makeObject(); } } if(null != _factory && null != obj) { _factory.activateObject(obj); } _numActive++; return obj; } | 3,241,937 |
public synchronized Object borrowObject() throws Exception { assertOpen(); Object obj = null; try { obj = _pool.pop(); } catch(EmptyStackException e) { if(null == _factory) { throw new NoSuchElementException(); } else { obj = _factory.makeObject(); } } if(null != _factory && null != obj) { _factory.activateObject(obj); } _numActive++; return obj; } | public synchronized Object borrowObject() throws Exception { assertOpen(); Object obj = null; try { obj = _pool.pop(); } else { if(null == _factory) { throw new NoSuchElementException(); } else { obj = _factory.makeObject(); } } if(null != _factory && null != obj) { _factory.activateObject(obj); } _numActive++; return obj; } | 3,241,938 |
private void analyzeShortcutSpec () { if (!haveShortcutSpec) { shortcutsToCreate = false; return; } // ---------------------------------------------------- // find out if we should simulate a not supported // scenario // ---------------------------------------------------- XMLElement support = spec.getFirstChildNamed (SPEC_KEY_NOT_SUPPORTED); if (support != null) { simulteNotSupported = true; } // ---------------------------------------------------- // find out in which program group the shortcuts should // be placed and where this program group should be // located // ---------------------------------------------------- XMLElement group = spec.getFirstChildNamed (SPEC_KEY_PROGRAM_GROUP); String location = null; hasDesktopShortcuts = false; if (group != null) { suggestedProgramGroup = group.getAttribute (SPEC_ATTRIBUTE_DEFAULT_GROUP, ""); location = group.getAttribute (SPEC_ATTRIBUTE_LOCATION, SPEC_VALUE_APPLICATIONS); } else { suggestedProgramGroup = ""; location = SPEC_VALUE_APPLICATIONS; } if (location.equals (SPEC_VALUE_APPLICATIONS)) { groupLocation = Shortcut.APPLICATIONS; } else if (location.equals (SPEC_VALUE_START_MENU)) { groupLocation = Shortcut.START_MENU; } // ---------------------------------------------------- // create a list of all shortcuts that need to be // created, containing all details about each shortcut // ---------------------------------------------------- VariableSubstitutor substitutor = new VariableSubstitutor (idata.getVariableValueMap ()); String temp; Vector shortcutSpecs = spec.getChildrenNamed (SPEC_KEY_SHORTCUT); XMLElement shortcutSpec; ShortcutData data; for (int i = 0; i < shortcutSpecs.size (); i++) { shortcutSpec = (XMLElement)shortcutSpecs.elementAt (i); data = new ShortcutData (); data.name = shortcutSpec.getAttribute (SPEC_ATTRIBUTE_NAME); data.subgroup = shortcutSpec.getAttribute (SPEC_ATTRIBUTE_SUBGROUP); data.description = shortcutSpec.getAttribute (SPEC_ATTRIBUTE_DESCRIPTION, ""); temp = fixSeparatorChar (shortcutSpec.getAttribute (SPEC_ATTRIBUTE_TARGET, "")); data.target = substitutor.substitute (temp, null); temp = shortcutSpec.getAttribute (SPEC_ATTRIBUTE_COMMAND, ""); data.commandLine = substitutor.substitute (temp, null); temp = fixSeparatorChar (shortcutSpec.getAttribute (SPEC_ATTRIBUTE_ICON, "")); data.iconFile = substitutor.substitute (temp, null); data.iconIndex = Integer.parseInt (shortcutSpec.getAttribute (SPEC_ATTRIBUTE_ICON_INDEX, "0")); temp = fixSeparatorChar (shortcutSpec.getAttribute (SPEC_ATTRIBUTE_WORKING_DIR, "")); data.workingDirectory = substitutor.substitute (temp, null); String initialState = shortcutSpec.getAttribute (SPEC_ATTRIBUTE_INITIAL_STATE, ""); if (initialState.equals (SPEC_VALUE_NO_SHOW)) { data.initialState = Shortcut.HIDE; } else if (initialState.equals (SPEC_VALUE_NORMAL)) { data.initialState = Shortcut.NORMAL; } else if (initialState.equals (SPEC_VALUE_MAXIMIZED)) { data.initialState = Shortcut.MAXIMIZED; } else if (initialState.equals (SPEC_VALUE_MINIMIZED)) { data.initialState = Shortcut.MINIMIZED; } else { data.initialState = Shortcut.NORMAL; } // -------------------------------------------------- // if the minimal data requirements are met to create // the shortcut, create one entry each for each of // the requested types. // Eventually this will cause the creation of one // shortcut in each of the associated locations. // -------------------------------------------------- // without a name we can not create a shortcut if (data.name == null) { continue; } // without a target we can not create a shortcut if (data.target == null) { continue; } // the shortcut is not actually required for any of the selected packs Vector forPacks = shortcutSpec.getChildrenNamed (SPEC_KEY_PACKS); if (!shortcutRequiredFor (forPacks)) { continue; } // -------------------------------------------------- // This section is executed if we don't skip. // -------------------------------------------------- // For each of the categories set the type and if // the link should be placed in the program group, // then clone the data set to obtain an independent // instance and add this to the list of shortcuts // to be created. In this way, we will set up an // identical copy for each of the locations at which // a shortcut should be placed. Therefore you must // not use 'else if' statements! // -------------------------------------------------- { if (attributeIsTrue (shortcutSpec, SPEC_ATTRIBUTE_DESKTOP)) { hasDesktopShortcuts = true; data.addToGroup = false; data.type = Shortcut.DESKTOP; shortcuts.add (data.clone ()); } if (attributeIsTrue (shortcutSpec, SPEC_ATTRIBUTE_APPLICATIONS)) { data.addToGroup = false; data.type = Shortcut.APPLICATIONS; shortcuts.add (data.clone ()); } if (attributeIsTrue (shortcutSpec, SPEC_ATTRIBUTE_START_MENU)) { data.addToGroup = false; data.type = Shortcut.START_MENU; shortcuts.add (data.clone ()); } if (attributeIsTrue (shortcutSpec, SPEC_ATTRIBUTE_STARTUP)) { data.addToGroup = false; data.type = Shortcut.START_UP; shortcuts.add (data.clone ()); } if (attributeIsTrue (shortcutSpec, SPEC_ATTRIBUTE_PROGRAM_GROUP)) { data.addToGroup = true; data.type = Shortcut.APPLICATIONS; shortcuts.add (data.clone ()); } } } // ---------------------------------------------------- // signal if there are any shortcuts to create // ---------------------------------------------------- if (shortcuts.size () > 0) { shortcutsToCreate = true; } } | private void analyzeShortcutSpec () { if (!haveShortcutSpec) { shortcutsToCreate = false; return; } // ---------------------------------------------------- // find out if we should simulate a not supported // scenario // ---------------------------------------------------- XMLElement support = spec.getFirstChildNamed (SPEC_KEY_NOT_SUPPORTED); if (support != null) { simulteNotSupported = true; } // ---------------------------------------------------- // find out in which program group the shortcuts should // be placed and where this program group should be // located // ---------------------------------------------------- XMLElement group = spec.getFirstChildNamed (SPEC_KEY_PROGRAM_GROUP); String location = null; hasDesktopShortcuts = false; if (group != null) { suggestedProgramGroup = group.getAttribute (SPEC_ATTRIBUTE_DEFAULT_GROUP, ""); location = group.getAttribute (SPEC_ATTRIBUTE_LOCATION, SPEC_VALUE_APPLICATIONS); } else { suggestedProgramGroup = ""; location = SPEC_VALUE_APPLICATIONS; } if (location.equals (SPEC_VALUE_APPLICATIONS)) { groupLocation = Shortcut.APPLICATIONS; } else if (location.equals (SPEC_VALUE_START_MENU)) { groupLocation = Shortcut.START_MENU; } // ---------------------------------------------------- // create a list of all shortcuts that need to be // created, containing all details about each shortcut // ---------------------------------------------------- VariableSubstitutor substitutor = new VariableSubstitutor (idata.getVariables()); String temp; Vector shortcutSpecs = spec.getChildrenNamed (SPEC_KEY_SHORTCUT); XMLElement shortcutSpec; ShortcutData data; for (int i = 0; i < shortcutSpecs.size (); i++) { shortcutSpec = (XMLElement)shortcutSpecs.elementAt (i); data = new ShortcutData (); data.name = shortcutSpec.getAttribute (SPEC_ATTRIBUTE_NAME); data.subgroup = shortcutSpec.getAttribute (SPEC_ATTRIBUTE_SUBGROUP); data.description = shortcutSpec.getAttribute (SPEC_ATTRIBUTE_DESCRIPTION, ""); temp = fixSeparatorChar (shortcutSpec.getAttribute (SPEC_ATTRIBUTE_TARGET, "")); data.target = substitutor.substitute (temp, null); temp = shortcutSpec.getAttribute (SPEC_ATTRIBUTE_COMMAND, ""); data.commandLine = substitutor.substitute (temp, null); temp = fixSeparatorChar (shortcutSpec.getAttribute (SPEC_ATTRIBUTE_ICON, "")); data.iconFile = substitutor.substitute (temp, null); data.iconIndex = Integer.parseInt (shortcutSpec.getAttribute (SPEC_ATTRIBUTE_ICON_INDEX, "0")); temp = fixSeparatorChar (shortcutSpec.getAttribute (SPEC_ATTRIBUTE_WORKING_DIR, "")); data.workingDirectory = substitutor.substitute (temp, null); String initialState = shortcutSpec.getAttribute (SPEC_ATTRIBUTE_INITIAL_STATE, ""); if (initialState.equals (SPEC_VALUE_NO_SHOW)) { data.initialState = Shortcut.HIDE; } else if (initialState.equals (SPEC_VALUE_NORMAL)) { data.initialState = Shortcut.NORMAL; } else if (initialState.equals (SPEC_VALUE_MAXIMIZED)) { data.initialState = Shortcut.MAXIMIZED; } else if (initialState.equals (SPEC_VALUE_MINIMIZED)) { data.initialState = Shortcut.MINIMIZED; } else { data.initialState = Shortcut.NORMAL; } // -------------------------------------------------- // if the minimal data requirements are met to create // the shortcut, create one entry each for each of // the requested types. // Eventually this will cause the creation of one // shortcut in each of the associated locations. // -------------------------------------------------- // without a name we can not create a shortcut if (data.name == null) { continue; } // without a target we can not create a shortcut if (data.target == null) { continue; } // the shortcut is not actually required for any of the selected packs Vector forPacks = shortcutSpec.getChildrenNamed (SPEC_KEY_PACKS); if (!shortcutRequiredFor (forPacks)) { continue; } // -------------------------------------------------- // This section is executed if we don't skip. // -------------------------------------------------- // For each of the categories set the type and if // the link should be placed in the program group, // then clone the data set to obtain an independent // instance and add this to the list of shortcuts // to be created. In this way, we will set up an // identical copy for each of the locations at which // a shortcut should be placed. Therefore you must // not use 'else if' statements! // -------------------------------------------------- { if (attributeIsTrue (shortcutSpec, SPEC_ATTRIBUTE_DESKTOP)) { hasDesktopShortcuts = true; data.addToGroup = false; data.type = Shortcut.DESKTOP; shortcuts.add (data.clone ()); } if (attributeIsTrue (shortcutSpec, SPEC_ATTRIBUTE_APPLICATIONS)) { data.addToGroup = false; data.type = Shortcut.APPLICATIONS; shortcuts.add (data.clone ()); } if (attributeIsTrue (shortcutSpec, SPEC_ATTRIBUTE_START_MENU)) { data.addToGroup = false; data.type = Shortcut.START_MENU; shortcuts.add (data.clone ()); } if (attributeIsTrue (shortcutSpec, SPEC_ATTRIBUTE_STARTUP)) { data.addToGroup = false; data.type = Shortcut.START_UP; shortcuts.add (data.clone ()); } if (attributeIsTrue (shortcutSpec, SPEC_ATTRIBUTE_PROGRAM_GROUP)) { data.addToGroup = true; data.type = Shortcut.APPLICATIONS; shortcuts.add (data.clone ()); } } } // ---------------------------------------------------- // signal if there are any shortcuts to create // ---------------------------------------------------- if (shortcuts.size () > 0) { shortcutsToCreate = true; } } | 3,241,939 |
public void mousePressed(MouseEvent me) { ImageDisplay d = findParentDisplay(me.getSource()); d.moveToFront(); if (d instanceof ImageNode) { if ((me.getModifiers() & InputEvent.SHIFT_MASK) == InputEvent.SHIFT_MASK) model.setSelectedDisplay(d, true); else model.setSelectedDisplay(d); } else model.setSelectedDisplay(d); if (me.isPopupTrigger()) popupTrigger = true; } | public void mousePressed(MouseEvent me) { ImageDisplay d = findParentDisplay(me.getSource()); d.moveToFront(); if (d instanceof ImageNode) { if ((me.getModifiers() & InputEvent.SHIFT_MASK) == InputEvent.SHIFT_MASK) model.setSelectedDisplay(d, true); else model.setSelectedDisplay(d); } else model.setSelectedDisplay(d); if (me.isPopupTrigger()) popupTrigger = true; } | 3,241,940 |
public void executeCompiler() throws Exception { // normalize and test: TODO: may allow failure if we require write access File base = new File(basedir).getAbsoluteFile(); if (!base.canRead() || !base.isDirectory()) throw new CompilerException("Invalid base directory: " + base); // Usefull variables String str; Iterator iter; 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 (must call before getResources for uninstaller) packager.setInfo(getInfo(data)); // We add the GUIPrefs packager.setGUIPrefs(getGUIPrefs(data)); // We add the language packs iter = getLangpacksCodes(data).iterator(); while (iter.hasNext()) { str = (String) iter.next(); // The language pack - first try to get stream directly (for standalone compiler) inStream = getClass().getResourceAsStream( "/bin/langpacks/installer/" + str + ".xml"); if (inStream == null) { inStream = new FileInputStream( Compiler.IZPACK_HOME + "bin" + File.separator + "langpacks" + File.separator + "installer" + File.separator + str + ".xml"); } packager.addLangPack(str, inStream); // The flag - try to get stream for standalone compiler inStream = getClass().getResourceAsStream("/bin/langpacks/flags/" + str + ".gif"); if (inStream == null) { inStream = new FileInputStream( Compiler.IZPACK_HOME + "bin" + File.separator + "langpacks" + File.separator + "flags" + File.separator + str + ".gif"); } packager.addResource("flag." + str, inStream); inStream.close(); } // We add the resources iter = getResources(data).iterator(); while (iter.hasNext()) { Resource res = (Resource) iter.next(); if (res.parse) { if ((res.src == null) || (res.src_is != null)) { System.err.println( "ERROR: cannot parse resource from stream. (Internal error.)"); packager.addResource(res.id, res.src_is); } 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); inStream.close(); } } else { if (res.src != null) { inStream = new FileInputStream(res.src); } else { inStream = res.src_is; } packager.addResource(res.id, inStream); if (res.src != null) inStream.close(); } } // We add the native libraries iter = getNativeLibraries(data).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 iter = getJars(data).iterator(); while (iter.hasNext()) packager.addJarContent((String) iter.next()); // We add the panels ArrayList panels = getPanels(data); TreeSet panelsCache = new TreeSet(); iter = panels.iterator(); while (iter.hasNext()) { Panel p = (Panel) iter.next(); // We locate the panel classes directory str = p.className; // first try to get a Jar file for standalone compiler JarInputStream panel_is = null; try { InputStream jarInStream = getClass().getResourceAsStream("/bin/panels/" + str + ".jar"); if (jarInStream != null) panel_is = new JarInputStream(jarInStream); } catch (IOException e) { // for now, ignore this - try to read panel classes from filesystem panel_is = null; } if (panel_is != null) { if (panelsCache.contains(str)) continue; panelsCache.add(str); // now add files ZipEntry entry = null; while ((entry = panel_is.getNextEntry()) != null) packager.addPanelClass(entry.getName(), panel_is); } else { File dir = new File(Compiler.IZPACK_HOME, "bin/panels/" + str); if (!dir.exists()) throw new Exception(str + " panel does not exist"); if (panelsCache.contains(str)) continue; panelsCache.add(str); DirectoryScanner ds = new DirectoryScanner(); ds.setBasedir(dir); ds.scan(); String[] files = ds.getIncludedFiles(); for (int j = 0; j < files.length; j++) { File f = new File(dir, files[j]); FileInputStream inClass = new FileInputStream(f); // file names must be in cononical (unix) form if ('/' != File.separatorChar) files[j] = files[j].replace(File.separatorChar, '/'); packager.addPanelClass(files[j], inClass); } } } // We set the panels order packager.setPanelsOrder(panels); Map storedFiles = new HashMap(); // We add the packs iter = getPacks(data).iterator(); while (iter.hasNext()) { Pack pack = (Pack) iter.next(); ZipOutputStream zipOut = packager.addPack( pack.number, pack.name, pack.osConstraints, pack.required, pack.description, pack.preselected); zipOut.flush(); //make sure buffers are flushed before we start counting ByteCountingOutputStream dos = new ByteCountingOutputStream(zipOut); //stream with byte counter ObjectOutputStream objOut = new ObjectOutputStream(dos); // 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(); long mtime = f.lastModified(); String targetFilename = p.getTargetFilename(); // pack paths in canonical (unix) form regardless of current host o/s: if ('/' != File.separatorChar) { targetFilename = targetFilename.replace(File.separatorChar, '/'); } // Writing PackFile pf = new PackFile( targetFilename, p.osConstraints, nbytes, mtime, p.override); long[] info = (long[]) storedFiles.get(p.src); boolean addFile = true; if (info != null && packager.allowPackFileBackReferences()) { pf.setPreviousPackFileRef((int) info[0], info[1]); addFile = false; } objOut.writeObject(pf); objOut.flush(); //make sure it is written long pos = dos.getByteCount(); //get the position if (addFile) { 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); storedFiles.put(p.src, new long[] { pack.number, pos }); } packageBytes += nbytes; //aldo could be not really written we still want to know size. in.close(); } packager.packAdded(pack.number, 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()); } // Write out information about executable files objOut.writeInt(pack.updatechecks.size()); iter2 = pack.updatechecks.iterator(); while (iter2.hasNext()) { objOut.writeObject(iter2.next()); } // Cleanup objOut.flush(); zipOut.closeEntry(); } // We ask the packager to finish packager.finish(); this.compileFailed = false; } | public void executeCompiler() throws Exception { // normalize and test: TODO: may allow failure if we require write access File base = new File(basedir).getAbsoluteFile(); if (!base.canRead() || !base.isDirectory()) throw new CompilerException("Invalid base directory: " + base); // Usefull variables String str; Iterator iter; InputStream inStream; // We get the XML data tree XMLElement data = getXMLTree(); // We get the Packager Packager packager = getPackager(); // We add the variable declaration Properties varMap = getVariables(data); packager.setVariables(varMap); // We add the info (must call before getResources for uninstaller) packager.setInfo(getInfo(data)); // We add the GUIPrefs packager.setGUIPrefs(getGUIPrefs(data)); // We add the language packs iter = getLangpacksCodes(data).iterator(); while (iter.hasNext()) { str = (String) iter.next(); // The language pack - first try to get stream directly (for standalone compiler) inStream = getClass().getResourceAsStream( "/bin/langpacks/installer/" + str + ".xml"); if (inStream == null) { inStream = new FileInputStream( Compiler.IZPACK_HOME + "bin" + File.separator + "langpacks" + File.separator + "installer" + File.separator + str + ".xml"); } packager.addLangPack(str, inStream); // The flag - try to get stream for standalone compiler inStream = getClass().getResourceAsStream("/bin/langpacks/flags/" + str + ".gif"); if (inStream == null) { inStream = new FileInputStream( Compiler.IZPACK_HOME + "bin" + File.separator + "langpacks" + File.separator + "flags" + File.separator + str + ".gif"); } packager.addResource("flag." + str, inStream); inStream.close(); } // We add the resources iter = getResources(data).iterator(); while (iter.hasNext()) { Resource res = (Resource) iter.next(); if (res.parse) { if ((res.src == null) || (res.src_is != null)) { System.err.println( "ERROR: cannot parse resource from stream. (Internal error.)"); packager.addResource(res.id, res.src_is); } 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); inStream.close(); } } else { if (res.src != null) { inStream = new FileInputStream(res.src); } else { inStream = res.src_is; } packager.addResource(res.id, inStream); if (res.src != null) inStream.close(); } } // We add the native libraries iter = getNativeLibraries(data).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 iter = getJars(data).iterator(); while (iter.hasNext()) packager.addJarContent((String) iter.next()); // We add the panels ArrayList panels = getPanels(data); TreeSet panelsCache = new TreeSet(); iter = panels.iterator(); while (iter.hasNext()) { Panel p = (Panel) iter.next(); // We locate the panel classes directory str = p.className; // first try to get a Jar file for standalone compiler JarInputStream panel_is = null; try { InputStream jarInStream = getClass().getResourceAsStream("/bin/panels/" + str + ".jar"); if (jarInStream != null) panel_is = new JarInputStream(jarInStream); } catch (IOException e) { // for now, ignore this - try to read panel classes from filesystem panel_is = null; } if (panel_is != null) { if (panelsCache.contains(str)) continue; panelsCache.add(str); // now add files ZipEntry entry = null; while ((entry = panel_is.getNextEntry()) != null) packager.addPanelClass(entry.getName(), panel_is); } else { File dir = new File(Compiler.IZPACK_HOME, "bin/panels/" + str); if (!dir.exists()) throw new Exception(str + " panel does not exist"); if (panelsCache.contains(str)) continue; panelsCache.add(str); DirectoryScanner ds = new DirectoryScanner(); ds.setBasedir(dir); ds.scan(); String[] files = ds.getIncludedFiles(); for (int j = 0; j < files.length; j++) { File f = new File(dir, files[j]); FileInputStream inClass = new FileInputStream(f); // file names must be in cononical (unix) form if ('/' != File.separatorChar) files[j] = files[j].replace(File.separatorChar, '/'); packager.addPanelClass(files[j], inClass); } } } // We set the panels order packager.setPanelsOrder(panels); Map storedFiles = new HashMap(); // We add the packs iter = getPacks(data).iterator(); while (iter.hasNext()) { Pack pack = (Pack) iter.next(); ZipOutputStream zipOut = packager.addPack( pack.number, pack.name, pack.osConstraints, pack.required, pack.description, pack.preselected); zipOut.flush(); //make sure buffers are flushed before we start counting ByteCountingOutputStream dos = new ByteCountingOutputStream(zipOut); //stream with byte counter ObjectOutputStream objOut = new ObjectOutputStream(dos); // 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(); long mtime = f.lastModified(); String targetFilename = p.getTargetFilename(); // pack paths in canonical (unix) form regardless of current host o/s: if ('/' != File.separatorChar) { targetFilename = targetFilename.replace(File.separatorChar, '/'); } // Writing PackFile pf = new PackFile( targetFilename, p.osConstraints, nbytes, mtime, p.override); long[] info = (long[]) storedFiles.get(p.src); boolean addFile = true; if (info != null && packager.allowPackFileBackReferences()) { pf.setPreviousPackFileRef((int) info[0], info[1]); addFile = false; } objOut.writeObject(pf); objOut.flush(); //make sure it is written long pos = dos.getByteCount(); //get the position if (addFile) { 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); storedFiles.put(p.src, new long[] { pack.number, pos }); } packageBytes += nbytes; //aldo could be not really written we still want to know size. in.close(); } packager.packAdded(pack.number, 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()); } // Write out information about executable files objOut.writeInt(pack.updatechecks.size()); iter2 = pack.updatechecks.iterator(); while (iter2.hasNext()) { objOut.writeObject(iter2.next()); } // Cleanup objOut.flush(); zipOut.closeEntry(); } // We ask the packager to finish packager.finish(); this.compileFailed = false; } | 3,241,941 |
public void executeCompiler() throws Exception { // normalize and test: TODO: may allow failure if we require write access File base = new File(basedir).getAbsoluteFile(); if (!base.canRead() || !base.isDirectory()) throw new CompilerException("Invalid base directory: " + base); // Usefull variables String str; Iterator iter; 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 (must call before getResources for uninstaller) packager.setInfo(getInfo(data)); // We add the GUIPrefs packager.setGUIPrefs(getGUIPrefs(data)); // We add the language packs iter = getLangpacksCodes(data).iterator(); while (iter.hasNext()) { str = (String) iter.next(); // The language pack - first try to get stream directly (for standalone compiler) inStream = getClass().getResourceAsStream( "/bin/langpacks/installer/" + str + ".xml"); if (inStream == null) { inStream = new FileInputStream( Compiler.IZPACK_HOME + "bin" + File.separator + "langpacks" + File.separator + "installer" + File.separator + str + ".xml"); } packager.addLangPack(str, inStream); // The flag - try to get stream for standalone compiler inStream = getClass().getResourceAsStream("/bin/langpacks/flags/" + str + ".gif"); if (inStream == null) { inStream = new FileInputStream( Compiler.IZPACK_HOME + "bin" + File.separator + "langpacks" + File.separator + "flags" + File.separator + str + ".gif"); } packager.addResource("flag." + str, inStream); inStream.close(); } // We add the resources iter = getResources(data).iterator(); while (iter.hasNext()) { Resource res = (Resource) iter.next(); if (res.parse) { if ((res.src == null) || (res.src_is != null)) { System.err.println( "ERROR: cannot parse resource from stream. (Internal error.)"); packager.addResource(res.id, res.src_is); } 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); inStream.close(); } } else { if (res.src != null) { inStream = new FileInputStream(res.src); } else { inStream = res.src_is; } packager.addResource(res.id, inStream); if (res.src != null) inStream.close(); } } // We add the native libraries iter = getNativeLibraries(data).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 iter = getJars(data).iterator(); while (iter.hasNext()) packager.addJarContent((String) iter.next()); // We add the panels ArrayList panels = getPanels(data); TreeSet panelsCache = new TreeSet(); iter = panels.iterator(); while (iter.hasNext()) { Panel p = (Panel) iter.next(); // We locate the panel classes directory str = p.className; // first try to get a Jar file for standalone compiler JarInputStream panel_is = null; try { InputStream jarInStream = getClass().getResourceAsStream("/bin/panels/" + str + ".jar"); if (jarInStream != null) panel_is = new JarInputStream(jarInStream); } catch (IOException e) { // for now, ignore this - try to read panel classes from filesystem panel_is = null; } if (panel_is != null) { if (panelsCache.contains(str)) continue; panelsCache.add(str); // now add files ZipEntry entry = null; while ((entry = panel_is.getNextEntry()) != null) packager.addPanelClass(entry.getName(), panel_is); } else { File dir = new File(Compiler.IZPACK_HOME, "bin/panels/" + str); if (!dir.exists()) throw new Exception(str + " panel does not exist"); if (panelsCache.contains(str)) continue; panelsCache.add(str); DirectoryScanner ds = new DirectoryScanner(); ds.setBasedir(dir); ds.scan(); String[] files = ds.getIncludedFiles(); for (int j = 0; j < files.length; j++) { File f = new File(dir, files[j]); FileInputStream inClass = new FileInputStream(f); // file names must be in cononical (unix) form if ('/' != File.separatorChar) files[j] = files[j].replace(File.separatorChar, '/'); packager.addPanelClass(files[j], inClass); } } } // We set the panels order packager.setPanelsOrder(panels); Map storedFiles = new HashMap(); // We add the packs iter = getPacks(data).iterator(); while (iter.hasNext()) { Pack pack = (Pack) iter.next(); ZipOutputStream zipOut = packager.addPack( pack.number, pack.name, pack.osConstraints, pack.required, pack.description, pack.preselected); zipOut.flush(); //make sure buffers are flushed before we start counting ByteCountingOutputStream dos = new ByteCountingOutputStream(zipOut); //stream with byte counter ObjectOutputStream objOut = new ObjectOutputStream(dos); // 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(); long mtime = f.lastModified(); String targetFilename = p.getTargetFilename(); // pack paths in canonical (unix) form regardless of current host o/s: if ('/' != File.separatorChar) { targetFilename = targetFilename.replace(File.separatorChar, '/'); } // Writing PackFile pf = new PackFile( targetFilename, p.osConstraints, nbytes, mtime, p.override); long[] info = (long[]) storedFiles.get(p.src); boolean addFile = true; if (info != null && packager.allowPackFileBackReferences()) { pf.setPreviousPackFileRef((int) info[0], info[1]); addFile = false; } objOut.writeObject(pf); objOut.flush(); //make sure it is written long pos = dos.getByteCount(); //get the position if (addFile) { 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); storedFiles.put(p.src, new long[] { pack.number, pos }); } packageBytes += nbytes; //aldo could be not really written we still want to know size. in.close(); } packager.packAdded(pack.number, 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()); } // Write out information about executable files objOut.writeInt(pack.updatechecks.size()); iter2 = pack.updatechecks.iterator(); while (iter2.hasNext()) { objOut.writeObject(iter2.next()); } // Cleanup objOut.flush(); zipOut.closeEntry(); } // We ask the packager to finish packager.finish(); this.compileFailed = false; } | public void executeCompiler() throws Exception { // normalize and test: TODO: may allow failure if we require write access File base = new File(basedir).getAbsoluteFile(); if (!base.canRead() || !base.isDirectory()) throw new CompilerException("Invalid base directory: " + base); // Usefull variables String str; Iterator iter; 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 (must call before getResources for uninstaller) packager.setInfo(getInfo(data)); // We add the GUIPrefs packager.setGUIPrefs(getGUIPrefs(data)); // We add the language packs iter = getLangpacksCodes(data).iterator(); while (iter.hasNext()) { str = (String) iter.next(); // The language pack - first try to get stream directly (for standalone compiler) inStream = getClass().getResourceAsStream( "/bin/langpacks/installer/" + str + ".xml"); if (inStream == null) { inStream = new FileInputStream( Compiler.IZPACK_HOME + "bin" + File.separator + "langpacks" + File.separator + "installer" + File.separator + str + ".xml"); } packager.addLangPack(str, inStream); // The flag - try to get stream for standalone compiler inStream = getClass().getResourceAsStream("/bin/langpacks/flags/" + str + ".gif"); if (inStream == null) { inStream = new FileInputStream( Compiler.IZPACK_HOME + "bin" + File.separator + "langpacks" + File.separator + "flags" + File.separator + str + ".gif"); } packager.addResource("flag." + str, inStream); inStream.close(); } // We add the resources iter = getResources(data).iterator(); while (iter.hasNext()) { Resource res = (Resource) iter.next(); if (res.parse) { if ((res.src == null) || (res.src_is != null)) { System.err.println( "ERROR: cannot parse resource from stream. (Internal error.)"); packager.addResource(res.id, res.src_is); } 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); inStream.close(); } } else { if (res.src != null) { inStream = new FileInputStream(res.src); } else { inStream = res.src_is; } packager.addResource(res.id, inStream); if (res.src != null) inStream.close(); } } // We add the native libraries iter = getNativeLibraries(data).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 iter = getJars(data).iterator(); while (iter.hasNext()) packager.addJarContent((String) iter.next()); // We add the panels ArrayList panels = getPanels(data); TreeSet panelsCache = new TreeSet(); iter = panels.iterator(); while (iter.hasNext()) { Panel p = (Panel) iter.next(); // We locate the panel classes directory str = p.className; // first try to get a Jar file for standalone compiler JarInputStream panel_is = null; try { InputStream jarInStream = getClass().getResourceAsStream("/bin/panels/" + str + ".jar"); if (jarInStream != null) panel_is = new JarInputStream(jarInStream); } catch (IOException e) { // for now, ignore this - try to read panel classes from filesystem panel_is = null; } if (panel_is != null) { if (panelsCache.contains(str)) continue; panelsCache.add(str); // now add files ZipEntry entry = null; while ((entry = panel_is.getNextEntry()) != null) packager.addPanelClass(entry.getName(), panel_is); } else { File dir = new File(Compiler.IZPACK_HOME, "bin/panels/" + str); if (!dir.exists()) throw new Exception(str + " panel does not exist"); if (panelsCache.contains(str)) continue; panelsCache.add(str); DirectoryScanner ds = new DirectoryScanner(); ds.setBasedir(dir); ds.scan(); String[] files = ds.getIncludedFiles(); for (int j = 0; j < files.length; j++) { File f = new File(dir, files[j]); FileInputStream inClass = new FileInputStream(f); // file names must be in cononical (unix) form if ('/' != File.separatorChar) files[j] = files[j].replace(File.separatorChar, '/'); packager.addPanelClass(files[j], inClass); } } } // We set the panels order packager.setPanelsOrder(panels); Map storedFiles = new HashMap(); // We add the packs iter = getPacks(data).iterator(); while (iter.hasNext()) { Pack pack = (Pack) iter.next(); ZipOutputStream zipOut = packager.addPack( pack.number, pack.name, pack.osConstraints, pack.required, pack.description, pack.preselected); zipOut.flush(); //make sure buffers are flushed before we start counting ByteCountingOutputStream dos = new ByteCountingOutputStream(zipOut); //stream with byte counter ObjectOutputStream objOut = new ObjectOutputStream(dos); // 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(); long mtime = f.lastModified(); String targetFilename = p.getTargetFilename(); // pack paths in canonical (unix) form regardless of current host o/s: if ('/' != File.separatorChar) { targetFilename = targetFilename.replace(File.separatorChar, '/'); } // Writing PackFile pf = new PackFile( targetFilename, p.osConstraints, nbytes, mtime, p.override); long[] info = (long[]) storedFiles.get(p.src); boolean addFile = true; if (info != null && packager.allowPackFileBackReferences()) { pf.setPreviousPackFileRef((int) info[0], info[1]); addFile = false; } objOut.writeObject(pf); objOut.flush(); //make sure it is written long pos = dos.getByteCount(); //get the position if (addFile) { 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); storedFiles.put(p.src, new long[] { pack.number, pos }); } packageBytes += nbytes; //aldo could be not really written we still want to know size. in.close(); } packager.packAdded(pack.number, 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()); } // Write out information about executable files objOut.writeInt(pack.updatechecks.size()); iter2 = pack.updatechecks.iterator(); while (iter2.hasNext()) { objOut.writeObject(iter2.next()); } // Cleanup objOut.flush(); zipOut.closeEntry(); } // We ask the packager to finish packager.finish(); this.compileFailed = false; } | 3,241,942 |
protected ArrayList getPacks(XMLElement data) throws CompilerException { // Initialisation ArrayList packs = new ArrayList(); XMLElement root = requireChildNamed(data, "packs"); // dummy variable used for values from XML String val; // We process each pack markup int packCounter = 0; Iterator packIter = root.getChildrenNamed("pack").iterator(); while (packIter.hasNext()) { XMLElement el = (XMLElement) packIter.next(); // Trivial initialisations Pack pack = new Pack(); pack.number = packCounter++; pack.name = requireAttribute(el, "name"); pack.osConstraints = OsConstraint.getOsList(el); // TODO: unverified pack.required = requireYesNoAttribute(el, "required"); pack.description = requireChildNamed(el, "description").getContent(); pack.preselected = validateYesNoAttribute(el, "preselected", YES); // We get the parsables list Iterator iter = el.getChildrenNamed("parsable").iterator(); while (iter.hasNext()) { XMLElement p = (XMLElement) iter.next(); String targetFile = requireAttribute(p, "targetfile"); List osList = OsConstraint.getOsList(p); // TODO: unverified pack.parsables.add( new ParsableFile( targetFile, p.getAttribute("type", "plain"), p.getAttribute("encoding", null), osList)); } // We get the executables list iter = el.getChildrenNamed("executable").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".equalsIgnoreCase(val)) executeOn = ExecutableFile.POSTINSTALL; else if ("uninstall".equalsIgnoreCase(val)) 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".equalsIgnoreCase(val)) executeType = ExecutableFile.JAR; // what to do if execution fails int onFailure = ExecutableFile.ASK; val = e.getAttribute("failure", "ask"); if ("abort".equalsIgnoreCase(val)) onFailure = ExecutableFile.ABORT; else if ("warn".equalsIgnoreCase(val)) onFailure = ExecutableFile.WARN; // whether to keep the executable after executing it boolean keepFile = false; val = e.getAttribute("keep"); if ("true".equalsIgnoreCase(val)) 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(requireAttribute(arg, "value")); } } List osList = OsConstraint.getOsList(e); // TODO: unverified String targetfile_attr = requireAttribute(e, "targetfile"); 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 = requireAttribute(f, "src"); 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); // TODO: unverified String targetdir_attr = requireAttribute(f, "targetdir"); try { addFile(file, targetdir_attr, osList, override, pack.packFiles); } catch (CompilerException x) { parseError(f, x.getMessage(), x); } } // We get the singlefiles list iter = el.getChildrenNamed("singlefile").iterator(); while (iter.hasNext()) { XMLElement f = (XMLElement) iter.next(); String src_attr = requireAttribute(f, "src"); 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); // TODO: unverified String target_attr = requireAttribute(f, "target"); try { addSingleFile(file, target_attr, osList, override, pack.packFiles); } catch (CompilerException x) { parseError(f, x.getMessage(), x); } } // We get the fileset list iter = el.getChildrenNamed("fileset").iterator(); while (iter.hasNext()) { XMLElement f = (XMLElement) iter.next(); String dir_attr = requireAttribute(f, "dir"); String path; if (new File(dir_attr).isAbsolute()) path = dir_attr; else path = basedir + File.separator + dir_attr; boolean casesensitive = validateYesNoAttribute(f, "casesensitive", YES); // 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] = requireAttribute(xclude, "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] = requireAttribute(xclude, "name"); } } int override = getOverrideValue(f); String targetdir_attr = requireAttribute(f, "targetdir"); List osList = OsConstraint.getOsList(f); // TODO: unverified try { addFileSet( path, includes, excludes, targetdir_attr, osList, pack.packFiles, casesensitive, override); } catch (CompilerException x) { parseError(f, x.getMessage(), x); } } // get the updatechecks list // We get the fileset list iter = el.getChildrenNamed("updatecheck").iterator(); while (iter.hasNext()) { XMLElement f = (XMLElement) iter.next(); String casesensitive = f.getAttribute("casesensitive"); // get includes and excludes ArrayList includesList = new ArrayList(); Vector includesElementList = f.getChildrenNamed("include"); if (includesElementList != null) { Iterator include_it = includesElementList.iterator(); while (include_it.hasNext()) { XMLElement inc_el = (XMLElement) include_it.next(); String name = inc_el.getAttribute("name"); if (name != null) { includesList.add(name); } else { parseError( inc_el, "missing \"name\" attribute for <include> in <updatecheck>"); } } } ArrayList excludesList = new ArrayList(); Vector excludesElementList = f.getChildrenNamed("exclude"); if (excludesElementList != null) { Iterator exclude_it = excludesElementList.iterator(); while (exclude_it.hasNext()) { XMLElement excl_el = (XMLElement) exclude_it.next(); String name = excl_el.getAttribute("name"); if (name != null) { excludesList.add(name); } else { parseError( excl_el, "missing \"name\" attribute for <exclude> in <updatecheck>"); } } } pack.updatechecks.add( new UpdateCheck(includesList, excludesList, casesensitive)); } // We add the pack packs.add(pack); } if (packs.isEmpty()) parseError(root, "<packs> requires a <pack>"); // We return the ArrayList return packs; } | protected ArrayList getPacks(XMLElement data) throws CompilerException { // Initialisation ArrayList packs = new ArrayList(); XMLElement root = requireChildNamed(data, "packs"); // dummy variable used for values from XML String val; // We process each pack markup int packCounter = 0; Iterator packIter = root.getChildrenNamed("pack").iterator(); while (packIter.hasNext()) { XMLElement el = (XMLElement) packIter.next(); // Trivial initialisations Pack pack = new Pack(); pack.number = packCounter++; pack.name = requireAttribute(el, "name"); pack.osConstraints = OsConstraint.getOsList(el); // TODO: unverified pack.required = requireYesNoAttribute(el, "required"); pack.description = requireChildNamed(el, "description").getContent(); pack.preselected = validateYesNoAttribute(el, "preselected", YES); // We get the parsables list Iterator iter = el.getChildrenNamed("parsable").iterator(); while (iter.hasNext()) { XMLElement p = (XMLElement) iter.next(); String targetFile = requireAttribute(p, "targetfile"); List osList = OsConstraint.getOsList(p); // TODO: unverified pack.parsables.add( new ParsableFile( targetFile, p.getAttribute("type", "plain"), p.getAttribute("encoding", null), osList)); } // We get the executables list iter = el.getChildrenNamed("executable").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".equalsIgnoreCase(val)) executeOn = ExecutableFile.POSTINSTALL; else if ("uninstall".equalsIgnoreCase(val)) 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".equalsIgnoreCase(val)) executeType = ExecutableFile.JAR; // what to do if execution fails int onFailure = ExecutableFile.ASK; val = e.getAttribute("failure", "ask"); if ("abort".equalsIgnoreCase(val)) onFailure = ExecutableFile.ABORT; else if ("warn".equalsIgnoreCase(val)) onFailure = ExecutableFile.WARN; // whether to keep the executable after executing it val = e.getAttribute("keep"); if ("true".equalsIgnoreCase(val)) 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(requireAttribute(arg, "value")); } } List osList = OsConstraint.getOsList(e); // TODO: unverified String targetfile_attr = requireAttribute(e, "targetfile"); 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 = requireAttribute(f, "src"); 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); // TODO: unverified String targetdir_attr = requireAttribute(f, "targetdir"); try { addFile(file, targetdir_attr, osList, override, pack.packFiles); } catch (CompilerException x) { parseError(f, x.getMessage(), x); } } // We get the singlefiles list iter = el.getChildrenNamed("singlefile").iterator(); while (iter.hasNext()) { XMLElement f = (XMLElement) iter.next(); String src_attr = requireAttribute(f, "src"); 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); // TODO: unverified String target_attr = requireAttribute(f, "target"); try { addSingleFile(file, target_attr, osList, override, pack.packFiles); } catch (CompilerException x) { parseError(f, x.getMessage(), x); } } // We get the fileset list iter = el.getChildrenNamed("fileset").iterator(); while (iter.hasNext()) { XMLElement f = (XMLElement) iter.next(); String dir_attr = requireAttribute(f, "dir"); String path; if (new File(dir_attr).isAbsolute()) path = dir_attr; else path = basedir + File.separator + dir_attr; boolean casesensitive = validateYesNoAttribute(f, "casesensitive", YES); // 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] = requireAttribute(xclude, "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] = requireAttribute(xclude, "name"); } } int override = getOverrideValue(f); String targetdir_attr = requireAttribute(f, "targetdir"); List osList = OsConstraint.getOsList(f); // TODO: unverified try { addFileSet( path, includes, excludes, targetdir_attr, osList, pack.packFiles, casesensitive, override); } catch (CompilerException x) { parseError(f, x.getMessage(), x); } } // get the updatechecks list // We get the fileset list iter = el.getChildrenNamed("updatecheck").iterator(); while (iter.hasNext()) { XMLElement f = (XMLElement) iter.next(); String casesensitive = f.getAttribute("casesensitive"); // get includes and excludes ArrayList includesList = new ArrayList(); Vector includesElementList = f.getChildrenNamed("include"); if (includesElementList != null) { Iterator include_it = includesElementList.iterator(); while (include_it.hasNext()) { XMLElement inc_el = (XMLElement) include_it.next(); String name = inc_el.getAttribute("name"); if (name != null) { includesList.add(name); } else { parseError( inc_el, "missing \"name\" attribute for <include> in <updatecheck>"); } } } ArrayList excludesList = new ArrayList(); Vector excludesElementList = f.getChildrenNamed("exclude"); if (excludesElementList != null) { Iterator exclude_it = excludesElementList.iterator(); while (exclude_it.hasNext()) { XMLElement excl_el = (XMLElement) exclude_it.next(); String name = excl_el.getAttribute("name"); if (name != null) { excludesList.add(name); } else { parseError( excl_el, "missing \"name\" attribute for <exclude> in <updatecheck>"); } } } pack.updatechecks.add( new UpdateCheck(includesList, excludesList, casesensitive)); } // We add the pack packs.add(pack); } if (packs.isEmpty()) parseError(root, "<packs> requires a <pack>"); // We return the ArrayList return packs; } | 3,241,943 |
protected ArrayList getPacks(XMLElement data) throws CompilerException { // Initialisation ArrayList packs = new ArrayList(); XMLElement root = requireChildNamed(data, "packs"); // dummy variable used for values from XML String val; // We process each pack markup int packCounter = 0; Iterator packIter = root.getChildrenNamed("pack").iterator(); while (packIter.hasNext()) { XMLElement el = (XMLElement) packIter.next(); // Trivial initialisations Pack pack = new Pack(); pack.number = packCounter++; pack.name = requireAttribute(el, "name"); pack.osConstraints = OsConstraint.getOsList(el); // TODO: unverified pack.required = requireYesNoAttribute(el, "required"); pack.description = requireChildNamed(el, "description").getContent(); pack.preselected = validateYesNoAttribute(el, "preselected", YES); // We get the parsables list Iterator iter = el.getChildrenNamed("parsable").iterator(); while (iter.hasNext()) { XMLElement p = (XMLElement) iter.next(); String targetFile = requireAttribute(p, "targetfile"); List osList = OsConstraint.getOsList(p); // TODO: unverified pack.parsables.add( new ParsableFile( targetFile, p.getAttribute("type", "plain"), p.getAttribute("encoding", null), osList)); } // We get the executables list iter = el.getChildrenNamed("executable").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".equalsIgnoreCase(val)) executeOn = ExecutableFile.POSTINSTALL; else if ("uninstall".equalsIgnoreCase(val)) 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".equalsIgnoreCase(val)) executeType = ExecutableFile.JAR; // what to do if execution fails int onFailure = ExecutableFile.ASK; val = e.getAttribute("failure", "ask"); if ("abort".equalsIgnoreCase(val)) onFailure = ExecutableFile.ABORT; else if ("warn".equalsIgnoreCase(val)) onFailure = ExecutableFile.WARN; // whether to keep the executable after executing it boolean keepFile = false; val = e.getAttribute("keep"); if ("true".equalsIgnoreCase(val)) 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(requireAttribute(arg, "value")); } } List osList = OsConstraint.getOsList(e); // TODO: unverified String targetfile_attr = requireAttribute(e, "targetfile"); 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 = requireAttribute(f, "src"); 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); // TODO: unverified String targetdir_attr = requireAttribute(f, "targetdir"); try { addFile(file, targetdir_attr, osList, override, pack.packFiles); } catch (CompilerException x) { parseError(f, x.getMessage(), x); } } // We get the singlefiles list iter = el.getChildrenNamed("singlefile").iterator(); while (iter.hasNext()) { XMLElement f = (XMLElement) iter.next(); String src_attr = requireAttribute(f, "src"); 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); // TODO: unverified String target_attr = requireAttribute(f, "target"); try { addSingleFile(file, target_attr, osList, override, pack.packFiles); } catch (CompilerException x) { parseError(f, x.getMessage(), x); } } // We get the fileset list iter = el.getChildrenNamed("fileset").iterator(); while (iter.hasNext()) { XMLElement f = (XMLElement) iter.next(); String dir_attr = requireAttribute(f, "dir"); String path; if (new File(dir_attr).isAbsolute()) path = dir_attr; else path = basedir + File.separator + dir_attr; boolean casesensitive = validateYesNoAttribute(f, "casesensitive", YES); // 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] = requireAttribute(xclude, "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] = requireAttribute(xclude, "name"); } } int override = getOverrideValue(f); String targetdir_attr = requireAttribute(f, "targetdir"); List osList = OsConstraint.getOsList(f); // TODO: unverified try { addFileSet( path, includes, excludes, targetdir_attr, osList, pack.packFiles, casesensitive, override); } catch (CompilerException x) { parseError(f, x.getMessage(), x); } } // get the updatechecks list // We get the fileset list iter = el.getChildrenNamed("updatecheck").iterator(); while (iter.hasNext()) { XMLElement f = (XMLElement) iter.next(); String casesensitive = f.getAttribute("casesensitive"); // get includes and excludes ArrayList includesList = new ArrayList(); Vector includesElementList = f.getChildrenNamed("include"); if (includesElementList != null) { Iterator include_it = includesElementList.iterator(); while (include_it.hasNext()) { XMLElement inc_el = (XMLElement) include_it.next(); String name = inc_el.getAttribute("name"); if (name != null) { includesList.add(name); } else { parseError( inc_el, "missing \"name\" attribute for <include> in <updatecheck>"); } } } ArrayList excludesList = new ArrayList(); Vector excludesElementList = f.getChildrenNamed("exclude"); if (excludesElementList != null) { Iterator exclude_it = excludesElementList.iterator(); while (exclude_it.hasNext()) { XMLElement excl_el = (XMLElement) exclude_it.next(); String name = excl_el.getAttribute("name"); if (name != null) { excludesList.add(name); } else { parseError( excl_el, "missing \"name\" attribute for <exclude> in <updatecheck>"); } } } pack.updatechecks.add( new UpdateCheck(includesList, excludesList, casesensitive)); } // We add the pack packs.add(pack); } if (packs.isEmpty()) parseError(root, "<packs> requires a <pack>"); // We return the ArrayList return packs; } | protected ArrayList getPacks(XMLElement data) throws CompilerException { // Initialisation ArrayList packs = new ArrayList(); XMLElement root = requireChildNamed(data, "packs"); // dummy variable used for values from XML String val; // We process each pack markup int packCounter = 0; Iterator packIter = root.getChildrenNamed("pack").iterator(); while (packIter.hasNext()) { XMLElement el = (XMLElement) packIter.next(); // Trivial initialisations Pack pack = new Pack(); pack.number = packCounter++; pack.name = requireAttribute(el, "name"); pack.osConstraints = OsConstraint.getOsList(el); // TODO: unverified pack.required = requireYesNoAttribute(el, "required"); pack.description = requireChildNamed(el, "description").getContent(); pack.preselected = validateYesNoAttribute(el, "preselected", YES); // We get the parsables list Iterator iter = el.getChildrenNamed("parsable").iterator(); while (iter.hasNext()) { XMLElement p = (XMLElement) iter.next(); String targetFile = requireAttribute(p, "targetfile"); List osList = OsConstraint.getOsList(p); // TODO: unverified pack.parsables.add( new ParsableFile( targetFile, p.getAttribute("type", "plain"), p.getAttribute("encoding", null), osList)); } // We get the executables list iter = el.getChildrenNamed("executable").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".equalsIgnoreCase(val)) executeOn = ExecutableFile.POSTINSTALL; else if ("uninstall".equalsIgnoreCase(val)) 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".equalsIgnoreCase(val)) executeType = ExecutableFile.JAR; // what to do if execution fails int onFailure = ExecutableFile.ASK; val = e.getAttribute("failure", "ask"); if ("abort".equalsIgnoreCase(val)) onFailure = ExecutableFile.ABORT; else if ("warn".equalsIgnoreCase(val)) onFailure = ExecutableFile.WARN; // whether to keep the executable after executing it boolean keepFile = false; val = e.getAttribute("keep"); if ("true".equalsIgnoreCase(val)) 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(requireAttribute(arg, "value")); } } List osList = OsConstraint.getOsList(e); // TODO: unverified String targetfile_attr = requireAttribute(e, "targetfile"); 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 = requireAttribute(f, "src"); 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); // TODO: unverified String targetdir_attr = requireAttribute(f, "targetdir"); try { addFile(file, targetdir_attr, osList, override, pack.packFiles); } catch (CompilerException x) { parseError(f, x.getMessage(), x); } } // We get the singlefiles list iter = el.getChildrenNamed("singlefile").iterator(); while (iter.hasNext()) { XMLElement f = (XMLElement) iter.next(); String src_attr = requireAttribute(f, "src"); 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); // TODO: unverified String target_attr = requireAttribute(f, "target"); try { addSingleFile(file, target_attr, osList, override, pack.packFiles); } catch (CompilerException x) { parseError(f, x.getMessage(), x); } } // We get the fileset list iter = el.getChildrenNamed("fileset").iterator(); while (iter.hasNext()) { XMLElement f = (XMLElement) iter.next(); String dir_attr = requireAttribute(f, "dir"); String path; if (new File(dir_attr).isAbsolute()) path = dir_attr; else path = basedir + File.separator + dir_attr; boolean casesensitive = validateYesNoAttribute(f, "casesensitive", YES); // 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] = requireAttribute(xclude, "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] = requireAttribute(xclude, "name"); } } int override = getOverrideValue(f); String targetdir_attr = requireAttribute(f, "targetdir"); List osList = OsConstraint.getOsList(f); // TODO: unverified try { addFileSet( path, includes, excludes, targetdir_attr, osList, pack.packFiles, casesensitive, override); } catch (CompilerException x) { parseError(f, x.getMessage(), x); } } // get the updatechecks list // We get the fileset list iter = el.getChildrenNamed("updatecheck").iterator(); while (iter.hasNext()) { XMLElement f = (XMLElement) iter.next(); String casesensitive = f.getAttribute("casesensitive"); // get includes and excludes ArrayList includesList = new ArrayList(); Vector includesElementList = f.getChildrenNamed("include"); if (includesElementList != null) { Iterator include_it = includesElementList.iterator(); while (include_it.hasNext()) { XMLElement inc_el = (XMLElement) include_it.next(); String name = inc_el.getAttribute("name"); if (name != null) { includesList.add(name); } else { parseError( inc_el, "missing \"name\" attribute for <include> in <updatecheck>"); } } } ArrayList excludesList = new ArrayList(); Vector excludesElementList = f.getChildrenNamed("exclude"); if (excludesElementList != null) { Iterator exclude_it = excludesElementList.iterator(); while (exclude_it.hasNext()) { XMLElement excl_el = (XMLElement) exclude_it.next(); String name = excl_el.getAttribute("name"); if (name != null) { excludesList.add(name); } else { parseError( excl_el, "missing \"name\" attribute for <exclude> in <updatecheck>"); } } } pack.updatechecks.add( new UpdateCheck(includesList, excludesList, casesensitive)); } // We add the pack packs.add(pack); } if (packs.isEmpty()) parseError(root, "<packs> requires a <pack>"); // We return the ArrayList return packs; } | 3,241,944 |
protected Properties getVariables(XMLElement data) throws Exception { this.varMap = new VariableValueMapImpl(); Properties retVal = null; // We get the varible list XMLElement root = data.getFirstChildNamed("variables"); if (root == null) return retVal; retVal = new Properties(); Iterator iter = root.getChildrenNamed("variable").iterator(); while (iter.hasNext()) { XMLElement var = (XMLElement) iter.next(); retVal.setProperty( requireAttribute(var, "name"), requireAttribute(var, "value")); varMap.setVariable( requireAttribute(var, "name"), requireAttribute(var, "value")); } return retVal; } | protected Properties getVariables(XMLElement data) throws Exception { this.varMap = new VariableValueMapImpl(); Properties retVal = null; // We get the varible list XMLElement root = data.getFirstChildNamed("variables"); if (root == null) return retVal; retVal = new Properties(); Iterator iter = root.getChildrenNamed("variable").iterator(); while (iter.hasNext()) { XMLElement var = (XMLElement) iter.next(); retVal.setProperty( requireAttribute(var, "name"), requireAttribute(var, "value")); varMap.setVariable( requireAttribute(var, "name"), requireAttribute(var, "value")); } return retVal; } | 3,241,945 |
protected Properties getVariables(XMLElement data) throws Exception { this.varMap = new VariableValueMapImpl(); Properties retVal = null; // We get the varible list XMLElement root = data.getFirstChildNamed("variables"); if (root == null) return retVal; retVal = new Properties(); Iterator iter = root.getChildrenNamed("variable").iterator(); while (iter.hasNext()) { XMLElement var = (XMLElement) iter.next(); retVal.setProperty( requireAttribute(var, "name"), requireAttribute(var, "value")); varMap.setVariable( requireAttribute(var, "name"), requireAttribute(var, "value")); } return retVal; } | protected Properties getVariables(XMLElement data) throws Exception { this.varMap = new VariableValueMapImpl(); Properties retVal = null; // We get the varible list XMLElement root = data.getFirstChildNamed("variables"); if (root == null) return retVal; Iterator iter = root.getChildrenNamed("variable").iterator(); while (iter.hasNext()) { XMLElement var = (XMLElement) iter.next(); retVal.setProperty( requireAttribute(var, "name"), requireAttribute(var, "value")); varMap.setVariable( requireAttribute(var, "name"), requireAttribute(var, "value")); } return retVal; } | 3,241,946 |
protected Properties getVariables(XMLElement data) throws Exception { this.varMap = new VariableValueMapImpl(); Properties retVal = null; // We get the varible list XMLElement root = data.getFirstChildNamed("variables"); if (root == null) return retVal; retVal = new Properties(); Iterator iter = root.getChildrenNamed("variable").iterator(); while (iter.hasNext()) { XMLElement var = (XMLElement) iter.next(); retVal.setProperty( requireAttribute(var, "name"), requireAttribute(var, "value")); varMap.setVariable( requireAttribute(var, "name"), requireAttribute(var, "value")); } return retVal; } | protected Properties getVariables(XMLElement data) throws Exception { this.varMap = new VariableValueMapImpl(); Properties retVal = null; // We get the varible list XMLElement root = data.getFirstChildNamed("variables"); if (root == null) return retVal; retVal = new Properties(); Iterator iter = root.getChildrenNamed("variable").iterator(); while (iter.hasNext()) { XMLElement var = (XMLElement) iter.next(); retVal.setProperty( requireAttribute(var, "name"), requireAttribute(var, "value")); varMap.setVariable( requireAttribute(var, "name"), requireAttribute(var, "value")); } return retVal; } | 3,241,947 |
public void run() { while(!_cancelled) { long sleeptime = 0L; synchronized(GenericKeyedObjectPool.this) { sleeptime = _timeBetweenEvictionRunsMillis; } try { Thread.sleep(sleeptime); } catch(Exception e) { ; // ignored } //Evict from the pool try { evict(); } catch(Exception e) { ; // ignored } //Re-create the connections. try { ensureMinIdle(); } catch (Exception e) { ; // ignored } } } | public void run() { while(!_cancelled) { long sleeptime = 0L; synchronized(GenericKeyedObjectPool.this) { sleeptime = _timeBetweenEvictionRunsMillis; } try { Thread.sleep(sleeptime); } catch(Exception e) { ; // ignored } //Evict from the pool try { evict(); } catch(Exception e) { ; // ignored } //Re-create the connections. try { ensureMinIdle(); } catch (Exception e) { ; // ignored } } } | 3,241,949 |
private int calculateDefecit(Object key) { int objectDefecit = 0; //Calculate no of objects needed to be created, in order to have //the number of pooled objects < maxActive(); objectDefecit = getMinIdle() - getNumIdle(key); if (getMaxActive() > 0) { int growLimit = Math.max(0, getMaxActive() - getNumActive(key) - getNumIdle(key)); objectDefecit = Math.min(objectDefecit, growLimit); } // Take the maxTotal limit into account if (getMaxTotal() > 0) { int growLimit = Math.max(0, getMaxTotal() - getNumActive() - getNumIdle()); objectDefecit = Math.min(objectDefecit, growLimit); } return objectDefecit; } | private int calculateDefecit(Object key) { int objectDefecit = 0; //Calculate no of objects needed to be created, in order to have //the number of pooled objects < maxActive(); objectDefecit = getMinIdle() - getNumIdle(key); if (getMaxActive() > 0) { int growLimit = Math.max(0, getMaxActive() - getNumActive(key) - getNumIdle(key)); objectDefecit = Math.min(objectDefecit, growLimit); } // Take the maxTotal limit into account if (getMaxTotal() > 0) { int growLimit = Math.max(0, getMaxTotal() - getNumActive() - getNumIdle()); objectDefecit = Math.min(objectDefecit, growLimit); } return objectDefecit; } | 3,241,950 |
private int calculateDefecit(Object key) { int objectDefecit = 0; //Calculate no of objects needed to be created, in order to have //the number of pooled objects < maxActive(); objectDefecit = getMinIdle() - getNumIdle(key); if (getMaxActive() > 0) { int growLimit = Math.max(0, getMaxActive() - getNumActive(key) - getNumIdle(key)); objectDefecit = Math.min(objectDefecit, growLimit); } // Take the maxTotal limit into account if (getMaxTotal() > 0) { int growLimit = Math.max(0, getMaxTotal() - getNumActive() - getNumIdle()); objectDefecit = Math.min(objectDefecit, growLimit); } return objectDefecit; } | private int calculateDefecit(Object key) { int objectDefecit = 0; //Calculate no of objects needed to be created, in order to have //the number of pooled objects < maxActive(); objectDefecit = getMinIdle() - getNumIdle(key); if (getMaxActive() > 0) { int growLimit = Math.max(0, getMaxActive() - getNumActive(key) - getNumIdle(key)); objectDefecit = Math.min(objectDefecit, growLimit); } // Take the maxTotal limit into account if (getMaxTotal() > 0) { int growLimit = Math.max(0, getMaxTotal() - getNumActive() - getNumIdle()); objectDefecit = Math.min(objectDefecit, growLimit); } return objectDefecit; } | 3,241,951 |
public synchronized void clearOldest() { // build sorted map of idle objects TreeMap map = new TreeMap(); for (Iterator keyiter = _poolMap.keySet().iterator(); keyiter.hasNext();) { Object key = keyiter.next(); LinkedList list = (LinkedList) _poolMap.get(key); for (Iterator it = list.iterator(); it.hasNext();) { // each item into the map uses the objectimestamppair object // as the key. It then gets sorted based on the timstamp field // each value in the map is the parent list it belongs in. ObjectTimestampPair pair = (ObjectTimestampPair) it.next(); map.put(pair, key); } } // Now iterate created map and kill the first 15% plus one to account for zero Set setPairKeys = map.entrySet(); int itemsToRemove = ((int) (map.size() * 0.15)) + 1; Iterator iter = setPairKeys.iterator(); while (iter.hasNext() && itemsToRemove > 0) { Map.Entry entry = (Map.Entry) iter.next(); // kind of backwards on naming. In the map, each key is the objecttimestamppair // because it has the ordering with the timestamp value. Each value that the // key references is the key of the list it belongs to. Object key = entry.getValue(); ObjectTimestampPair pairTimeStamp = (ObjectTimestampPair) entry.getKey(); LinkedList list = (LinkedList) _poolMap.get(key); list.remove(pairTimeStamp); try { _factory.destroyObject(key, pairTimeStamp.value); } catch (Exception e) { // ignore error, keep destroying the rest } // if that was the last object for that key, drop that pool if (list.isEmpty()) { _poolMap.remove(key); } _totalIdle--; itemsToRemove--; } notifyAll(); } | public synchronized void clearOldest() { // build sorted map of idle objects TreeMap map = new TreeMap(); for (Iterator keyiter = _poolMap.keySet().iterator(); keyiter.hasNext();) { Object key = keyiter.next(); LinkedList list = (LinkedList) _poolMap.get(key); for (Iterator it = list.iterator(); it.hasNext();) { // each item into the map uses the objectimestamppair object // as the key. It then gets sorted based on the timstamp field // each value in the map is the parent list it belongs in. ObjectTimestampPair pair = (ObjectTimestampPair) it.next(); map.put(pair, key); } } // Now iterate created map and kill the first 15% plus one to account for zero Set setPairKeys = map.entrySet(); int itemsToRemove = ((int) (map.size() * 0.15)) + 1; Iterator iter = setPairKeys.iterator(); while (iter.hasNext() && itemsToRemove > 0) { Map.Entry entry = (Map.Entry) iter.next(); // kind of backwards on naming. In the map, each key is the objecttimestamppair // because it has the ordering with the timestamp value. Each value that the // key references is the key of the list it belongs to. Object key = entry.getValue(); ObjectTimestampPair pairTimeStamp = (ObjectTimestampPair) entry.getKey(); LinkedList list = (LinkedList) _poolMap.get(key); list.remove(pairTimeStamp); try { _factory.destroyObject(key, pairTimeStamp.value); } catch (Exception e) { // ignore error, keep destroying the rest } // if that was the last object for that key, drop that pool if (list.isEmpty()) { _poolMap.remove(key); } _totalIdle--; itemsToRemove--; } notifyAll(); } | 3,241,952 |
public synchronized void clearOldest() { // build sorted map of idle objects TreeMap map = new TreeMap(); for (Iterator keyiter = _poolMap.keySet().iterator(); keyiter.hasNext();) { Object key = keyiter.next(); LinkedList list = (LinkedList) _poolMap.get(key); for (Iterator it = list.iterator(); it.hasNext();) { // each item into the map uses the objectimestamppair object // as the key. It then gets sorted based on the timstamp field // each value in the map is the parent list it belongs in. ObjectTimestampPair pair = (ObjectTimestampPair) it.next(); map.put(pair, key); } } // Now iterate created map and kill the first 15% plus one to account for zero Set setPairKeys = map.entrySet(); int itemsToRemove = ((int) (map.size() * 0.15)) + 1; Iterator iter = setPairKeys.iterator(); while (iter.hasNext() && itemsToRemove > 0) { Map.Entry entry = (Map.Entry) iter.next(); // kind of backwards on naming. In the map, each key is the objecttimestamppair // because it has the ordering with the timestamp value. Each value that the // key references is the key of the list it belongs to. Object key = entry.getValue(); ObjectTimestampPair pairTimeStamp = (ObjectTimestampPair) entry.getKey(); LinkedList list = (LinkedList) _poolMap.get(key); list.remove(pairTimeStamp); try { _factory.destroyObject(key, pairTimeStamp.value); } catch (Exception e) { // ignore error, keep destroying the rest } // if that was the last object for that key, drop that pool if (list.isEmpty()) { _poolMap.remove(key); } _totalIdle--; itemsToRemove--; } notifyAll(); } | public synchronized void clearOldest() { // build sorted map of idle objects TreeMap map = new TreeMap(); for (Iterator keyiter = _poolMap.keySet().iterator(); keyiter.hasNext();) { Object key = keyiter.next(); LinkedList list = (LinkedList) _poolMap.get(key); for (Iterator it = list.iterator(); it.hasNext();) { // each item into the map uses the objectimestamppair object // as the key. It then gets sorted based on the timstamp field // each value in the map is the parent list it belongs in. ObjectTimestampPair pair = (ObjectTimestampPair) it.next(); map.put(pair, key); } } // Now iterate created map and kill the first 15% plus one to account for zero Set setPairKeys = map.entrySet(); int itemsToRemove = ((int) (map.size() * 0.15)) + 1; Iterator iter = setPairKeys.iterator(); while (iter.hasNext() && itemsToRemove > 0) { Map.Entry entry = (Map.Entry) iter.next(); // kind of backwards on naming. In the map, each key is the objecttimestamppair // because it has the ordering with the timestamp value. Each value that the // key references is the key of the list it belongs to. Object key = entry.getValue(); ObjectTimestampPair pairTimeStamp = (ObjectTimestampPair) entry.getKey(); LinkedList list = (LinkedList) _poolMap.get(key); list.remove(pairTimeStamp); try { _factory.destroyObject(key, pairTimeStamp.value); } catch (Exception e) { // ignore error, keep destroying the rest } // if that was the last object for that key, drop that pool if (list.isEmpty()) { _poolMap.remove(key); } _totalIdle--; itemsToRemove--; } notifyAll(); } | 3,241,953 |
private synchronized void ensureMinIdle() throws Exception { Iterator iterator = _poolMap.keySet().iterator(); //Check if should sustain the pool if (_minIdle > 0) { // Loop through all elements in _poolList // Find out the total number of max active and max idle for that class // If the number is less than the minIdle, do creation loop to boost numbers // Increment idle count + 1 while (iterator.hasNext()) { //Get the next key to process Object key = iterator.next(); ensureMinIdle(key); } } } | private synchronized void ensureMinIdle() throws Exception { Iterator iterator = _poolMap.keySet().iterator(); //Check if should sustain the pool if (_minIdle > 0) { // Loop through all elements in _poolList // Find out the total number of max active and max idle for that class // If the number is less than the minIdle, do creation loop to boost numbers // Increment idle count + 1 while (iterator.hasNext()) { //Get the next key to process Object key = iterator.next(); ensureMinIdle(key); } } } | 3,241,954 |
public synchronized void evict() throws Exception { Object key = null; if (_recentlyEvictedKeys == null) { _recentlyEvictedKeys = new HashSet(_poolMap.size()); } Set remainingKeys = new HashSet(_poolMap.keySet()); remainingKeys.removeAll(_recentlyEvictedKeys); Iterator keyIter = remainingKeys.iterator(); ListIterator objIter = null; for(int i=0,m=getNumTests();i<m;i++) { if(_poolMap.size() > 0) { // Find next idle object pool key to work on if (key == null) { if (!keyIter.hasNext()) { _recentlyEvictedKeys.clear(); remainingKeys = new HashSet(_poolMap.keySet()); keyIter = remainingKeys.iterator(); } if (!keyIter.hasNext()) { // done, there are no keyed pools return; } key = keyIter.next(); } // if we don't have a keyed object pool iterator if (objIter == null) { final LinkedList list = (LinkedList)_poolMap.get(key); if (_evictLastIndex < 0 || _evictLastIndex > list.size()) { _evictLastIndex = list.size(); } objIter = list.listIterator(_evictLastIndex); } // if the _evictionCursor has a previous object, then test it if(objIter.hasPrevious()) { ObjectTimestampPair pair = (ObjectTimestampPair)(objIter.previous()); boolean removeObject=false; if(_minEvictableIdleTimeMillis > 0 && System.currentTimeMillis() - pair.tstamp > _minEvictableIdleTimeMillis) { removeObject=true; } if(_testWhileIdle && removeObject == false) { boolean active = false; try { _factory.activateObject(key,pair.value); active = true; } catch(Exception e) { removeObject=true; } if(active) { if(!_factory.validateObject(key,pair.value)) { removeObject=true; } else { try { _factory.passivateObject(key,pair.value); } catch(Exception e) { removeObject=true; } } } } if(removeObject) { try { objIter.remove(); _totalIdle--; _factory.destroyObject(key,pair.value); // Do not remove the key from the _poolList or _poolmap, even if the list // stored in the _poolMap for this key is empty when the // {@link #getMinIdle <i>minIdle</i>} is > 0. // // Otherwise if it was the last object for that key, drop that pool if ((_minIdle == 0) && (((LinkedList)(_poolMap.get(key))).isEmpty())) { _poolMap.remove(key); } } catch(Exception e) { ; // ignored } } } else { // else done evicting keyed pool _recentlyEvictedKeys.add(key); _evictLastIndex = -1; objIter = null; } } } } | public synchronized void evict() throws Exception { Object key = null; if (_recentlyEvictedKeys == null) { _recentlyEvictedKeys = new HashSet(_poolMap.size()); } Set remainingKeys = new HashSet(_poolMap.keySet()); remainingKeys.removeAll(_recentlyEvictedKeys); Iterator keyIter = remainingKeys.iterator(); ListIterator objIter = null; for(int i=0,m=getNumTests();i<m;i++) { if(_poolMap.size() > 0) { // Find next idle object pool key to work on if (key == null) { if (!keyIter.hasNext()) { _recentlyEvictedKeys.clear(); remainingKeys = new HashSet(_poolMap.keySet()); keyIter = remainingKeys.iterator(); } if (!keyIter.hasNext()) { // done, there are no keyed pools return; } key = keyIter.next(); } // if we don't have a keyed object pool iterator if (objIter == null) { final LinkedList list = (LinkedList)_poolMap.get(key); if (_evictLastIndex < 0 || _evictLastIndex > list.size()) { _evictLastIndex = list.size(); } objIter = list.listIterator(_evictLastIndex); } // if the _evictionCursor has a previous object, then test it if(objIter.hasPrevious()) { ObjectTimestampPair pair = (ObjectTimestampPair)(objIter.previous()); boolean removeObject=false; if(_minEvictableIdleTimeMillis > 0 && System.currentTimeMillis() - pair.tstamp > _minEvictableIdleTimeMillis) { removeObject=true; } if(_testWhileIdle && removeObject == false) { boolean active = false; try { _factory.activateObject(key,pair.value); active = true; } catch(Exception e) { removeObject=true; } if(active) { if(!_factory.validateObject(key,pair.value)) { removeObject=true; } else { try { _factory.passivateObject(key,pair.value); } catch(Exception e) { removeObject=true; } } } } if(removeObject) { try { objIter.remove(); _totalIdle--; _factory.destroyObject(key,pair.value); // Do not remove the key from the _poolList or _poolmap, even if the list // stored in the _poolMap for this key is empty when the // {@link #getMinIdle <i>minIdle</i>} is > 0. // // Otherwise if it was the last object for that key, drop that pool if ((_minIdle == 0) && (((LinkedList)(_poolMap.get(key))).isEmpty())) { _poolMap.remove(key); } } catch(Exception e) { ; // ignored } } } else { // else done evicting keyed pool _recentlyEvictedKeys.add(key); _evictLastIndex = -1; objIter = null; } } } } | 3,241,955 |
public synchronized void evict() throws Exception { Object key = null; if (_recentlyEvictedKeys == null) { _recentlyEvictedKeys = new HashSet(_poolMap.size()); } Set remainingKeys = new HashSet(_poolMap.keySet()); remainingKeys.removeAll(_recentlyEvictedKeys); Iterator keyIter = remainingKeys.iterator(); ListIterator objIter = null; for(int i=0,m=getNumTests();i<m;i++) { if(_poolMap.size() > 0) { // Find next idle object pool key to work on if (key == null) { if (!keyIter.hasNext()) { _recentlyEvictedKeys.clear(); remainingKeys = new HashSet(_poolMap.keySet()); keyIter = remainingKeys.iterator(); } if (!keyIter.hasNext()) { // done, there are no keyed pools return; } key = keyIter.next(); } // if we don't have a keyed object pool iterator if (objIter == null) { final LinkedList list = (LinkedList)_poolMap.get(key); if (_evictLastIndex < 0 || _evictLastIndex > list.size()) { _evictLastIndex = list.size(); } objIter = list.listIterator(_evictLastIndex); } // if the _evictionCursor has a previous object, then test it if(objIter.hasPrevious()) { ObjectTimestampPair pair = (ObjectTimestampPair)(objIter.previous()); boolean removeObject=false; if(_minEvictableIdleTimeMillis > 0 && System.currentTimeMillis() - pair.tstamp > _minEvictableIdleTimeMillis) { removeObject=true; } if(_testWhileIdle && removeObject == false) { boolean active = false; try { _factory.activateObject(key,pair.value); active = true; } catch(Exception e) { removeObject=true; } if(active) { if(!_factory.validateObject(key,pair.value)) { removeObject=true; } else { try { _factory.passivateObject(key,pair.value); } catch(Exception e) { removeObject=true; } } } } if(removeObject) { try { objIter.remove(); _totalIdle--; _factory.destroyObject(key,pair.value); // Do not remove the key from the _poolList or _poolmap, even if the list // stored in the _poolMap for this key is empty when the // {@link #getMinIdle <i>minIdle</i>} is > 0. // // Otherwise if it was the last object for that key, drop that pool if ((_minIdle == 0) && (((LinkedList)(_poolMap.get(key))).isEmpty())) { _poolMap.remove(key); } } catch(Exception e) { ; // ignored } } } else { // else done evicting keyed pool _recentlyEvictedKeys.add(key); _evictLastIndex = -1; objIter = null; } } } } | public synchronized void evict() throws Exception { Object key = null; if (_recentlyEvictedKeys == null) { _recentlyEvictedKeys = new HashSet(_poolMap.size()); } Set remainingKeys = new HashSet(_poolMap.keySet()); remainingKeys.removeAll(_recentlyEvictedKeys); Iterator keyIter = remainingKeys.iterator(); ListIterator objIter = null; for(int i=0,m=getNumTests();i<m;i++) { if(_poolMap.size() > 0) { // Find next idle object pool key to work on if (key == null) { if (!keyIter.hasNext()) { _recentlyEvictedKeys.clear(); remainingKeys = new HashSet(_poolMap.keySet()); keyIter = remainingKeys.iterator(); } if (!keyIter.hasNext()) { // done, there are no keyed pools return; } key = keyIter.next(); } // if we don't have a keyed object pool iterator if (objIter == null) { final LinkedList list = (LinkedList)_poolMap.get(key); if (_evictLastIndex < 0 || _evictLastIndex > list.size()) { _evictLastIndex = list.size(); } objIter = list.listIterator(_evictLastIndex); } // if the _evictionCursor has a previous object, then test it if(objIter.hasPrevious()) { ObjectTimestampPair pair = (ObjectTimestampPair)(objIter.previous()); boolean removeObject=false; if(_minEvictableIdleTimeMillis > 0 && System.currentTimeMillis() - pair.tstamp > _minEvictableIdleTimeMillis) { removeObject=true; } if(_testWhileIdle && removeObject == false) { boolean active = false; try { _factory.activateObject(key,pair.value); active = true; } catch(Exception e) { removeObject=true; } if(active) { if(!_factory.validateObject(key,pair.value)) { removeObject=true; } else { try { _factory.passivateObject(key,pair.value); } catch(Exception e) { removeObject=true; } } } } if(removeObject) { try { objIter.remove(); _totalIdle--; _factory.destroyObject(key,pair.value); // Do not remove the key from the _poolList or _poolmap, even if the list // stored in the _poolMap for this key is empty when the // {@link #getMinIdle <i>minIdle</i>} is > 0. // // Otherwise if it was the last object for that key, drop that pool if ((_minIdle == 0) && (((LinkedList)(_poolMap.get(key))).isEmpty())) { _poolMap.remove(key); } } catch(Exception e) { ; // ignored } } } else { // else done evicting keyed pool _recentlyEvictedKeys.add(key); _evictLastIndex = -1; objIter = null; } } } } | 3,241,956 |
protected synchronized void startEvictor(long delay) { if(null != _evictor) { _evictor.cancel(); _evictor = null; } if(delay > 0) { _evictor = new Evictor(delay); Thread t = new Thread(_evictor); t.setDaemon(true); t.start(); } } | protected synchronized void startEvictor(long delay) { if(null != _evictor) { _evictor.cancel(); _evictor = null; } if(delay > 0) { _evictor = new Evictor(delay); Thread t = new Thread(_evictor); t.setDaemon(true); t.start(); } } | 3,241,957 |
public char read() throws IOException { int ch = this.currentPbReader.read(); while (ch < 0) { if (this.pbreaders.empty()) { throw new IOException("Unexpected EOF"); } this.currentPbReader.close(); this.currentPbReader = (PushbackReader) this.pbreaders.pop(); this.currentLineReader = (LineNumberReader) this.linereaders.pop(); this.currentSystemID = (URL) this.systemIds.pop(); this.currentPublicID = (String) this.publicIds.pop(); ch = this.currentPbReader.read(); } if (ch == 0x0D) { // CR ch = this.read(); if (ch != 0x0A) { this.currentPbReader.unread(ch); return (char) 0x0A; } } return (char) ch; } | public char read() throws IOException { int ch = this.currentPbReader.read(); while (ch < 0) { if (this.pbreaders.empty()) { throw new IOException("Unexpected EOF"); } this.currentPbReader.close(); this.currentPbReader = (PushbackReader) this.pbreaders.pop(); this.currentLineReader = (LineNumberReader) this.linereaders.pop(); this.currentSystemID = (URL) this.systemIds.pop(); this.currentPublicID = (String) this.publicIds.pop(); ch = this.currentPbReader.read(); } if (ch == 0x0D) { // CR ch = this.read(); if (ch != 0x0A) { this.currentPbReader.unread(ch); return (char) 0x0A; } } return (char) ch; } | 3,241,958 |
public char read() throws IOException { int ch = this.currentPbReader.read(); while (ch < 0) { if (this.pbreaders.empty()) { throw new IOException("Unexpected EOF"); } this.currentPbReader.close(); this.currentPbReader = (PushbackReader) this.pbreaders.pop(); this.currentLineReader = (LineNumberReader) this.linereaders.pop(); this.currentSystemID = (URL) this.systemIds.pop(); this.currentPublicID = (String) this.publicIds.pop(); ch = this.currentPbReader.read(); } if (ch == 0x0D) { // CR ch = this.read(); if (ch != 0x0A) { this.currentPbReader.unread(ch); return (char) 0x0A; } } return (char) ch; } | public char read() throws IOException { int ch = this.currentPbReader.read(); while (ch < 0) { if (this.pbreaders.empty()) { throw new IOException("Unexpected EOF"); } this.currentPbReader.close(); this.currentPbReader = (PushbackReader) this.pbreaders.pop(); this.currentLineReader = (LineNumberReader) this.linereaders.pop(); this.currentSystemID = (URL) this.systemIds.pop(); this.currentPublicID = (String) this.publicIds.pop(); ch = this.currentPbReader.read(); } if (ch == 0x0D) { // CR ch = this.read(); if (ch != 0x0A) { this.currentPbReader.unread(ch); } } return (char) ch; } | 3,241,959 |
public static String getOsDetails() { StringBuffer result = new StringBuffer(); result.append( "OS_NAME=" + OS_NAME + NL ); if( IS_UNIX ) { if( IS_LINUX ) { result.append( getLinuxDistribution() + NL ); } else { try { result.append( FileUtil.getFileContent( getReleaseFileName() ) + NL ); } catch (IOException e) { // TODO handle or ignore } } } if( IS_WINDOWS ) { result.append( System.getProperty( OSNAME ) + SP + System.getProperty( "sun.os.patch.level", "" ) + NL ); } return result.toString(); } | public static String getOsDetails() { StringBuffer result = new StringBuffer(); result.append("OS_NAME=").append(OS_NAME).append(NL); if( IS_UNIX ) { if( IS_LINUX ) { result.append( getLinuxDistribution() + NL ); } else { try { result.append( FileUtil.getFileContent( getReleaseFileName() ) + NL ); } catch (IOException e) { // TODO handle or ignore } } } if( IS_WINDOWS ) { result.append( System.getProperty( OSNAME ) + SP + System.getProperty( "sun.os.patch.level", "" ) + NL ); } return result.toString(); } | 3,241,961 |
public static String getOsDetails() { StringBuffer result = new StringBuffer(); result.append( "OS_NAME=" + OS_NAME + NL ); if( IS_UNIX ) { if( IS_LINUX ) { result.append( getLinuxDistribution() + NL ); } else { try { result.append( FileUtil.getFileContent( getReleaseFileName() ) + NL ); } catch (IOException e) { // TODO handle or ignore } } } if( IS_WINDOWS ) { result.append( System.getProperty( OSNAME ) + SP + System.getProperty( "sun.os.patch.level", "" ) + NL ); } return result.toString(); } | public static String getOsDetails() { StringBuffer result = new StringBuffer(); result.append( "OS_NAME=" + OS_NAME + NL ); if( IS_UNIX ) { if( IS_LINUX ) { result.append(getLinuxDistribution()).append(NL); } else { try { result.append( FileUtil.getFileContent( getReleaseFileName() ) + NL ); } catch (IOException e) { // TODO handle or ignore } } } if( IS_WINDOWS ) { result.append( System.getProperty( OSNAME ) + SP + System.getProperty( "sun.os.patch.level", "" ) + NL ); } return result.toString(); } | 3,241,962 |
public static String getOsDetails() { StringBuffer result = new StringBuffer(); result.append( "OS_NAME=" + OS_NAME + NL ); if( IS_UNIX ) { if( IS_LINUX ) { result.append( getLinuxDistribution() + NL ); } else { try { result.append( FileUtil.getFileContent( getReleaseFileName() ) + NL ); } catch (IOException e) { // TODO handle or ignore } } } if( IS_WINDOWS ) { result.append( System.getProperty( OSNAME ) + SP + System.getProperty( "sun.os.patch.level", "" ) + NL ); } return result.toString(); } | public static String getOsDetails() { StringBuffer result = new StringBuffer(); result.append( "OS_NAME=" + OS_NAME + NL ); if( IS_UNIX ) { if( IS_LINUX ) { result.append( getLinuxDistribution() + NL ); } else { try { result.append(FileUtil.getFileContent(getReleaseFileName())).append(NL); } catch (IOException e) { // TODO handle or ignore } } } if( IS_WINDOWS ) { result.append( System.getProperty( OSNAME ) + SP + System.getProperty( "sun.os.patch.level", "" ) + NL ); } return result.toString(); } | 3,241,963 |
public static String getOsDetails() { StringBuffer result = new StringBuffer(); result.append( "OS_NAME=" + OS_NAME + NL ); if( IS_UNIX ) { if( IS_LINUX ) { result.append( getLinuxDistribution() + NL ); } else { try { result.append( FileUtil.getFileContent( getReleaseFileName() ) + NL ); } catch (IOException e) { // TODO handle or ignore } } } if( IS_WINDOWS ) { result.append( System.getProperty( OSNAME ) + SP + System.getProperty( "sun.os.patch.level", "" ) + NL ); } return result.toString(); } | public static String getOsDetails() { StringBuffer result = new StringBuffer(); result.append( "OS_NAME=" + OS_NAME + NL ); if( IS_UNIX ) { if( IS_LINUX ) { result.append( getLinuxDistribution() + NL ); } else { try { result.append( FileUtil.getFileContent( getReleaseFileName() ) + NL ); } catch (IOException e) { // TODO handle or ignore } } } if( IS_WINDOWS ) { result.append( System.getProperty( OSNAME ) + SP + System.getProperty( "sun.os.patch.level", "" ) + NL ); } return result.toString(); } | 3,241,964 |
private static String getReleaseFileName() { String result = new String(); File[] etcList = new File("/etc").listFiles(); if( etcList != null ) for (int idx = 0; idx < etcList.length; idx++) { File etcEntry = etcList[idx]; if (etcEntry.isFile()) { if (etcEntry.getName().endsWith("-release")) { //match :-) return result = etcEntry.toString(); } } } return result; } | private static String getReleaseFileName() { String result = ""; File[] etcList = new File("/etc").listFiles(); if( etcList != null ) for (int idx = 0; idx < etcList.length; idx++) { File etcEntry = etcList[idx]; if (etcEntry.isFile()) { if (etcEntry.getName().endsWith("-release")) { //match :-) return result = etcEntry.toString(); } } } return result; } | 3,241,965 |
Subsets and Splits