rem
stringlengths
0
477k
add
stringlengths
0
313k
context
stringlengths
6
599k
meta
stringlengths
141
403
public void run() { if(isDisposed()) { return; } m_testIsRunning = false;// updateProgressBar(m_progressBar.getSelection() + 1, false); if(hasErrors()) { fNextAction.setEnabled(true); fPrevAction.setEnabled(true); } }
53349 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/53349/939c2626f5ef7c6550d3a506ac6dd14b7667f498/TestRunnerViewPart.java/buggy/src/main/org/testng/eclipse/ui/TestRunnerViewPart.java
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()); }
53349 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/53349/939c2626f5ef7c6550d3a506ac6dd14b7667f498/TestRunnerViewPart.java/buggy/src/main/org/testng/eclipse/ui/TestRunnerViewPart.java
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(); } }
53349 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/53349/939c2626f5ef7c6550d3a506ac6dd14b7667f498/TestRunnerViewPart.java/buggy/src/main/org/testng/eclipse/ui/TestRunnerViewPart.java
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); }
53349 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/53349/939c2626f5ef7c6550d3a506ac6dd14b7667f498/TestRunnerViewPart.java/buggy/src/main/org/testng/eclipse/ui/TestRunnerViewPart.java
protected void selectFirstFailure() {// OldTestRunInfo firstFailure = (OldTestRunInfo) fFailures.get(0);// if((firstFailure != null) && (m_activeRunTab.getSelectedTestId() == null)) {// m_activeRunTab.setSelectedTest(firstFailure.getTestId());// handleTestSelected(firstFailure.getTestId());// } }
53349 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/53349/939c2626f5ef7c6550d3a506ac6dd14b7667f498/TestRunnerViewPart.java/buggy/src/main/org/testng/eclipse/ui/TestRunnerViewPart.java
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); }
53349 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/53349/939c2626f5ef7c6550d3a506ac6dd14b7667f498/TestRunnerViewPart.java/buggy/src/main/org/testng/eclipse/ui/TestRunnerViewPart.java
String key = osName.replace (' ', '_');
String key = osName.replace (' ', '_');
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); }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/80e14fc27a7fb67b4c5101aace4a3e9167e551e3/TargetFactory.java/buggy/src/lib/com/izforge/izpack/util/TargetFactory.java
input = getClass ().getResourceAsStream (key);
input = getClass ().getResourceAsStream (key);
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); }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/80e14fc27a7fb67b4c5101aace4a3e9167e551e3/TargetFactory.java/buggy/src/lib/com/izforge/izpack/util/TargetFactory.java
InputStreamReader streamReader = null;
InputStreamReader streamReader = null;
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); }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/80e14fc27a7fb67b4c5101aace4a3e9167e551e3/TargetFactory.java/buggy/src/lib/com/izforge/izpack/util/TargetFactory.java
streamReader = new InputStreamReader (input);
streamReader = new InputStreamReader (input);
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); }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/80e14fc27a7fb67b4c5101aace4a3e9167e551e3/TargetFactory.java/buggy/src/lib/com/izforge/izpack/util/TargetFactory.java
line = line.trim (); if (!line.equals (""))
line = line.trim (); if (!line.equals (""))
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); }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/80e14fc27a7fb67b4c5101aace4a3e9167e551e3/TargetFactory.java/buggy/src/lib/com/izforge/izpack/util/TargetFactory.java
}
}
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); }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/80e14fc27a7fb67b4c5101aace4a3e9167e551e3/TargetFactory.java/buggy/src/lib/com/izforge/izpack/util/TargetFactory.java
_graph = parseFile( _graphmlFileName );
_graphList.add( parseFile( _graphmlFileName ) );
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" ); } }
54457 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54457/1c40fdf74f5a59382009b042fdf38791cad4db11/ModelBasedTesting.java/clean/mbt/src/org/tigris/mbt/ModelBasedTesting.java
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" ); } }
54457 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54457/1c40fdf74f5a59382009b042fdf38791cad4db11/ModelBasedTesting.java/clean/mbt/src/org/tigris/mbt/ModelBasedTesting.java
analyseSubGraphs();
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" ); } }
54457 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54457/1c40fdf74f5a59382009b042fdf38791cad4db11/ModelBasedTesting.java/clean/mbt/src/org/tigris/mbt/ModelBasedTesting.java
analyseSubGraphs();
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" ); } }
54457 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54457/1c40fdf74f5a59382009b042fdf38791cad4db11/ModelBasedTesting.java/clean/mbt/src/org/tigris/mbt/ModelBasedTesting.java
label = new JLabel(" - " + a.getName() + " <" + a.getEmail() + ">",
String email = (a.getEmail() != null) ? (" <" + a.getEmail() + ">") : ""; label = new JLabel(" - " + a.getName() + email,
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); }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/6f40ecd5b1867dc144086f0070c210d4c6e581ec/HelloPanel.java/clean/src/lib/com/izforge/izpack/panels/HelloPanel.java
str = parent.langpack.getString("HelloPanel.url") + idata.info.getAppURL(); appURLLabel = new JLabel(str, parent.icons.getImageIcon("bookmark"), JLabel.TRAILING); centerPanel.add(appURLLabel);
if (idata.info.getAppURL() != null) { 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); }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/6f40ecd5b1867dc144086f0070c210d4c6e581ec/HelloPanel.java/clean/src/lib/com/izforge/izpack/panels/HelloPanel.java
if (!pf.isBackReference())
if (!pf.isBackReference() && !((Pack)packs.get(i)).loose)
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)); } }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/670d2dce35e3033459b7343ab34ed921bd2331ed/Unpacker.java/clean/src/lib/com/izforge/izpack/installer/Unpacker.java
ObjectInputStream pis = objIn;
InputStream pis = objIn;
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)); } }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/670d2dce35e3033459b7343ab34ed921bd2331ed/Unpacker.java/clean/src/lib/com/izforge/izpack/installer/Unpacker.java
int maxBytes = (pf.length() - bytesCopied < buffer.length ? (int) (pf.length() - bytesCopied) : buffer.length);
int maxBytes = (int)Math.min(pf.length() - bytesCopied, buffer.length);
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)); } }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/670d2dce35e3033459b7343ab34ed921bd2331ed/Unpacker.java/clean/src/lib/com/izforge/izpack/installer/Unpacker.java
} else
} else {
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; }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/b15145af6d6f9ba96e23003cbfd73a062ef168be/GUIInstaller.java/buggy/src/lib/com/izforge/izpack/installer/GUIInstaller.java
setForeground(list.getForeground()); setBackground(list.getBackground()); }
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; }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/b15145af6d6f9ba96e23003cbfd73a062ef168be/GUIInstaller.java/buggy/src/lib/com/izforge/izpack/installer/GUIInstaller.java
ImageIcon icon = new ImageIcon(this.getClass().getResource("/res/flag." + iso3));
ImageIcon icon; icon = new ImageIcon(this.getClass().getResource("/res/flag." + iso3));
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; }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/b15145af6d6f9ba96e23003cbfd73a062ef168be/GUIInstaller.java/buggy/src/lib/com/izforge/izpack/installer/GUIInstaller.java
grayIcons.put( iso3, new ImageIcon(GrayFilter.createDisabledImage(icon.getImage())));
icon = new ImageIcon(GrayFilter.createDisabledImage(icon.getImage())); grayIcons.put(iso3, icon);
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; }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/b15145af6d6f9ba96e23003cbfd73a062ef168be/GUIInstaller.java/buggy/src/lib/com/izforge/izpack/installer/GUIInstaller.java
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; } } }
50977 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50977/66db2c7e42d00783cf44264a3119df58c2eaca9c/GenericKeyedObjectPool.java/clean/src/java/org/apache/commons/pool/impl/GenericKeyedObjectPool.java
clear();
clearOldest();
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; } } }
50977 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50977/66db2c7e42d00783cf44264a3119df58c2eaca9c/GenericKeyedObjectPool.java/clean/src/java/org/apache/commons/pool/impl/GenericKeyedObjectPool.java
try { super.clone(); } catch (CloneNotSupportedException e) { e.printStackTrace(); }
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); }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/d11fc845a2a89fc77729603e3e46364815b8de54/ShortcutData.java/buggy/src/lib/com/izforge/izpack/panels/ShortcutData.java
public boolean validateObject(Object obj) { return true; }
public boolean validateObject(Object obj) { return valid; }
public boolean validateObject(Object obj) { return true; }
50977 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50977/feea8a0d3c7e4912fe7929bd4f393db752cfaacf/TestGenericObjectPool.java/clean/src/test/org/apache/commons/pool/impl/TestGenericObjectPool.java
try { result = new String( currentUserLinkPath, "UTF-16" ); } catch (UnsupportedEncodingException e) { e.printStackTrace(); }
result = currentUserLinkPath;
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; }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/de51f6f2bd8a33daaffc3ddf3fa1cb9e0a050e97/ShellLink.java/buggy/src/lib/com/izforge/izpack/util/os/ShellLink.java
try { result = new String(allUsersLinkPath, "UTF-16"); } catch (UnsupportedEncodingException e) { e.printStackTrace(); }
result = allUsersLinkPath;
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; }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/de51f6f2bd8a33daaffc3ddf3fa1cb9e0a050e97/ShellLink.java/buggy/src/lib/com/izforge/izpack/util/os/ShellLink.java
String result = null; try { result = new String(allUsersLinkPath, "UTF-16"); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } return result;
return allUsersLinkPath;
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; }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/de51f6f2bd8a33daaffc3ddf3fa1cb9e0a050e97/ShellLink.java/buggy/src/lib/com/izforge/izpack/util/os/ShellLink.java
String result =null; try { result = new String( currentUserLinkPath, "UTF-16"); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } return result;
return currentUserLinkPath;
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; }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/de51f6f2bd8a33daaffc3ddf3fa1cb9e0a050e97/ShellLink.java/buggy/src/lib/com/izforge/izpack/util/os/ShellLink.java
private void setAllLinkPaths() throws IllegalArgumentException, UnsupportedEncodingException
private void setAllLinkPaths() throws IllegalArgumentException
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.")); } }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/de51f6f2bd8a33daaffc3ddf3fa1cb9e0a050e97/ShellLink.java/buggy/src/lib/com/izforge/izpack/util/os/ShellLink.java
if (userType == CURRENT_USER && new String(currentUserLinkPath, "UTF-16").length() == 0)
if (userType == CURRENT_USER && currentUserLinkPath.length() == 0)
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.")); } }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/de51f6f2bd8a33daaffc3ddf3fa1cb9e0a050e97/ShellLink.java/buggy/src/lib/com/izforge/izpack/util/os/ShellLink.java
else if (userType == ALL_USERS && new String( allUsersLinkPath, "UTF-16").length() == 0)
else if (userType == ALL_USERS && allUsersLinkPath.length() == 0)
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.")); } }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/de51f6f2bd8a33daaffc3ddf3fa1cb9e0a050e97/ShellLink.java/buggy/src/lib/com/izforge/izpack/util/os/ShellLink.java
if ( new String(allUsersLinkPath, "UTF-16").length() == 0 && new String(currentUserLinkPath, "UTF-16").length() == 0) { throw (new IllegalArgumentException(
if ( allUsersLinkPath.length() == 0 && currentUserLinkPath.length() == 0) { throw (new IllegalArgumentException(
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.")); } }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/de51f6f2bd8a33daaffc3ddf3fa1cb9e0a050e97/ShellLink.java/buggy/src/lib/com/izforge/izpack/util/os/ShellLink.java
try {
if (!_pool.empty()) {
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; }
50977 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50977/1507bef69094d633f516cf26fcb94e5e2a6ddb7a/StackObjectPool.java/clean/src/java/org/apache/commons/pool/impl/StackObjectPool.java
} catch(EmptyStackException e) {
} else {
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; }
50977 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50977/1507bef69094d633f516cf26fcb94e5e2a6ddb7a/StackObjectPool.java/clean/src/java/org/apache/commons/pool/impl/StackObjectPool.java
VariableSubstitutor substitutor = new VariableSubstitutor (idata.getVariableValueMap ());
VariableSubstitutor substitutor = new VariableSubstitutor (idata.getVariables());
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; } }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/6822c9086a6716a2c03b2ad638f19542678f38a5/ShortcutPanel.java/clean/src/lib/com/izforge/izpack/panels/ShortcutPanel.java
if ((me.getModifiers() & InputEvent.SHIFT_MASK) == InputEvent.SHIFT_MASK) model.setSelectedDisplay(d, true); else model.setSelectedDisplay(d);
if (!(previousDisplay instanceof ImageNode)) b = false; model.setSelectedDisplay(d, b);
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; }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/445be8ae816c5aaec8bc9161f5886936bea85ea3/BrowserControl.java/clean/SRC/org/openmicroscopy/shoola/agents/hiviewer/browser/BrowserControl.java
packager.setVariables(getVariables(data));
Properties varMap = getVariables(data); packager.setVariables(varMap);
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; }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/6822c9086a6716a2c03b2ad638f19542678f38a5/Compiler.java/clean/src/lib/com/izforge/izpack/compiler/Compiler.java
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; }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/6822c9086a6716a2c03b2ad638f19542678f38a5/Compiler.java/clean/src/lib/com/izforge/izpack/compiler/Compiler.java
boolean keepFile = false;
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; }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/6822c9086a6716a2c03b2ad638f19542678f38a5/Compiler.java/clean/src/lib/com/izforge/izpack/compiler/Compiler.java
if ("true".equalsIgnoreCase(val)) keepFile = true;
boolean keepFile = "true".equalsIgnoreCase(val);
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; }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/6822c9086a6716a2c03b2ad638f19542678f38a5/Compiler.java/clean/src/lib/com/izforge/izpack/compiler/Compiler.java
this.varMap = new VariableValueMapImpl(); Properties retVal = null;
Properties retVal = new Properties();
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; }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/6822c9086a6716a2c03b2ad638f19542678f38a5/Compiler.java/clean/src/lib/com/izforge/izpack/compiler/Compiler.java
retVal = new Properties();
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; }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/6822c9086a6716a2c03b2ad638f19542678f38a5/Compiler.java/clean/src/lib/com/izforge/izpack/compiler/Compiler.java
varMap.setVariable( requireAttribute(var, "name"), requireAttribute(var, "value"));
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; }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/6822c9086a6716a2c03b2ad638f19542678f38a5/Compiler.java/clean/src/lib/com/izforge/izpack/compiler/Compiler.java
String _n = pathFile.getName(); if (_n.startsWith("izpack-keepme") && _n.endsWith(".tmp")) pathFile.delete();
public void run() { instances.add(this); try { listener.startUnpack(); String currentOs = System.getProperty("os.name").toLowerCase(); // // Initialisations FileOutputStream out = null; ArrayList parsables = new ArrayList(); ArrayList executables = new ArrayList(); List packs = idata.selectedPacks; int npacks = packs.size(); udata = UninstallData.getInstance(); // Specific to the web installers if (idata.kind.equalsIgnoreCase("web") || idata.kind.equalsIgnoreCase("web-kunststoff")) { InputStream kin = getClass().getResourceAsStream("/res/WebInstallers.url"); BufferedReader kreader = new BufferedReader(new InputStreamReader(kin)); jarLocation = kreader.readLine(); } // We unpack the selected packs for (int i = 0; i < npacks; i++) { // We get the pack stream int n = idata.availablePacks.indexOf(packs.get(i)); ObjectInputStream objIn = new ObjectInputStream(getPackAsStream(n)); // We unpack the files int nfiles = objIn.readInt(); listener.changeUnpack(0, nfiles, ((Pack) packs.get(i)).name); for (int j = 0; j < nfiles; j++) { // We read the header PackFile pf = (PackFile) objIn.readObject(); if (null == pf.os || currentOs.indexOf(pf.os.toLowerCase()) > -1) { // We translate & build the path String path = translatePath(pf.targetPath); File pathFile = new File(path); String fname = pathFile.getName(); int z = fname.length(); File dest = pathFile.getParentFile(); if (!dest.exists()) dest.mkdirs(); // We add the path to the log, udata.addFile(path); listener.progressUnpack(j, path); //if this file exists and shouldnot override skip this file if (((pf.override == false) && (pathFile.exists()))) { objIn.skip(pf.length); continue; } // We copy the file out = new FileOutputStream(path); byte[] buffer = new byte[5120]; long bytesCopied = 0; while (bytesCopied < pf.length) { int maxBytes = (pf.length - bytesCopied < buffer.length ? (int) (pf.length - bytesCopied) : buffer.length); int bytesInBuffer = objIn.read(buffer, 0, maxBytes); if (bytesInBuffer == -1) throw new IOException("Unexpected end of stream"); out.write(buffer, 0, bytesInBuffer); bytesCopied += bytesInBuffer; } // Cleanings out.close(); } else objIn.skip(pf.length); } // Load information about parsable files int numParsables = objIn.readInt(); int k; for (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 (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); } objIn.close(); } // 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() != 0) javax.swing.JOptionPane.showMessageDialog( null, "The installation was not completed.", "Installation warning", javax.swing.JOptionPane.WARNING_MESSAGE); // We put the uninstaller putUninstaller(); // The end :-) listener.stopUnpack(); } catch (Exception err) { listener.stopUnpack(); listener.errorUnpack(err.toString()); } instances.remove(instances.indexOf(this)); }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/91994653572a3171781f1edfa5a2651f3a9a49fb/Unpacker.java/buggy/src/lib/com/izforge/izpack/installer/Unpacker.java
while(!_cancelled) { long sleeptime = 0L; synchronized(GenericKeyedObjectPool.this) { sleeptime = _timeBetweenEvictionRunsMillis; } try { Thread.sleep(sleeptime); } catch(Exception e) { ; } try { evict(); } catch(Exception e) { ; } try { ensureMinIdle(); } catch (Exception e) { ; }
try { evict(); } catch(Exception e) { } try { ensureMinIdle(); } catch (Exception e) {
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 } } }
50977 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50977/040416e9a1f3dc7bd49171b76ed6a766164e6fed/GenericKeyedObjectPool.java/clean/src/java/org/apache/commons/pool/impl/GenericKeyedObjectPool.java
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; }
50977 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50977/040416e9a1f3dc7bd49171b76ed6a766164e6fed/GenericKeyedObjectPool.java/clean/src/java/org/apache/commons/pool/impl/GenericKeyedObjectPool.java
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; }
50977 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50977/040416e9a1f3dc7bd49171b76ed6a766164e6fed/GenericKeyedObjectPool.java/clean/src/java/org/apache/commons/pool/impl/GenericKeyedObjectPool.java
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(); }
50977 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50977/040416e9a1f3dc7bd49171b76ed6a766164e6fed/GenericKeyedObjectPool.java/clean/src/java/org/apache/commons/pool/impl/GenericKeyedObjectPool.java
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(); }
50977 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50977/040416e9a1f3dc7bd49171b76ed6a766164e6fed/GenericKeyedObjectPool.java/clean/src/java/org/apache/commons/pool/impl/GenericKeyedObjectPool.java
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); } } }
50977 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50977/040416e9a1f3dc7bd49171b76ed6a766164e6fed/GenericKeyedObjectPool.java/clean/src/java/org/apache/commons/pool/impl/GenericKeyedObjectPool.java
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; } } } }
50977 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50977/040416e9a1f3dc7bd49171b76ed6a766164e6fed/GenericKeyedObjectPool.java/clean/src/java/org/apache/commons/pool/impl/GenericKeyedObjectPool.java
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; } } } }
50977 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50977/040416e9a1f3dc7bd49171b76ed6a766164e6fed/GenericKeyedObjectPool.java/clean/src/java/org/apache/commons/pool/impl/GenericKeyedObjectPool.java
_evictor = new Evictor(delay); Thread t = new Thread(_evictor); t.setDaemon(true); t.start();
_evictor = new Evictor(); GenericObjectPool.EVICTION_TIMER.schedule(_evictor, delay, delay);
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(); } }
50977 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50977/040416e9a1f3dc7bd49171b76ed6a766164e6fed/GenericKeyedObjectPool.java/clean/src/java/org/apache/commons/pool/impl/GenericKeyedObjectPool.java
ch = this.read(); if (ch != 0x0A) {
ch = this.currentPbReader.read(); if (ch != 0x0A && ch > 0) {
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; }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/d02144ed077bac9ec761e3a25202cb333420aa66/StdXMLReader.java/buggy/src/lib/net/n3/nanoxml/StdXMLReader.java
return (char) 0x0A;
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; }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/d02144ed077bac9ec761e3a25202cb333420aa66/StdXMLReader.java/buggy/src/lib/net/n3/nanoxml/StdXMLReader.java
return (char) 0x0A;
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; }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/d02144ed077bac9ec761e3a25202cb333420aa66/StdXMLReader.java/buggy/src/lib/net/n3/nanoxml/StdXMLReader.java
result.append( "OS_NAME=" + OS_NAME + NL );
result.append("OS_NAME=").append(OS_NAME).append(NL);
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(); }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/9619b3a25f43787dc92011111668210e06c00c71/OsVersion.java/clean/src/lib/com/izforge/izpack/util/OsVersion.java
result.append( getLinuxDistribution() + NL );
result.append(getLinuxDistribution()).append(NL);
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(); }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/9619b3a25f43787dc92011111668210e06c00c71/OsVersion.java/clean/src/lib/com/izforge/izpack/util/OsVersion.java
result.append( FileUtil.getFileContent( getReleaseFileName() ) + NL );
result.append(FileUtil.getFileContent(getReleaseFileName())).append(NL);
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(); }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/9619b3a25f43787dc92011111668210e06c00c71/OsVersion.java/clean/src/lib/com/izforge/izpack/util/OsVersion.java
result.append( System.getProperty( OSNAME ) + SP + System.getProperty( "sun.os.patch.level", "" ) + NL );
result.append(System.getProperty(OSNAME)).append(SP).append(System.getProperty("sun.os.patch.level", "")).append(NL);
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(); }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/9619b3a25f43787dc92011111668210e06c00c71/OsVersion.java/clean/src/lib/com/izforge/izpack/util/OsVersion.java
String result = new String();
String result = "";
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; }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/9619b3a25f43787dc92011111668210e06c00c71/OsVersion.java/clean/src/lib/com/izforge/izpack/util/OsVersion.java