rem
stringlengths 0
477k
| add
stringlengths 0
313k
| context
stringlengths 6
599k
| meta
stringlengths 141
403
|
---|---|---|---|
GridBagConstraints constraints) | GridBagConstraints constraints) | protected JTable createPacksTable(int width, JScrollPane scroller, GridBagLayout layout, GridBagConstraints constraints) { JTable table = new JTable(); table.setBorder(BorderFactory.createEmptyBorder(0, 2, 0, 2)); table.setIntercellSpacing(new Dimension(0, 0)); table.setBackground(Color.white); table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); table.getSelectionModel().addListSelectionListener(this); table.setShowGrid(false); scroller.setViewportView(table); scroller.setAlignmentX(LEFT_ALIGNMENT); scroller.getViewport().setBackground(Color.white); scroller.setPreferredSize(new Dimension(width, (idata.guiPrefs.height / 3 + 30))); if (layout != null && constraints != null) layout.addLayoutComponent(scroller, constraints); add(scroller); return (table); } | 54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/458df5388598b1463abaab7f3fba01a728e5d095/PacksPanelBase.java/buggy/src/lib/com/izforge/izpack/panels/PacksPanelBase.java |
GridBagConstraints constraints) | GridBagConstraints constraints) | protected JLabel createPanelWithLabel(String msgId, GridBagLayout layout, GridBagConstraints constraints) { JPanel panel = new JPanel(); JLabel label = new JLabel(); if (label == null) label = new JLabel(""); panel.setAlignmentX(LEFT_ALIGNMENT); panel.setLayout(new BoxLayout(panel, BoxLayout.X_AXIS)); panel.add(LabelFactory.create(parent.langpack.getString(msgId))); panel.add(Box.createHorizontalGlue()); panel.add(label); if (layout != null && constraints != null) layout.addLayoutComponent(panel, constraints); add(panel); return (label); } | 54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/458df5388598b1463abaab7f3fba01a728e5d095/PacksPanelBase.java/buggy/src/lib/com/izforge/izpack/panels/PacksPanelBase.java |
GridBagConstraints constraints) | GridBagConstraints constraints) | protected JTextArea createTextArea(String msgId, JScrollPane scroller, GridBagLayout layout, GridBagConstraints constraints) { JTextArea area = new JTextArea(); area.setMargin(new Insets(2, 2, 2, 2)); area.setAlignmentX(LEFT_ALIGNMENT); area.setCaretPosition(0); area.setEditable(false); area.setEditable(false); area.setOpaque(false); area.setLineWrap(true); area.setWrapStyleWord(true); area.setBorder(BorderFactory.createTitledBorder(parent.langpack.getString(msgId))); if (layout != null && constraints != null) { if (scroller != null) { layout.addLayoutComponent(scroller, constraints); } else layout.addLayoutComponent(area, constraints); } if (scroller != null) { scroller.setViewportView(area); add(scroller); } else add(area); return (area); } | 54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/458df5388598b1463abaab7f3fba01a728e5d095/PacksPanelBase.java/buggy/src/lib/com/izforge/izpack/panels/PacksPanelBase.java |
DefaultTableCellRenderer renderer1 = new DefaultTableCellRenderer() { | DefaultTableCellRenderer renderer1 = new DefaultTableCellRenderer() { | public void panelActivate() { try { packsTable.setModel(new PacksModel(idata.availablePacks, idata.selectedPacks, this)); CheckBoxEditorRenderer packSelectedRenderer = new CheckBoxEditorRenderer(false); packsTable.getColumnModel().getColumn(0).setCellRenderer(packSelectedRenderer); CheckBoxEditorRenderer packSelectedEditor = new CheckBoxEditorRenderer(true); packsTable.getColumnModel().getColumn(0).setCellEditor(packSelectedEditor); packsTable.getColumnModel().getColumn(0).setMaxWidth(40); DefaultTableCellRenderer renderer1 = new DefaultTableCellRenderer() { /** * */ private static final long serialVersionUID = 3256438101604710708L; public void setBorder(Border b) { } }; packsTable.getColumnModel().getColumn(1).setCellRenderer(renderer1); DefaultTableCellRenderer renderer2 = new DefaultTableCellRenderer() { /** * */ private static final long serialVersionUID = 4121128130480976185L; public void setBorder(Border b) { } // public void setFont(Font f) // { // super.setFont(new Font("Monospaced",Font.PLAIN,11)); // } }; renderer2.setHorizontalAlignment(JLabel.RIGHT); packsTable.getColumnModel().getColumn(2).setCellRenderer(renderer2); packsTable.getColumnModel().getColumn(2).setMaxWidth(100); // remove header,so we don't need more strings tableScroller.remove(packsTable.getTableHeader()); tableScroller.setColumnHeaderView(null); tableScroller.setColumnHeader(null); // set the JCheckBoxes to the currently selected panels. The // selection might have changed in another panel java.util.Iterator iter = idata.availablePacks.iterator(); bytes = 0; while (iter.hasNext()) { Pack p = (Pack) iter.next(); if (p.required) { bytes += p.nbytes; continue; } if (idata.selectedPacks.contains(p)) bytes += p.nbytes; } } catch (Exception e) { e.printStackTrace(); } showSpaceRequired(); showFreeSpace(); } | 54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/458df5388598b1463abaab7f3fba01a728e5d095/PacksPanelBase.java/buggy/src/lib/com/izforge/izpack/panels/PacksPanelBase.java |
DefaultTableCellRenderer renderer2 = new DefaultTableCellRenderer() { | DefaultTableCellRenderer renderer2 = new DefaultTableCellRenderer() { | public void panelActivate() { try { packsTable.setModel(new PacksModel(idata.availablePacks, idata.selectedPacks, this)); CheckBoxEditorRenderer packSelectedRenderer = new CheckBoxEditorRenderer(false); packsTable.getColumnModel().getColumn(0).setCellRenderer(packSelectedRenderer); CheckBoxEditorRenderer packSelectedEditor = new CheckBoxEditorRenderer(true); packsTable.getColumnModel().getColumn(0).setCellEditor(packSelectedEditor); packsTable.getColumnModel().getColumn(0).setMaxWidth(40); DefaultTableCellRenderer renderer1 = new DefaultTableCellRenderer() { /** * */ private static final long serialVersionUID = 3256438101604710708L; public void setBorder(Border b) { } }; packsTable.getColumnModel().getColumn(1).setCellRenderer(renderer1); DefaultTableCellRenderer renderer2 = new DefaultTableCellRenderer() { /** * */ private static final long serialVersionUID = 4121128130480976185L; public void setBorder(Border b) { } // public void setFont(Font f) // { // super.setFont(new Font("Monospaced",Font.PLAIN,11)); // } }; renderer2.setHorizontalAlignment(JLabel.RIGHT); packsTable.getColumnModel().getColumn(2).setCellRenderer(renderer2); packsTable.getColumnModel().getColumn(2).setMaxWidth(100); // remove header,so we don't need more strings tableScroller.remove(packsTable.getTableHeader()); tableScroller.setColumnHeaderView(null); tableScroller.setColumnHeader(null); // set the JCheckBoxes to the currently selected panels. The // selection might have changed in another panel java.util.Iterator iter = idata.availablePacks.iterator(); bytes = 0; while (iter.hasNext()) { Pack p = (Pack) iter.next(); if (p.required) { bytes += p.nbytes; continue; } if (idata.selectedPacks.contains(p)) bytes += p.nbytes; } } catch (Exception e) { e.printStackTrace(); } showSpaceRequired(); showFreeSpace(); } | 54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/458df5388598b1463abaab7f3fba01a728e5d095/PacksPanelBase.java/buggy/src/lib/com/izforge/izpack/panels/PacksPanelBase.java |
new File(idata.getInstallPath())).getAbsolutePath()); if (freeBytes > 0x000000007fffffff) msg = " > 2 GB"; else if (freeBytes < 0) msg = parent.langpack.getString("PacksPanel.notAscertainable"); | new File(idata.getInstallPath())).getAbsolutePath()); if (freeBytes < 0) msg = parent.langpack.getString("PacksPanel.notAscertainable"); | public void showFreeSpace() { if (IoHelper.supported("getFreeSpace") && freeSpaceLabel != null) { String msg = null; freeBytes = IoHelper.getFreeSpace(IoHelper.existingParent( new File(idata.getInstallPath())).getAbsolutePath()); if (freeBytes > 0x000000007fffffff) msg = " > 2 GB"; else if (freeBytes < 0) msg = parent.langpack.getString("PacksPanel.notAscertainable"); else msg = Pack.toByteUnitsString((int) freeBytes); freeSpaceLabel.setText(msg); } } | 54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/458df5388598b1463abaab7f3fba01a728e5d095/PacksPanelBase.java/buggy/src/lib/com/izforge/izpack/panels/PacksPanelBase.java |
msg = Pack.toByteUnitsString((int) freeBytes); | msg = Pack.toByteUnitsString(freeBytes); | public void showFreeSpace() { if (IoHelper.supported("getFreeSpace") && freeSpaceLabel != null) { String msg = null; freeBytes = IoHelper.getFreeSpace(IoHelper.existingParent( new File(idata.getInstallPath())).getAbsolutePath()); if (freeBytes > 0x000000007fffffff) msg = " > 2 GB"; else if (freeBytes < 0) msg = parent.langpack.getString("PacksPanel.notAscertainable"); else msg = Pack.toByteUnitsString((int) freeBytes); freeSpaceLabel.setText(msg); } } | 54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/458df5388598b1463abaab7f3fba01a728e5d095/PacksPanelBase.java/buggy/src/lib/com/izforge/izpack/panels/PacksPanelBase.java |
String className, | Collection classNames, | public LaunchInfo(String projectName, int launchType, String className, Map groupMap, String suiteName, String complianceLevel, String logLevel) { m_projectName= projectName; m_launchType= launchType; m_className= className.trim(); m_groupMap= groupMap; m_suiteName= suiteName.trim(); m_complianceLevel= complianceLevel; m_logLevel= logLevel; } | 53349 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/53349/d42cff6078dc81fdbe15ceb2b18037f7fa09bb58/ConfigurationHelper.java/buggy/src/main/org/testng/eclipse/ui/util/ConfigurationHelper.java |
m_className= className.trim(); | m_classNames= classNames; | public LaunchInfo(String projectName, int launchType, String className, Map groupMap, String suiteName, String complianceLevel, String logLevel) { m_projectName= projectName; m_launchType= launchType; m_className= className.trim(); m_groupMap= groupMap; m_suiteName= suiteName.trim(); m_complianceLevel= complianceLevel; m_logLevel= logLevel; } | 53349 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/53349/d42cff6078dc81fdbe15ceb2b18037f7fa09bb58/ConfigurationHelper.java/buggy/src/main/org/testng/eclipse/ui/util/ConfigurationHelper.java |
List testMethods = null; | Map classMethods= null; | public static List getLaunchSuites(IJavaProject ijp, ILaunchConfiguration configuration) { int type = ConfigurationHelper.getType(configuration); List packages= null; List testClasses = null; List groups = null; List testMethods = null; Map parameters= null; parameters= getMapAttribute(configuration, TestNGLaunchConfigurationConstants.PARAMS); if (type == TestNGLaunchConfigurationConstants.SUITE) { return createLaunchSuites(ijp.getProject(), getSuites(configuration)); } if (type == TestNGLaunchConfigurationConstants.GROUP) { groups = getGroups(configuration); testClasses = getGroupClasses(configuration); } else if (type == TestNGLaunchConfigurationConstants.CLASS) { testClasses = getClasses(configuration); } else if (type == TestNGLaunchConfigurationConstants.METHOD) { testClasses = getClasses(configuration); testMethods = getMethods(configuration); } else if (type == TestNGLaunchConfigurationConstants.PACKAGE) { packages= getListAttribute(configuration, TestNGLaunchConfigurationConstants.PACKAGE_TEST_LIST); } return createLaunchSuites(ijp.getProject().getName(), packages, getClassMethods(configuration), groups, parameters, getComplianceLevel(ijp, configuration), getLogLevel(configuration)); // return createLaunchSuites(ijp.getProject().getName(),// packages,// testClasses, // testMethods, // groups,// parameters,// getComplianceLevel(ijp, configuration),// getLogLevel(configuration)// ); } | 53349 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/53349/d42cff6078dc81fdbe15ceb2b18037f7fa09bb58/ConfigurationHelper.java/buggy/src/main/org/testng/eclipse/ui/util/ConfigurationHelper.java |
testMethods = getMethods(configuration); | public static List getLaunchSuites(IJavaProject ijp, ILaunchConfiguration configuration) { int type = ConfigurationHelper.getType(configuration); List packages= null; List testClasses = null; List groups = null; List testMethods = null; Map parameters= null; parameters= getMapAttribute(configuration, TestNGLaunchConfigurationConstants.PARAMS); if (type == TestNGLaunchConfigurationConstants.SUITE) { return createLaunchSuites(ijp.getProject(), getSuites(configuration)); } if (type == TestNGLaunchConfigurationConstants.GROUP) { groups = getGroups(configuration); testClasses = getGroupClasses(configuration); } else if (type == TestNGLaunchConfigurationConstants.CLASS) { testClasses = getClasses(configuration); } else if (type == TestNGLaunchConfigurationConstants.METHOD) { testClasses = getClasses(configuration); testMethods = getMethods(configuration); } else if (type == TestNGLaunchConfigurationConstants.PACKAGE) { packages= getListAttribute(configuration, TestNGLaunchConfigurationConstants.PACKAGE_TEST_LIST); } return createLaunchSuites(ijp.getProject().getName(), packages, getClassMethods(configuration), groups, parameters, getComplianceLevel(ijp, configuration), getLogLevel(configuration)); // return createLaunchSuites(ijp.getProject().getName(),// packages,// testClasses, // testMethods, // groups,// parameters,// getComplianceLevel(ijp, configuration),// getLogLevel(configuration)// ); } | 53349 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/53349/d42cff6078dc81fdbe15ceb2b18037f7fa09bb58/ConfigurationHelper.java/buggy/src/main/org/testng/eclipse/ui/util/ConfigurationHelper.java |
|
getClassMethods(configuration), | testClasses, classMethods, | public static List getLaunchSuites(IJavaProject ijp, ILaunchConfiguration configuration) { int type = ConfigurationHelper.getType(configuration); List packages= null; List testClasses = null; List groups = null; List testMethods = null; Map parameters= null; parameters= getMapAttribute(configuration, TestNGLaunchConfigurationConstants.PARAMS); if (type == TestNGLaunchConfigurationConstants.SUITE) { return createLaunchSuites(ijp.getProject(), getSuites(configuration)); } if (type == TestNGLaunchConfigurationConstants.GROUP) { groups = getGroups(configuration); testClasses = getGroupClasses(configuration); } else if (type == TestNGLaunchConfigurationConstants.CLASS) { testClasses = getClasses(configuration); } else if (type == TestNGLaunchConfigurationConstants.METHOD) { testClasses = getClasses(configuration); testMethods = getMethods(configuration); } else if (type == TestNGLaunchConfigurationConstants.PACKAGE) { packages= getListAttribute(configuration, TestNGLaunchConfigurationConstants.PACKAGE_TEST_LIST); } return createLaunchSuites(ijp.getProject().getName(), packages, getClassMethods(configuration), groups, parameters, getComplianceLevel(ijp, configuration), getLogLevel(configuration)); // return createLaunchSuites(ijp.getProject().getName(),// packages,// testClasses, // testMethods, // groups,// parameters,// getComplianceLevel(ijp, configuration),// getLogLevel(configuration)// ); } | 53349 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/53349/d42cff6078dc81fdbe15ceb2b18037f7fa09bb58/ConfigurationHelper.java/buggy/src/main/org/testng/eclipse/ui/util/ConfigurationHelper.java |
getLogLevel(configuration)); | getLogLevel(configuration) ); | public static List getLaunchSuites(IJavaProject ijp, ILaunchConfiguration configuration) { int type = ConfigurationHelper.getType(configuration); List packages= null; List testClasses = null; List groups = null; List testMethods = null; Map parameters= null; parameters= getMapAttribute(configuration, TestNGLaunchConfigurationConstants.PARAMS); if (type == TestNGLaunchConfigurationConstants.SUITE) { return createLaunchSuites(ijp.getProject(), getSuites(configuration)); } if (type == TestNGLaunchConfigurationConstants.GROUP) { groups = getGroups(configuration); testClasses = getGroupClasses(configuration); } else if (type == TestNGLaunchConfigurationConstants.CLASS) { testClasses = getClasses(configuration); } else if (type == TestNGLaunchConfigurationConstants.METHOD) { testClasses = getClasses(configuration); testMethods = getMethods(configuration); } else if (type == TestNGLaunchConfigurationConstants.PACKAGE) { packages= getListAttribute(configuration, TestNGLaunchConfigurationConstants.PACKAGE_TEST_LIST); } return createLaunchSuites(ijp.getProject().getName(), packages, getClassMethods(configuration), groups, parameters, getComplianceLevel(ijp, configuration), getLogLevel(configuration)); // return createLaunchSuites(ijp.getProject().getName(),// packages,// testClasses, // testMethods, // groups,// parameters,// getComplianceLevel(ijp, configuration),// getLogLevel(configuration)// ); } | 53349 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/53349/d42cff6078dc81fdbe15ceb2b18037f7fa09bb58/ConfigurationHelper.java/buggy/src/main/org/testng/eclipse/ui/util/ConfigurationHelper.java |
if(null != launchInfo.m_className) { classMethods.put(launchInfo.m_className, EMPTY); | Collection classNames= launchInfo.m_classNames; List classNamesList= new ArrayList(); if(null != classNames && !classNames.isEmpty()) { for(Iterator it= classNames.iterator(); it.hasNext(); ) { Object cls= it.next(); classMethods.put(cls, EMPTY); classNamesList.add(cls); } | public static void updateLaunchConfiguration(ILaunchConfigurationWorkingCopy configuration, LaunchInfo launchInfo) { final List EMPTY= new ArrayList(); Map classMethods= new HashMap(); Collection classes= launchInfo.m_groupMap.values(); if(null != classes) { for(Iterator it= classes.iterator(); it.hasNext(); ) { List classList= (List) it.next(); for(Iterator itc= classList.iterator(); itc.hasNext(); ) { classMethods.put(itc.next(), EMPTY); } } } if(null != launchInfo.m_className) { classMethods.put(launchInfo.m_className, EMPTY); } configuration.setAttribute(TestNGLaunchConfigurationConstants.TYPE, launchInfo.m_launchType); configuration.setAttribute(IJavaLaunchConfigurationConstants.ATTR_PROJECT_NAME, launchInfo.m_projectName); configuration.setAttribute(IJavaLaunchConfigurationConstants.ATTR_MAIN_TYPE_NAME, RemoteTestNG.class.getName()); configuration.setAttribute(TestNGLaunchConfigurationConstants.CLASS_TEST_LIST, Utils.stringToNullList(launchInfo.m_className)); configuration.setAttribute(TestNGLaunchConfigurationConstants.GROUP_LIST, new ArrayList(launchInfo.m_groupMap.keySet())); configuration.setAttribute(TestNGLaunchConfigurationConstants.GROUP_CLASS_LIST, Utils.uniqueMergeList(launchInfo.m_groupMap.values())); configuration.setAttribute(TestNGLaunchConfigurationConstants.SUITE_TEST_LIST, Utils.stringToNullList(launchInfo.m_suiteName)); configuration.setAttribute(TestNGLaunchConfigurationConstants.ALL_METHODS_LIST, toClassMethodsMap(classMethods)); configuration.setAttribute(TestNGLaunchConfigurationConstants.TESTNG_COMPLIANCE_LEVEL_ATTR, launchInfo.m_complianceLevel); configuration.setAttribute(TestNGLaunchConfigurationConstants.LOG_LEVEL, launchInfo.m_logLevel); } | 53349 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/53349/d42cff6078dc81fdbe15ceb2b18037f7fa09bb58/ConfigurationHelper.java/buggy/src/main/org/testng/eclipse/ui/util/ConfigurationHelper.java |
Utils.stringToNullList(launchInfo.m_className)); | classNamesList); | public static void updateLaunchConfiguration(ILaunchConfigurationWorkingCopy configuration, LaunchInfo launchInfo) { final List EMPTY= new ArrayList(); Map classMethods= new HashMap(); Collection classes= launchInfo.m_groupMap.values(); if(null != classes) { for(Iterator it= classes.iterator(); it.hasNext(); ) { List classList= (List) it.next(); for(Iterator itc= classList.iterator(); itc.hasNext(); ) { classMethods.put(itc.next(), EMPTY); } } } if(null != launchInfo.m_className) { classMethods.put(launchInfo.m_className, EMPTY); } configuration.setAttribute(TestNGLaunchConfigurationConstants.TYPE, launchInfo.m_launchType); configuration.setAttribute(IJavaLaunchConfigurationConstants.ATTR_PROJECT_NAME, launchInfo.m_projectName); configuration.setAttribute(IJavaLaunchConfigurationConstants.ATTR_MAIN_TYPE_NAME, RemoteTestNG.class.getName()); configuration.setAttribute(TestNGLaunchConfigurationConstants.CLASS_TEST_LIST, Utils.stringToNullList(launchInfo.m_className)); configuration.setAttribute(TestNGLaunchConfigurationConstants.GROUP_LIST, new ArrayList(launchInfo.m_groupMap.keySet())); configuration.setAttribute(TestNGLaunchConfigurationConstants.GROUP_CLASS_LIST, Utils.uniqueMergeList(launchInfo.m_groupMap.values())); configuration.setAttribute(TestNGLaunchConfigurationConstants.SUITE_TEST_LIST, Utils.stringToNullList(launchInfo.m_suiteName)); configuration.setAttribute(TestNGLaunchConfigurationConstants.ALL_METHODS_LIST, toClassMethodsMap(classMethods)); configuration.setAttribute(TestNGLaunchConfigurationConstants.TESTNG_COMPLIANCE_LEVEL_ATTR, launchInfo.m_complianceLevel); configuration.setAttribute(TestNGLaunchConfigurationConstants.LOG_LEVEL, launchInfo.m_logLevel); } | 53349 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/53349/d42cff6078dc81fdbe15ceb2b18037f7fa09bb58/ConfigurationHelper.java/buggy/src/main/org/testng/eclipse/ui/util/ConfigurationHelper.java |
final Collection methodNames, | final Map methodNames, | public static LaunchSuite createCustomizedSuite(final String projectName, final Collection packageNames, final Collection classNames, final Collection methodNames, final Collection groupNames, final Map parameters, final String annotationType, final int logLevel) { if((null != groupNames) && !groupNames.isEmpty()) { return new GroupListSuite(projectName, packageNames, /* is emtpy */ classNames, groupNames, parameters, /* is empty */ annotationType, logLevel); } else if(null != methodNames && methodNames.size() > 0) { return new MethodsSuite(projectName, (String) classNames.iterator().next(), methodNames, parameters, annotationType, logLevel); } else if(null != packageNames && !packageNames.isEmpty()) { return new PackageSuite(projectName, packageNames, classNames, /* is empty */ groupNames, /* is empty */ parameters, annotationType, logLevel); } else { return new ClassListSuite(projectName, packageNames, /* is empty */ classNames, groupNames, /* is empty */ parameters, annotationType, logLevel); } } | 53349 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/53349/d42cff6078dc81fdbe15ceb2b18037f7fa09bb58/SuiteGenerator.java/buggy/src/main/org/testng/eclipse/util/SuiteGenerator.java |
packageNames, /* is emtpy */ | packageNames, | public static LaunchSuite createCustomizedSuite(final String projectName, final Collection packageNames, final Collection classNames, final Collection methodNames, final Collection groupNames, final Map parameters, final String annotationType, final int logLevel) { if((null != groupNames) && !groupNames.isEmpty()) { return new GroupListSuite(projectName, packageNames, /* is emtpy */ classNames, groupNames, parameters, /* is empty */ annotationType, logLevel); } else if(null != methodNames && methodNames.size() > 0) { return new MethodsSuite(projectName, (String) classNames.iterator().next(), methodNames, parameters, annotationType, logLevel); } else if(null != packageNames && !packageNames.isEmpty()) { return new PackageSuite(projectName, packageNames, classNames, /* is empty */ groupNames, /* is empty */ parameters, annotationType, logLevel); } else { return new ClassListSuite(projectName, packageNames, /* is empty */ classNames, groupNames, /* is empty */ parameters, annotationType, logLevel); } } | 53349 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/53349/d42cff6078dc81fdbe15ceb2b18037f7fa09bb58/SuiteGenerator.java/buggy/src/main/org/testng/eclipse/util/SuiteGenerator.java |
parameters, /* is empty */ | parameters, | public static LaunchSuite createCustomizedSuite(final String projectName, final Collection packageNames, final Collection classNames, final Collection methodNames, final Collection groupNames, final Map parameters, final String annotationType, final int logLevel) { if((null != groupNames) && !groupNames.isEmpty()) { return new GroupListSuite(projectName, packageNames, /* is emtpy */ classNames, groupNames, parameters, /* is empty */ annotationType, logLevel); } else if(null != methodNames && methodNames.size() > 0) { return new MethodsSuite(projectName, (String) classNames.iterator().next(), methodNames, parameters, annotationType, logLevel); } else if(null != packageNames && !packageNames.isEmpty()) { return new PackageSuite(projectName, packageNames, classNames, /* is empty */ groupNames, /* is empty */ parameters, annotationType, logLevel); } else { return new ClassListSuite(projectName, packageNames, /* is empty */ classNames, groupNames, /* is empty */ parameters, annotationType, logLevel); } } | 53349 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/53349/d42cff6078dc81fdbe15ceb2b18037f7fa09bb58/SuiteGenerator.java/buggy/src/main/org/testng/eclipse/util/SuiteGenerator.java |
else if(null != methodNames && methodNames.size() > 0) { return new MethodsSuite(projectName, (String) classNames.iterator().next(), methodNames, | else if(null != packageNames && !packageNames.isEmpty()) { return new PackageSuite(projectName, packageNames, | public static LaunchSuite createCustomizedSuite(final String projectName, final Collection packageNames, final Collection classNames, final Collection methodNames, final Collection groupNames, final Map parameters, final String annotationType, final int logLevel) { if((null != groupNames) && !groupNames.isEmpty()) { return new GroupListSuite(projectName, packageNames, /* is emtpy */ classNames, groupNames, parameters, /* is empty */ annotationType, logLevel); } else if(null != methodNames && methodNames.size() > 0) { return new MethodsSuite(projectName, (String) classNames.iterator().next(), methodNames, parameters, annotationType, logLevel); } else if(null != packageNames && !packageNames.isEmpty()) { return new PackageSuite(projectName, packageNames, classNames, /* is empty */ groupNames, /* is empty */ parameters, annotationType, logLevel); } else { return new ClassListSuite(projectName, packageNames, /* is empty */ classNames, groupNames, /* is empty */ parameters, annotationType, logLevel); } } | 53349 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/53349/d42cff6078dc81fdbe15ceb2b18037f7fa09bb58/SuiteGenerator.java/buggy/src/main/org/testng/eclipse/util/SuiteGenerator.java |
else if(null != packageNames && !packageNames.isEmpty()) { return new PackageSuite(projectName, packageNames, classNames, /* is empty */ groupNames, /* is empty */ parameters, annotationType, logLevel); } else { return new ClassListSuite(projectName, packageNames, /* is empty */ classNames, groupNames, /* is empty */ parameters, annotationType, logLevel); | else { return new ClassMethodsSuite(projectName, classNames, methodNames, parameters, annotationType, logLevel); | public static LaunchSuite createCustomizedSuite(final String projectName, final Collection packageNames, final Collection classNames, final Collection methodNames, final Collection groupNames, final Map parameters, final String annotationType, final int logLevel) { if((null != groupNames) && !groupNames.isEmpty()) { return new GroupListSuite(projectName, packageNames, /* is emtpy */ classNames, groupNames, parameters, /* is empty */ annotationType, logLevel); } else if(null != methodNames && methodNames.size() > 0) { return new MethodsSuite(projectName, (String) classNames.iterator().next(), methodNames, parameters, annotationType, logLevel); } else if(null != packageNames && !packageNames.isEmpty()) { return new PackageSuite(projectName, packageNames, classNames, /* is empty */ groupNames, /* is empty */ parameters, annotationType, logLevel); } else { return new ClassListSuite(projectName, packageNames, /* is empty */ classNames, groupNames, /* is empty */ parameters, annotationType, logLevel); } } | 53349 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/53349/d42cff6078dc81fdbe15ceb2b18037f7fa09bb58/SuiteGenerator.java/buggy/src/main/org/testng/eclipse/util/SuiteGenerator.java |
m_annotationTypeE= AnnotationTypeEnum.valueOf(annotationType); | public CustomSuite(final String projectName, final String suiteName, final Map parameters, final String annotationType) { super(true); m_projectName= projectName; m_suiteName= suiteName; m_parameters= parameters; if("1.4".equals(annotationType) || TestNG.JAVADOC_ANNOTATION_TYPE.equals(annotationType)) { m_annotationType= TestNG.JAVADOC_ANNOTATION_TYPE; } else { m_annotationType= TestNG.JDK_ANNOTATION_TYPE; } m_annotationTypeE= AnnotationTypeEnum.valueOf(annotationType); } | 53349 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/53349/d40d1cb62b9fe19b5aa4eaab262d9c354adf8af8/CustomSuite.java/buggy/src/main/org/testng/eclipse/util/CustomSuite.java |
|
this(testRunner, className, method, true); } | this(testRunner, className, method, true); } | public OpenTestAction(TestRunnerViewPart testRunner, String className, String method) { this(testRunner, className, method, true); } | 53349 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/53349/939c2626f5ef7c6550d3a506ac6dd14b7667f498/OpenTestAction.java/clean/src/main/org/testng/eclipse/ui/OpenTestAction.java |
protected IJavaElement findElement(IJavaProject project, String className) throws JavaModelException { IType type= project.findType(className); if (type == null) return null; if (fMethodName == null) return type; IMethod method= findMethodInTypeHierarchy(type); | protected IJavaElement findElement(IJavaProject project, String className) throws JavaModelException { IType type = project.findType(className); if (type == null) { return null; } if (fMethodName == null) { return type; } IMethod method = findMethodInTypeHierarchy(type); | protected IJavaElement findElement(IJavaProject project, String className) throws JavaModelException { IType type= project.findType(className); if (type == null) return null; if (fMethodName == null) return type; IMethod method= findMethodInTypeHierarchy(type); if (null == method) { method= fuzzyFindMethodInTypeHierarchy(type); } if (method == null) { String title= ResourceUtil.getString("OpenTestAction.error.title"); //$NON-NLS-1$ String message= ResourceUtil.getFormattedString("OpenTestAction.error.methodNoFound", fMethodName); //$NON-NLS-1$ MessageDialog.openInformation(getShell(), title, message); return type; } fRange= method.getNameRange(); return method; } | 53349 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/53349/939c2626f5ef7c6550d3a506ac6dd14b7667f498/OpenTestAction.java/clean/src/main/org/testng/eclipse/ui/OpenTestAction.java |
method= fuzzyFindMethodInTypeHierarchy(type); | method = fuzzyFindMethodInTypeHierarchy(type); | protected IJavaElement findElement(IJavaProject project, String className) throws JavaModelException { IType type= project.findType(className); if (type == null) return null; if (fMethodName == null) return type; IMethod method= findMethodInTypeHierarchy(type); if (null == method) { method= fuzzyFindMethodInTypeHierarchy(type); } if (method == null) { String title= ResourceUtil.getString("OpenTestAction.error.title"); //$NON-NLS-1$ String message= ResourceUtil.getFormattedString("OpenTestAction.error.methodNoFound", fMethodName); //$NON-NLS-1$ MessageDialog.openInformation(getShell(), title, message); return type; } fRange= method.getNameRange(); return method; } | 53349 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/53349/939c2626f5ef7c6550d3a506ac6dd14b7667f498/OpenTestAction.java/clean/src/main/org/testng/eclipse/ui/OpenTestAction.java |
if (method == null) { String title= ResourceUtil.getString("OpenTestAction.error.title"); String message= ResourceUtil.getFormattedString("OpenTestAction.error.methodNoFound", fMethodName); MessageDialog.openInformation(getShell(), title, message); return type; } fRange= method.getNameRange(); return method; } | if (method == null) { String title = ResourceUtil.getString("OpenTestAction.error.title"); String message = ResourceUtil.getFormattedString("OpenTestAction.error.methodNoFound", fMethodName); MessageDialog.openInformation(getShell(), title, message); return type; } fRange = method.getNameRange(); return method; } | protected IJavaElement findElement(IJavaProject project, String className) throws JavaModelException { IType type= project.findType(className); if (type == null) return null; if (fMethodName == null) return type; IMethod method= findMethodInTypeHierarchy(type); if (null == method) { method= fuzzyFindMethodInTypeHierarchy(type); } if (method == null) { String title= ResourceUtil.getString("OpenTestAction.error.title"); //$NON-NLS-1$ String message= ResourceUtil.getFormattedString("OpenTestAction.error.methodNoFound", fMethodName); //$NON-NLS-1$ MessageDialog.openInformation(getShell(), title, message); return type; } fRange= method.getNameRange(); return method; } | 53349 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/53349/939c2626f5ef7c6550d3a506ac6dd14b7667f498/OpenTestAction.java/clean/src/main/org/testng/eclipse/ui/OpenTestAction.java |
IMethod method= type.getMethod(fMethodName, new String[0]); if (method != null && method.exists()) { | IMethod method = type.getMethod(fMethodName, new String[0]); if ((method != null) && method.exists()) { | IMethod findMethodInTypeHierarchy(IType type) throws JavaModelException { IMethod method= type.getMethod(fMethodName, new String[0]); if (method != null && method.exists()) { return method; } ITypeHierarchy typeHierarchy= type.newSupertypeHierarchy(null); IType[] types= typeHierarchy.getAllSuperclasses(type); for (int i= 0; i < types.length; i++) { method= types[i].getMethod(fMethodName, new String[0]); if (method != null && method.exists()) { return method; } } return null; } | 53349 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/53349/939c2626f5ef7c6550d3a506ac6dd14b7667f498/OpenTestAction.java/clean/src/main/org/testng/eclipse/ui/OpenTestAction.java |
ITypeHierarchy typeHierarchy= type.newSupertypeHierarchy(null); IType[] types= typeHierarchy.getAllSuperclasses(type); for (int i= 0; i < types.length; i++) { method= types[i].getMethod(fMethodName, new String[0]); if (method != null && method.exists()) { | ITypeHierarchy typeHierarchy = type.newSupertypeHierarchy(null); IType[] types = typeHierarchy.getAllSuperclasses(type); for (int i = 0; i < types.length; i++) { method = types[i].getMethod(fMethodName, new String[0]); if ((method != null) && method.exists()) { | IMethod findMethodInTypeHierarchy(IType type) throws JavaModelException { IMethod method= type.getMethod(fMethodName, new String[0]); if (method != null && method.exists()) { return method; } ITypeHierarchy typeHierarchy= type.newSupertypeHierarchy(null); IType[] types= typeHierarchy.getAllSuperclasses(type); for (int i= 0; i < types.length; i++) { method= types[i].getMethod(fMethodName, new String[0]); if (method != null && method.exists()) { return method; } } return null; } | 53349 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/53349/939c2626f5ef7c6550d3a506ac6dd14b7667f498/OpenTestAction.java/clean/src/main/org/testng/eclipse/ui/OpenTestAction.java |
IMethod findMethodInTypeHierarchy(IType type) throws JavaModelException { IMethod method= type.getMethod(fMethodName, new String[0]); if (method != null && method.exists()) { return method; } ITypeHierarchy typeHierarchy= type.newSupertypeHierarchy(null); IType[] types= typeHierarchy.getAllSuperclasses(type); for (int i= 0; i < types.length; i++) { method= types[i].getMethod(fMethodName, new String[0]); if (method != null && method.exists()) { return method; } } return null; } | 53349 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/53349/939c2626f5ef7c6550d3a506ac6dd14b7667f498/OpenTestAction.java/clean/src/main/org/testng/eclipse/ui/OpenTestAction.java |
||
IMethod[] methods= type.getMethods(); for(int i= 0; i < methods.length; i++) { if(fMethodName.equals(methods[i].getElementName()) && methods[i].exists()) { | IMethod[] methods = type.getMethods(); for (int i = 0; i < methods.length; i++) { if (fMethodName.equals(methods[i].getElementName()) && methods[i].exists()) { | IMethod fuzzyFindMethodInTypeHierarchy(IType type) throws JavaModelException { IMethod[] methods= type.getMethods(); for(int i= 0; i < methods.length; i++) { if(fMethodName.equals(methods[i].getElementName()) && methods[i].exists()) { return methods[i]; } } ITypeHierarchy typeHierarchy= type.newSupertypeHierarchy(null); IType[] types= typeHierarchy.getAllSuperclasses(type); for (int i= 0; i < types.length; i++) { methods= types[i].getMethods(); for(int j= 0; j < methods.length; j++) { if(fMethodName.equals(methods[j].getElementName()) && methods[j].exists()) { return methods[j]; } } } return null; } | 53349 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/53349/939c2626f5ef7c6550d3a506ac6dd14b7667f498/OpenTestAction.java/clean/src/main/org/testng/eclipse/ui/OpenTestAction.java |
ITypeHierarchy typeHierarchy= type.newSupertypeHierarchy(null); IType[] types= typeHierarchy.getAllSuperclasses(type); for (int i= 0; i < types.length; i++) { methods= types[i].getMethods(); for(int j= 0; j < methods.length; j++) { if(fMethodName.equals(methods[j].getElementName()) && methods[j].exists()) { return methods[j]; } | ITypeHierarchy typeHierarchy = type.newSupertypeHierarchy(null); IType[] types = typeHierarchy.getAllSuperclasses(type); for (int i = 0; i < types.length; i++) { methods = types[i].getMethods(); for (int j = 0; j < methods.length; j++) { if (fMethodName.equals(methods[j].getElementName()) && methods[j].exists()) { return methods[j]; | IMethod fuzzyFindMethodInTypeHierarchy(IType type) throws JavaModelException { IMethod[] methods= type.getMethods(); for(int i= 0; i < methods.length; i++) { if(fMethodName.equals(methods[i].getElementName()) && methods[i].exists()) { return methods[i]; } } ITypeHierarchy typeHierarchy= type.newSupertypeHierarchy(null); IType[] types= typeHierarchy.getAllSuperclasses(type); for (int i= 0; i < types.length; i++) { methods= types[i].getMethods(); for(int j= 0; j < methods.length; j++) { if(fMethodName.equals(methods[j].getElementName()) && methods[j].exists()) { return methods[j]; } } } return null; } | 53349 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/53349/939c2626f5ef7c6550d3a506ac6dd14b7667f498/OpenTestAction.java/clean/src/main/org/testng/eclipse/ui/OpenTestAction.java |
IMethod fuzzyFindMethodInTypeHierarchy(IType type) throws JavaModelException { IMethod[] methods= type.getMethods(); for(int i= 0; i < methods.length; i++) { if(fMethodName.equals(methods[i].getElementName()) && methods[i].exists()) { return methods[i]; } } ITypeHierarchy typeHierarchy= type.newSupertypeHierarchy(null); IType[] types= typeHierarchy.getAllSuperclasses(type); for (int i= 0; i < types.length; i++) { methods= types[i].getMethods(); for(int j= 0; j < methods.length; j++) { if(fMethodName.equals(methods[j].getElementName()) && methods[j].exists()) { return methods[j]; } } } return null; } | 53349 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/53349/939c2626f5ef7c6550d3a506ac6dd14b7667f498/OpenTestAction.java/clean/src/main/org/testng/eclipse/ui/OpenTestAction.java |
||
try { return getLaunchedProject().findType(getClassName()) != null; } catch (JavaModelException e) { } return false; } | if(null == getClassName()) { return false; } try { return getLaunchedProject().findType(getClassName()) != null; } catch (JavaModelException e) { } return false; } | public boolean isEnabled() { try { return getLaunchedProject().findType(getClassName()) != null; } catch (JavaModelException e) { } return false; } | 53349 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/53349/939c2626f5ef7c6550d3a506ac6dd14b7667f498/OpenTestAction.java/clean/src/main/org/testng/eclipse/ui/OpenTestAction.java |
if (fRange != null) textEditor.selectAndReveal(fRange.getOffset(), fRange.getLength()); } | if (fRange != null) { textEditor.selectAndReveal(fRange.getOffset(), fRange.getLength()); } } | protected void reveal(ITextEditor textEditor) { if (fRange != null) textEditor.selectAndReveal(fRange.getOffset(), fRange.getLength()); } | 53349 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/53349/939c2626f5ef7c6550d3a506ac6dd14b7667f498/OpenTestAction.java/clean/src/main/org/testng/eclipse/ui/OpenTestAction.java |
return; | public void activateLogging() throws NativeLibException { return; } | 54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/9619b3a25f43787dc92011111668210e06c00c71/RegistryHandler.java/buggy/src/lib/com/izforge/izpack/util/os/RegistryHandler.java |
|
return; | public void addLoggingInfo(List info) throws NativeLibException { return; } | 54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/9619b3a25f43787dc92011111668210e06c00c71/RegistryHandler.java/buggy/src/lib/com/izforge/izpack/util/os/RegistryHandler.java |
|
return; | public void createKey(String key) throws NativeLibException { return; } | 54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/9619b3a25f43787dc92011111668210e06c00c71/RegistryHandler.java/buggy/src/lib/com/izforge/izpack/util/os/RegistryHandler.java |
|
return; | public void deleteKey( String key) throws NativeLibException { return; } | 54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/9619b3a25f43787dc92011111668210e06c00c71/RegistryHandler.java/buggy/src/lib/com/izforge/izpack/util/os/RegistryHandler.java |
|
return; | public void deleteKeyIfEmpty(String key) throws NativeLibException { return; } | 54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/9619b3a25f43787dc92011111668210e06c00c71/RegistryHandler.java/buggy/src/lib/com/izforge/izpack/util/os/RegistryHandler.java |
|
return; | public void deleteValue(String key, String value) throws NativeLibException { return; } | 54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/9619b3a25f43787dc92011111668210e06c00c71/RegistryHandler.java/buggy/src/lib/com/izforge/izpack/util/os/RegistryHandler.java |
|
return; | public void resetLogging() throws NativeLibException { return; } | 54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/9619b3a25f43787dc92011111668210e06c00c71/RegistryHandler.java/buggy/src/lib/com/izforge/izpack/util/os/RegistryHandler.java |
|
return; | public void rewind() throws NativeLibException { return; } | 54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/9619b3a25f43787dc92011111668210e06c00c71/RegistryHandler.java/buggy/src/lib/com/izforge/izpack/util/os/RegistryHandler.java |
|
return; | public void setLoggingInfo(List info) throws NativeLibException { return; } | 54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/9619b3a25f43787dc92011111668210e06c00c71/RegistryHandler.java/buggy/src/lib/com/izforge/izpack/util/os/RegistryHandler.java |
|
return; | public void setRoot(int i) throws NativeLibException { return; } | 54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/9619b3a25f43787dc92011111668210e06c00c71/RegistryHandler.java/buggy/src/lib/com/izforge/izpack/util/os/RegistryHandler.java |
|
return; | public void setValue(String key, String value, String contents) throws NativeLibException { return; } | 54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/9619b3a25f43787dc92011111668210e06c00c71/RegistryHandler.java/buggy/src/lib/com/izforge/izpack/util/os/RegistryHandler.java |
|
return; | public void suspendLogging() throws NativeLibException { return; } | 54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/9619b3a25f43787dc92011111668210e06c00c71/RegistryHandler.java/buggy/src/lib/com/izforge/izpack/util/os/RegistryHandler.java |
|
else if (OsVersion.IS_TRU64) { String[] params = { "bdf", path }; String[] output = new String[2]; FileExecutor fe = new FileExecutor(); fe.executeCommand(params, output); retval = extractLong(output[0], -3, 3, "%") * 1024; } | public static long getFreeSpace(String path) { long retval = -1; if (OsVersion.IS_WINDOWS) { String command = "cmd.exe"; if (System.getProperty("os.name").toLowerCase().indexOf("windows 9") > -1) return (-1); String[] params = { command, "/C", "\"dir /D /-C \"" + path + "\"\""}; String[] output = new String[2]; FileExecutor fe = new FileExecutor(); fe.executeCommand(params, output); retval = extractLong(output[0], -3, 3, "%"); } else if (OsVersion.IS_SUNOS) { String[] params = { "df", "-k", path}; String[] output = new String[2]; FileExecutor fe = new FileExecutor(); fe.executeCommand(params, output); retval = extractLong(output[0], -3, 3, "%") * 1024; } else if (OsVersion.IS_UNIX) { String[] params = { "df", "-Pk", path}; String[] output = new String[2]; FileExecutor fe = new FileExecutor(); fe.executeCommand(params, output); retval = extractLong(output[0], -3, 3, "%") * 1024; } return retval; } | 54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/db61e2c61b465638a7b78a3fd5ec2b9c98c8dd88/IoHelper.java/clean/src/lib/com/izforge/izpack/util/IoHelper.java |
|
layout = new BoxLayout(centerPanel, BoxLayout.Y_AXIS); | BoxLayout layout = new BoxLayout(centerPanel, BoxLayout.Y_AXIS); | public SimpleFinishPanel(InstallerFrame parent, InstallData idata) { super(parent, idata); vs = new VariableSubstitutor(idata.getVariables()); // 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 centerPanel = new JPanel(); layout = new BoxLayout(centerPanel, BoxLayout.Y_AXIS); centerPanel.setLayout(layout); superLayout.addLayoutComponent(centerPanel, gbConstraints); add(centerPanel); } | 54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/9619b3a25f43787dc92011111668210e06c00c71/SimpleFinishPanel.java/clean/src/lib/com/izforge/izpack/panels/SimpleFinishPanel.java |
int emWave = channel.getLogicalChannel().getEmissionWave().intValue(); | Integer emWave = channel.getLogicalChannel().getEmissionWave(); if (emWave == null) return null; | private static Color getColor(Channel channel) { int emWave = channel.getLogicalChannel().getEmissionWave().intValue(); if (rangeBlue(emWave)) return BLUE_COLOR; if (rangeGreen(emWave)) return GREEN_COLOR; if (rangeRed(emWave)) return RED_COLOR; return null; } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/725d5581a5805696002bff1ec2ecb359495503f5/ColorsFactory.java/buggy/components/rendering/src/omeis/providers/re/ColorsFactory.java |
ZipOutputStream zipOut = packager.addPack(i++, pack.name, pack.required, | ZipOutputStream zipOut = packager.addPack(i++, pack.name, pack.os, pack.required, | public void executeCompiler() throws Exception { // Usefull variables int i; String str; InputStream inStream; // We get the XML data tree XMLElement data = getXMLTree(); // We get the Packager Packager packager = getPackager(); // We add the variable declaration packager.setVariables(getVariables(data)); // We add the info packager.setInfo(getInfo(data)); // We add the GUIPrefs packager.setGUIPrefs(getGUIPrefs(data)); // We add the language packs ArrayList langpacks = getLangpacksCodes(data); Iterator iter = langpacks.iterator(); while (iter.hasNext()) { str = (String) iter.next(); // The language pack inStream = new FileInputStream(Compiler.IZPACK_HOME + "bin" + File.separator + "langpacks" + File.separator + "installer" + File.separator + str + ".xml"); packager.addLangPack(str, inStream); // The flag inStream = new FileInputStream(Compiler.IZPACK_HOME + "bin" + File.separator + "langpacks" + File.separator + "flags" + File.separator + str + ".gif"); packager.addResource("flag." + str, inStream); } // We add the resources ArrayList resources = getResources(data); iter = resources.iterator(); while (iter.hasNext()) { Resource res = (Resource) iter.next(); if (res.parse) { if (null != varMap) { File resFile = new File(res.src); FileInputStream inFile = new FileInputStream(resFile); BufferedInputStream bin = new BufferedInputStream(inFile, 5120); File parsedFile = File.createTempFile("izpp", null, resFile.getParentFile()); FileOutputStream outFile = new FileOutputStream(parsedFile); BufferedOutputStream bout = new BufferedOutputStream(outFile, 5120); VariableSubstitutor vs = new VariableSubstitutor(varMap); vs.substitute(bin, bout, res.type, res.encoding); bin.close(); bout.close(); inFile = new FileInputStream(parsedFile); packager.addResource(res.id, inFile); inFile.close(); parsedFile.delete(); } else { System.err.println("ERROR: no variable is defined. " + res.src + " is not parsed."); inStream = new FileInputStream(res.src); packager.addResource(res.id, inStream); } } else { inStream = new FileInputStream(res.src); packager.addResource(res.id, inStream); } } // We add the native libraries ArrayList natives = getNativeLibraries(data); iter = natives.iterator(); while (iter.hasNext()) { NativeLibrary nat = (NativeLibrary) iter.next(); inStream = new FileInputStream(nat.path); packager.addNativeLibrary(nat.name, inStream); } // We add the additionnal jar files content ArrayList jars = getJars(data); iter = jars.iterator(); while (iter.hasNext()) packager.addJarContent((String) iter.next()); // We add the panels ArrayList panels = getPanels(data); ArrayList panelsOrder = new ArrayList(panels.size()); TreeSet panelsCache = new TreeSet(); iter = panels.iterator(); while (iter.hasNext()) { // We locate the panel classes directory str = (String) iter.next(); File dir = new File(Compiler.IZPACK_HOME + "bin" + File.separator + "panels" + File.separator + str); if (!dir.exists()) throw new Exception(str + " panel does not exist"); // We add the panel in the order array panelsOrder.add(str); // We add each file in the panel folder if (panelsCache.contains(str)) continue; panelsCache.add(str); File[] files = dir.listFiles(); int nf = files.length; for (int j = 0; j < nf; j++) { if (files[j].isDirectory()) continue; FileInputStream inClass = new FileInputStream(files[j]); packager.addPanelClass(files[j].getName(), inClass); } } // We set the panels order packager.setPanelsOrder(panelsOrder); // We add the packs i = 0; ArrayList packs = getPacks(data); iter = packs.iterator(); while (iter.hasNext()) { Pack pack = (Pack) iter.next(); ZipOutputStream zipOut = packager.addPack(i++, pack.name, pack.required, pack.description); ObjectOutputStream objOut = new ObjectOutputStream(zipOut); // We write the pack data objOut.writeInt(pack.packFiles.size()); Iterator iter2 = pack.packFiles.iterator(); long packageBytes = 0; while (iter2.hasNext()) { // Initialisations PackSource p = (PackSource) iter2.next(); File f = new File(p.src); FileInputStream in = new FileInputStream(f); long nbytes = f.length(); String targetFilename = p.targetdir + "/" + f.getName(); // Writing objOut.writeObject(new PackFile(targetFilename, p.os, nbytes, p.override)); byte[] buffer = new byte[5120]; long bytesWritten = 0; int bytesInBuffer; while ((bytesInBuffer = in.read(buffer)) != -1) { objOut.write(buffer, 0, bytesInBuffer); bytesWritten += bytesInBuffer; } if (bytesWritten != nbytes) throw new IOException ("File size mismatch when reading " + f); packageBytes += bytesWritten; in.close(); } packager.packAdded(i - 1, packageBytes); // Write out information about parsable files objOut.writeInt(pack.parsables.size()); iter2 = pack.parsables.iterator(); while (iter2.hasNext()) objOut.writeObject(iter2.next()); // Write out information about executable files objOut.writeInt(pack.executables.size()); iter2 = pack.executables.iterator(); while (iter2.hasNext()) { objOut.writeObject(iter2.next()); } // Cleanup objOut.flush(); zipOut.closeEntry(); } // We ask the packager to finish packager.finish(); } | 54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/c3234416ca8408295e1d45c60daee2efe9c3f5db/Compiler.java/buggy/src/lib/com/izforge/izpack/compiler/Compiler.java |
(new ParsableFile(p.getAttribute("targetfile"), | (new ParsableFile(targetFile, | protected ArrayList getPacks(XMLElement data) throws Exception { // Initialisation ArrayList packs = new ArrayList(); XMLElement root = data.getFirstChildNamed("packs"); // We process each pack markup int npacks = root.getChildrenCount(); for (int i = 0; i < npacks; i++) { XMLElement el = root.getChildAtIndex(i); // Trivial initialisations Pack pack = new Pack(); pack.number = i; pack.name = el.getAttribute("name"); pack.required = el.getAttribute("required").equalsIgnoreCase("yes"); pack.description = el.getFirstChildNamed("description").getContent(); // We get the parsables list Iterator iter = null; Vector children = el.getChildrenNamed("parsable"); if (null != children && !children.isEmpty()) { iter = children.iterator(); while (iter.hasNext()) { XMLElement p = (XMLElement) iter.next(); pack.parsables.add (new ParsableFile(p.getAttribute("targetfile"), p.getAttribute("type", "plain"), p.getAttribute("encoding", null))); } } // We get the executables list children = el.getChildrenNamed("executable"); if (null != children && !children.isEmpty()) { iter = children.iterator(); while (iter.hasNext()) { XMLElement e = (XMLElement) iter.next(); // when to execute this executable int executeOn = ExecutableFile.NEVER; String val = e.getAttribute("stage", "never"); if ("postinstall".compareToIgnoreCase(val) == 0) executeOn = ExecutableFile.POSTINSTALL; else if ("uninstall".compareToIgnoreCase(val) == 0) executeOn = ExecutableFile.UNINSTALL; // main class of this executable String executeClass = e.getAttribute("class"); // type of this executable int executeType = ExecutableFile.BIN; val = e.getAttribute("type", "bin"); if ("jar".compareToIgnoreCase(val) == 0) executeType = ExecutableFile.JAR; // what to do if execution fails int onFailure = ExecutableFile.ASK; val = e.getAttribute("failure", "ask"); if ("abort".compareToIgnoreCase(val) == 0) onFailure = ExecutableFile.ABORT; else if ("warn".compareToIgnoreCase(val) == 0) onFailure = ExecutableFile.WARN; // get arguments for this executable ArrayList argList = new ArrayList(); XMLElement args = e.getFirstChildNamed("args"); if (null != args) { argList = new ArrayList(); Iterator argIterator = args.getChildrenNamed("arg").iterator(); while (argIterator.hasNext()) { XMLElement arg = (XMLElement) argIterator.next(); argList.add(arg.getAttribute("value")); } } // get os info on this executable ArrayList osList = new ArrayList(); Iterator osIterator = e.getChildrenNamed("os").iterator(); while (osIterator.hasNext()) { XMLElement os = (XMLElement) osIterator.next(); osList.add (new com.izforge.izpack.util.Os(os.getAttribute("family", null), os.getAttribute("name", null), os.getAttribute("version", null), os.getAttribute("arch", null))); } pack.executables.add(new ExecutableFile(e.getAttribute("targetfile"), executeType, executeClass, executeOn, onFailure, argList, osList)); } } // We get the files list iter = el.getChildrenNamed("file").iterator(); while (iter.hasNext()) { XMLElement f = (XMLElement) iter.next(); String path = basedir + File.separator + f.getAttribute("src"); File file = new File(path); boolean override = true; if (f.getAttribute("override") != null) override = f.getAttribute("override").equalsIgnoreCase("true"); addFile(file, f.getAttribute("targetdir"), f.getAttribute("os"), override, pack.packFiles); } // We get the fileset list iter = el.getChildrenNamed("fileset").iterator(); while (iter.hasNext()) { XMLElement f = (XMLElement) iter.next(); String path = basedir + File.separator + f.getAttribute("dir"); String casesensitive = f.getAttribute("casesensitive"); // get includes and excludes Vector xcludesList = f.getChildrenNamed("include"); String[] includes = null; XMLElement xclude = null; if (xcludesList.size() > 0) { includes = new String[xcludesList.size()]; for (int j = 0; j < xcludesList.size(); j++) { xclude = (XMLElement) xcludesList.get(j); includes[j] = xclude.getAttribute("name"); } } xcludesList = f.getChildrenNamed("exclude"); String[] excludes = null; xclude = null; if (xcludesList.size() > 0) { excludes = new String[xcludesList.size()]; for (int j = 0; j < xcludesList.size(); j++) { xclude = (XMLElement) xcludesList.get(j); excludes[j] = xclude.getAttribute("name"); } } addFileSet(path, includes, excludes, f.getAttribute("targetdir"), f.getAttribute("os"), pack.packFiles, casesensitive); } // We add the pack packs.add(pack); } // We return the ArrayList return packs; } | 54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/c3234416ca8408295e1d45c60daee2efe9c3f5db/Compiler.java/buggy/src/lib/com/izforge/izpack/compiler/Compiler.java |
pack.executables.add(new ExecutableFile(e.getAttribute("targetfile"), | String targetFile = e.getAttribute("targetfile"); pack.executables.add(new ExecutableFile(targetFile, | protected ArrayList getPacks(XMLElement data) throws Exception { // Initialisation ArrayList packs = new ArrayList(); XMLElement root = data.getFirstChildNamed("packs"); // We process each pack markup int npacks = root.getChildrenCount(); for (int i = 0; i < npacks; i++) { XMLElement el = root.getChildAtIndex(i); // Trivial initialisations Pack pack = new Pack(); pack.number = i; pack.name = el.getAttribute("name"); pack.required = el.getAttribute("required").equalsIgnoreCase("yes"); pack.description = el.getFirstChildNamed("description").getContent(); // We get the parsables list Iterator iter = null; Vector children = el.getChildrenNamed("parsable"); if (null != children && !children.isEmpty()) { iter = children.iterator(); while (iter.hasNext()) { XMLElement p = (XMLElement) iter.next(); pack.parsables.add (new ParsableFile(p.getAttribute("targetfile"), p.getAttribute("type", "plain"), p.getAttribute("encoding", null))); } } // We get the executables list children = el.getChildrenNamed("executable"); if (null != children && !children.isEmpty()) { iter = children.iterator(); while (iter.hasNext()) { XMLElement e = (XMLElement) iter.next(); // when to execute this executable int executeOn = ExecutableFile.NEVER; String val = e.getAttribute("stage", "never"); if ("postinstall".compareToIgnoreCase(val) == 0) executeOn = ExecutableFile.POSTINSTALL; else if ("uninstall".compareToIgnoreCase(val) == 0) executeOn = ExecutableFile.UNINSTALL; // main class of this executable String executeClass = e.getAttribute("class"); // type of this executable int executeType = ExecutableFile.BIN; val = e.getAttribute("type", "bin"); if ("jar".compareToIgnoreCase(val) == 0) executeType = ExecutableFile.JAR; // what to do if execution fails int onFailure = ExecutableFile.ASK; val = e.getAttribute("failure", "ask"); if ("abort".compareToIgnoreCase(val) == 0) onFailure = ExecutableFile.ABORT; else if ("warn".compareToIgnoreCase(val) == 0) onFailure = ExecutableFile.WARN; // get arguments for this executable ArrayList argList = new ArrayList(); XMLElement args = e.getFirstChildNamed("args"); if (null != args) { argList = new ArrayList(); Iterator argIterator = args.getChildrenNamed("arg").iterator(); while (argIterator.hasNext()) { XMLElement arg = (XMLElement) argIterator.next(); argList.add(arg.getAttribute("value")); } } // get os info on this executable ArrayList osList = new ArrayList(); Iterator osIterator = e.getChildrenNamed("os").iterator(); while (osIterator.hasNext()) { XMLElement os = (XMLElement) osIterator.next(); osList.add (new com.izforge.izpack.util.Os(os.getAttribute("family", null), os.getAttribute("name", null), os.getAttribute("version", null), os.getAttribute("arch", null))); } pack.executables.add(new ExecutableFile(e.getAttribute("targetfile"), executeType, executeClass, executeOn, onFailure, argList, osList)); } } // We get the files list iter = el.getChildrenNamed("file").iterator(); while (iter.hasNext()) { XMLElement f = (XMLElement) iter.next(); String path = basedir + File.separator + f.getAttribute("src"); File file = new File(path); boolean override = true; if (f.getAttribute("override") != null) override = f.getAttribute("override").equalsIgnoreCase("true"); addFile(file, f.getAttribute("targetdir"), f.getAttribute("os"), override, pack.packFiles); } // We get the fileset list iter = el.getChildrenNamed("fileset").iterator(); while (iter.hasNext()) { XMLElement f = (XMLElement) iter.next(); String path = basedir + File.separator + f.getAttribute("dir"); String casesensitive = f.getAttribute("casesensitive"); // get includes and excludes Vector xcludesList = f.getChildrenNamed("include"); String[] includes = null; XMLElement xclude = null; if (xcludesList.size() > 0) { includes = new String[xcludesList.size()]; for (int j = 0; j < xcludesList.size(); j++) { xclude = (XMLElement) xcludesList.get(j); includes[j] = xclude.getAttribute("name"); } } xcludesList = f.getChildrenNamed("exclude"); String[] excludes = null; xclude = null; if (xcludesList.size() > 0) { excludes = new String[xcludesList.size()]; for (int j = 0; j < xcludesList.size(); j++) { xclude = (XMLElement) xcludesList.get(j); excludes[j] = xclude.getAttribute("name"); } } addFileSet(path, includes, excludes, f.getAttribute("targetdir"), f.getAttribute("os"), pack.packFiles, casesensitive); } // We add the pack packs.add(pack); } // We return the ArrayList return packs; } | 54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/c3234416ca8408295e1d45c60daee2efe9c3f5db/Compiler.java/buggy/src/lib/com/izforge/izpack/compiler/Compiler.java |
f.getAttribute("targetdir"), | targetDir, | protected ArrayList getPacks(XMLElement data) throws Exception { // Initialisation ArrayList packs = new ArrayList(); XMLElement root = data.getFirstChildNamed("packs"); // We process each pack markup int npacks = root.getChildrenCount(); for (int i = 0; i < npacks; i++) { XMLElement el = root.getChildAtIndex(i); // Trivial initialisations Pack pack = new Pack(); pack.number = i; pack.name = el.getAttribute("name"); pack.required = el.getAttribute("required").equalsIgnoreCase("yes"); pack.description = el.getFirstChildNamed("description").getContent(); // We get the parsables list Iterator iter = null; Vector children = el.getChildrenNamed("parsable"); if (null != children && !children.isEmpty()) { iter = children.iterator(); while (iter.hasNext()) { XMLElement p = (XMLElement) iter.next(); pack.parsables.add (new ParsableFile(p.getAttribute("targetfile"), p.getAttribute("type", "plain"), p.getAttribute("encoding", null))); } } // We get the executables list children = el.getChildrenNamed("executable"); if (null != children && !children.isEmpty()) { iter = children.iterator(); while (iter.hasNext()) { XMLElement e = (XMLElement) iter.next(); // when to execute this executable int executeOn = ExecutableFile.NEVER; String val = e.getAttribute("stage", "never"); if ("postinstall".compareToIgnoreCase(val) == 0) executeOn = ExecutableFile.POSTINSTALL; else if ("uninstall".compareToIgnoreCase(val) == 0) executeOn = ExecutableFile.UNINSTALL; // main class of this executable String executeClass = e.getAttribute("class"); // type of this executable int executeType = ExecutableFile.BIN; val = e.getAttribute("type", "bin"); if ("jar".compareToIgnoreCase(val) == 0) executeType = ExecutableFile.JAR; // what to do if execution fails int onFailure = ExecutableFile.ASK; val = e.getAttribute("failure", "ask"); if ("abort".compareToIgnoreCase(val) == 0) onFailure = ExecutableFile.ABORT; else if ("warn".compareToIgnoreCase(val) == 0) onFailure = ExecutableFile.WARN; // get arguments for this executable ArrayList argList = new ArrayList(); XMLElement args = e.getFirstChildNamed("args"); if (null != args) { argList = new ArrayList(); Iterator argIterator = args.getChildrenNamed("arg").iterator(); while (argIterator.hasNext()) { XMLElement arg = (XMLElement) argIterator.next(); argList.add(arg.getAttribute("value")); } } // get os info on this executable ArrayList osList = new ArrayList(); Iterator osIterator = e.getChildrenNamed("os").iterator(); while (osIterator.hasNext()) { XMLElement os = (XMLElement) osIterator.next(); osList.add (new com.izforge.izpack.util.Os(os.getAttribute("family", null), os.getAttribute("name", null), os.getAttribute("version", null), os.getAttribute("arch", null))); } pack.executables.add(new ExecutableFile(e.getAttribute("targetfile"), executeType, executeClass, executeOn, onFailure, argList, osList)); } } // We get the files list iter = el.getChildrenNamed("file").iterator(); while (iter.hasNext()) { XMLElement f = (XMLElement) iter.next(); String path = basedir + File.separator + f.getAttribute("src"); File file = new File(path); boolean override = true; if (f.getAttribute("override") != null) override = f.getAttribute("override").equalsIgnoreCase("true"); addFile(file, f.getAttribute("targetdir"), f.getAttribute("os"), override, pack.packFiles); } // We get the fileset list iter = el.getChildrenNamed("fileset").iterator(); while (iter.hasNext()) { XMLElement f = (XMLElement) iter.next(); String path = basedir + File.separator + f.getAttribute("dir"); String casesensitive = f.getAttribute("casesensitive"); // get includes and excludes Vector xcludesList = f.getChildrenNamed("include"); String[] includes = null; XMLElement xclude = null; if (xcludesList.size() > 0) { includes = new String[xcludesList.size()]; for (int j = 0; j < xcludesList.size(); j++) { xclude = (XMLElement) xcludesList.get(j); includes[j] = xclude.getAttribute("name"); } } xcludesList = f.getChildrenNamed("exclude"); String[] excludes = null; xclude = null; if (xcludesList.size() > 0) { excludes = new String[xcludesList.size()]; for (int j = 0; j < xcludesList.size(); j++) { xclude = (XMLElement) xcludesList.get(j); excludes[j] = xclude.getAttribute("name"); } } addFileSet(path, includes, excludes, f.getAttribute("targetdir"), f.getAttribute("os"), pack.packFiles, casesensitive); } // We add the pack packs.add(pack); } // We return the ArrayList return packs; } | 54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/c3234416ca8408295e1d45c60daee2efe9c3f5db/Compiler.java/buggy/src/lib/com/izforge/izpack/compiler/Compiler.java |
this.sourcePath = src.getPath(); | public PackFile(File src, String target, List osList, int override) throws FileNotFoundException { if (! src.exists()) // allows cleaner client co throw new FileNotFoundException("No such file: "+src); if ('/' != File.separatorChar) target = target.replace(File.separatorChar, '/'); if (target.endsWith("/")) target = target.substring(0, target.length()-1); this.targetPath = target; this.osConstraints = osList; this.override = override; this.length = src.length(); this.mtime = src.lastModified(); this.isDirectory = src.isDirectory(); } | 54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/670d2dce35e3033459b7343ab34ed921bd2331ed/PackFile.java/buggy/src/lib/com/izforge/izpack/PackFile.java |
|
public Info() { } | public Info() { } | public Info() { } | 54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/6e8ab3930a21f787bcd0f3cf0b9937f9d50c80c0/Info.java/buggy/src/lib/com/izforge/izpack/Info.java |
ZipInputStream skeleton_is = new ZipInputStream (getClass().getResourceAsStream("/lib/kunststoff.jar")); if (skeleton_is == null) | InputStream istream = getClass().getResourceAsStream("/lib/kunststoff.jar"); ZipInputStream skeleton_is; if (istream != null) { skeleton_is = new ZipInputStream(istream); } else | public StdKunststoffPackager(String outputFilename, PackagerListener plistener) throws Exception { super(outputFilename, plistener); // Copies the Kunststoff library sendMsg("Copying the Kunststoff library ..."); ZipInputStream skeleton_is = new ZipInputStream (getClass().getResourceAsStream("/lib/kunststoff.jar")); if (skeleton_is == null) { skeleton_is = new JarInputStream (new FileInputStream ( Compiler.IZPACK_HOME + "lib" + File.separator + "kunststoff.jar")); } ZipEntry zentry; while ((zentry = skeleton_is.getNextEntry()) != null) { // ugly hack: may not add a directory twice, therefore add no directories if (zentry.isDirectory()) continue; // Puts a new entry outJar.putNextEntry(new ZipEntry(zentry.getName())); // Copy the data copyStream(skeleton_is, outJar); outJar.closeEntry(); skeleton_is.closeEntry(); } } | 54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/38ba7467fab050838ce0ecf38f3a49960ff5612f/StdKunststoffPackager.java/buggy/src/lib/com/izforge/izpack/compiler/StdKunststoffPackager.java |
public ParsableFile(String path, String type, String encoding) { this.path = path; this.type = type; this.encoding = encoding; } | public ParsableFile() {} | public ParsableFile(String path, String type, String encoding) { this.path = path; this.type = type; this.encoding = encoding; } | 54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/80e14fc27a7fb67b4c5101aace4a3e9167e551e3/ParsableFile.java/buggy/src/lib/com/izforge/izpack/ParsableFile.java |
public ExecutableFile(String path, int type, String mainClass, int executionStage, int onFailure, java.util.ArrayList argList, java.util.ArrayList osList) | public ExecutableFile() | public ExecutableFile(String path, int type, String mainClass, int executionStage, int onFailure, java.util.ArrayList argList, java.util.ArrayList osList) { this.path = path; this.mainClass = mainClass; this.type = type; this.executionStage = executionStage; this.onFailure = onFailure; this.argList = argList; this.osList = osList; } | 54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/85d99afd9a4052ba0a6796445a7aa6be8c4054c9/ExecutableFile.java/buggy/src/lib/com/izforge/izpack/ExecutableFile.java |
this.path = path; this.mainClass = mainClass; this.type = type; this.executionStage = executionStage; this.onFailure = onFailure; this.argList = argList; this.osList = osList; | this.path = null; executionStage = NEVER; mainClass = null; type = BIN; onFailure = ASK; osList = new ArrayList(); argList = new ArrayList(); | public ExecutableFile(String path, int type, String mainClass, int executionStage, int onFailure, java.util.ArrayList argList, java.util.ArrayList osList) { this.path = path; this.mainClass = mainClass; this.type = type; this.executionStage = executionStage; this.onFailure = onFailure; this.argList = argList; this.osList = osList; } | 54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/85d99afd9a4052ba0a6796445a7aa6be8c4054c9/ExecutableFile.java/buggy/src/lib/com/izforge/izpack/ExecutableFile.java |
if(newlyCreated) { throw new NoSuchElementException("Could not create a validated object"); } | public synchronized Object borrowObject() throws Exception { assertOpen(); long starttime = System.currentTimeMillis(); for(;;) { ObjectTimestampPair pair = null; // if there are any sleeping, just grab one of those try { pair = (ObjectTimestampPair)(_pool.removeFirst()); } catch(NoSuchElementException e) { ; /* ignored */ } // otherwise if(null == pair) { // check if we can create one // (note we know that the num sleeping is 0, else we wouldn't be here) if(_maxActive <= 0 || _numActive < _maxActive) { Object obj = _factory.makeObject(); pair = new ObjectTimestampPair(obj); } else { // the pool is exhausted switch(_whenExhaustedAction) { case WHEN_EXHAUSTED_GROW: Object obj = _factory.makeObject(); 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(pair.value); if(_testOnBorrow && !_factory.validateObject(pair.value)) { _factory.destroyObject(pair.value); } else { _numActive++; return pair.value; } } } | 50977 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50977/feea8a0d3c7e4912fe7929bd4f393db752cfaacf/GenericObjectPool.java/clean/src/java/org/apache/commons/pool/impl/GenericObjectPool.java |
|
if ((_maxActive <= 0 || active < _maxActive) && (_maxTotal <= 0 || _totalActive + _totalIdle < _maxTotal)) { | if ((_maxActive < 0 || active < _maxActive) && (_maxTotal < 0 || _totalActive + _totalIdle < _maxTotal)) { | public synchronized Object borrowObject(Object key) throws Exception { long starttime = System.currentTimeMillis(); boolean newlyCreated = false; for(;;) { CursorableLinkedList pool = (CursorableLinkedList)(_poolMap.get(key)); if(null == pool) { pool = new CursorableLinkedList(); _poolMap.put(key,pool); _poolList.add(key); } ObjectTimestampPair pair = null; // if there are any sleeping, just grab one of those try { pair = (ObjectTimestampPair)(pool.removeFirst()); if(null != pair) { _totalIdle--; } } catch(NoSuchElementException e) { /* ignored */ } // otherwise if(null == pair) { // if there is a totalMaxActive and we are at the limit then // we have to make room if ((_maxTotal > 0) && (_totalActive + _totalIdle >= _maxTotal)) { clearOldest(); } // check if we can create one // (note we know that the num sleeping is 0, else we wouldn't be here) int active = getActiveCount(key); if ((_maxActive <= 0 || active < _maxActive) && (_maxTotal <= 0 || _totalActive + _totalIdle < _maxTotal)) { Object obj = _factory.makeObject(key); pair = new ObjectTimestampPair(obj); newlyCreated = true; } else { // the pool is exhausted switch(_whenExhaustedAction) { case WHEN_EXHAUSTED_GROW: Object obj = _factory.makeObject(key); pair = new ObjectTimestampPair(obj); break; case WHEN_EXHAUSTED_FAIL: throw new NoSuchElementException(); case WHEN_EXHAUSTED_BLOCK: try { if(_maxWait <= 0) { wait(); } else { wait(_maxWait); } } catch(InterruptedException e) { // ignored } if(_maxWait > 0 && ((System.currentTimeMillis() - starttime) >= _maxWait)) { throw new NoSuchElementException("Timeout waiting for idle object"); } else { continue; // keep looping } default: throw new IllegalArgumentException("whenExhaustedAction " + _whenExhaustedAction + " not recognized."); } } } _factory.activateObject(key,pair.value); if(_testOnBorrow && !_factory.validateObject(key,pair.value)) { _factory.destroyObject(key,pair.value); if(newlyCreated) { throw new NoSuchElementException("Could not create a validated object"); } // else keep looping } else { incrementActiveCount(key); return pair.value; } } } | 50977 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50977/0ad4050ad4013e4a3e6ba97cb3927331e1636c6e/GenericKeyedObjectPool.java/clean/src/java/org/apache/commons/pool/impl/GenericKeyedObjectPool.java |
public int getNumActive() throws UnsupportedOperationException { | public int getNumActive(Object key) throws UnsupportedOperationException { | public int getNumActive() throws UnsupportedOperationException { return -1; } | 50977 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50977/1313111fc820c43662b3b98672f70316d84ee80c/BaseKeyedObjectPool.java/buggy/src/java/org/apache/commons/pool/BaseKeyedObjectPool.java |
public int getNumIdle() throws UnsupportedOperationException { | public int getNumIdle(Object key) throws UnsupportedOperationException { | public int getNumIdle() throws UnsupportedOperationException { return -1; } | 50977 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50977/1313111fc820c43662b3b98672f70316d84ee80c/BaseKeyedObjectPool.java/buggy/src/java/org/apache/commons/pool/BaseKeyedObjectPool.java |
} | public boolean isValidated() { if( super.isValidated()) { if( verifyVersion() ) { idata.setVariable(getVariableName(),pathSelectionPanel.getPath()); return( true ); } // Bad version detected. String min = getMinVersion(); String max = getMaxVersion(); StringBuffer message = new StringBuffer(); message.append(parent.langpack.getString("JDKPathPanel.badVersion1")). append(getDetectedVersion()). append(parent.langpack.getString("JDKPathPanel.badVersion2")); if( min != null&& max != null ) message.append( min ).append(" - ").append( max ); else if( min != null ) message.append( " >= " ).append(min); else if( max != null ) message.append( " <= " ).append(max); message.append(parent.langpack.getString("JDKPathPanel.badVersion3")); if( askQuestion(parent.langpack.getString("installer.warning"),message.toString(), AbstractUIHandler.CHOICES_YES_NO, AbstractUIHandler.ANSWER_NO ) == AbstractUIHandler.ANSWER_YES) return( true); } return( false ); } | 54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/8fdcdff15c7db3919d399140ef70a041de92f8ab/JDKPathPanel.java/clean/src/lib/com/izforge/izpack/panels/JDKPathPanel.java |
|
public int askQuestion (String title, String question, int choices, int default_choice) | public int askQuestion(String title, String question, int choices) | public int askQuestion (String title, String question, int choices, int default_choice) { int jo_choices = 0; if (choices == AbstractUIHandler.CHOICES_YES_NO) jo_choices = JOptionPane.YES_NO_OPTION; else if (choices == AbstractUIHandler.CHOICES_YES_NO_CANCEL) jo_choices = JOptionPane.YES_NO_CANCEL_OPTION; int user_choice = JOptionPane.showConfirmDialog ( this, (Object)question, title, jo_choices, JOptionPane.QUESTION_MESSAGE); if (user_choice == JOptionPane.CANCEL_OPTION) return AbstractUIHandler.ANSWER_CANCEL; if (user_choice == JOptionPane.YES_OPTION) return AbstractUIHandler.ANSWER_YES; if (user_choice == JOptionPane.NO_OPTION) return AbstractUIHandler.ANSWER_NO; return default_choice; } | 54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/6e8ab3930a21f787bcd0f3cf0b9937f9d50c80c0/IzPanel.java/buggy/src/lib/com/izforge/izpack/installer/IzPanel.java |
int jo_choices = 0; if (choices == AbstractUIHandler.CHOICES_YES_NO) jo_choices = JOptionPane.YES_NO_OPTION; else if (choices == AbstractUIHandler.CHOICES_YES_NO_CANCEL) jo_choices = JOptionPane.YES_NO_CANCEL_OPTION; int user_choice = JOptionPane.showConfirmDialog ( this, (Object)question, title, jo_choices, JOptionPane.QUESTION_MESSAGE); if (user_choice == JOptionPane.CANCEL_OPTION) return AbstractUIHandler.ANSWER_CANCEL; if (user_choice == JOptionPane.YES_OPTION) return AbstractUIHandler.ANSWER_YES; if (user_choice == JOptionPane.NO_OPTION) return AbstractUIHandler.ANSWER_NO; return default_choice; | return askQuestion(title, question, choices, -1); | public int askQuestion (String title, String question, int choices, int default_choice) { int jo_choices = 0; if (choices == AbstractUIHandler.CHOICES_YES_NO) jo_choices = JOptionPane.YES_NO_OPTION; else if (choices == AbstractUIHandler.CHOICES_YES_NO_CANCEL) jo_choices = JOptionPane.YES_NO_CANCEL_OPTION; int user_choice = JOptionPane.showConfirmDialog ( this, (Object)question, title, jo_choices, JOptionPane.QUESTION_MESSAGE); if (user_choice == JOptionPane.CANCEL_OPTION) return AbstractUIHandler.ANSWER_CANCEL; if (user_choice == JOptionPane.YES_OPTION) return AbstractUIHandler.ANSWER_YES; if (user_choice == JOptionPane.NO_OPTION) return AbstractUIHandler.ANSWER_NO; return default_choice; } | 54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/6e8ab3930a21f787bcd0f3cf0b9937f9d50c80c0/IzPanel.java/buggy/src/lib/com/izforge/izpack/installer/IzPanel.java |
return value; | return copy; | public IObject[] saveAndReturnArray(IObject[] graph) { return doAction( graph, new UpdateAction<IObject[]>(){ @Override public IObject[] run(IObject[] value, UpdateFilter filter) { IObject[] copy = new IObject[value.length]; for (int i = 0; i < value.length; i++) { copy[i] = internalSave( value[i], filter ); } return value; } }); } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/6455a63c8e973145b20617428fadd2edd63e3a4b/UpdateImpl.java/clean/components/server/src/ome/logic/UpdateImpl.java |
return value; | return copy; | public IObject[] run(IObject[] value, UpdateFilter filter) { IObject[] copy = new IObject[value.length]; for (int i = 0; i < value.length; i++) { copy[i] = internalSave( value[i], filter ); } return value; } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/6455a63c8e973145b20617428fadd2edd63e3a4b/UpdateImpl.java/clean/components/server/src/ome/logic/UpdateImpl.java |
return value; | return copy; | public void saveArray(IObject[] graph) { doAction( graph, new UpdateAction<IObject[]>(){ @Override public IObject[] run(IObject[] value, UpdateFilter filter) { IObject[] copy = new IObject[value.length]; for (int i = 0; i < value.length; i++) { copy[i] = internalSave( value[i], filter ); } return value; } }); } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/6455a63c8e973145b20617428fadd2edd63e3a4b/UpdateImpl.java/clean/components/server/src/ome/logic/UpdateImpl.java |
return value; | return copy; | public IObject[] run(IObject[] value, UpdateFilter filter) { IObject[] copy = new IObject[value.length]; for (int i = 0; i < value.length; i++) { copy[i] = internalSave( value[i], filter ); } return value; } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/6455a63c8e973145b20617428fadd2edd63e3a4b/UpdateImpl.java/clean/components/server/src/ome/logic/UpdateImpl.java |
public void activateObject(Object obj) { | public void activateObject(Object obj) throws Exception { | public void activateObject(Object obj) { } | 50977 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50977/0a89bcddbb9d1ce0d88185823be827ca474fd6ae/BasePoolableObjectFactory.java/buggy/src/java/org/apache/commons/pool/BasePoolableObjectFactory.java |
public void destroyObject(Object obj) { | public void destroyObject(Object obj) throws Exception { | public void destroyObject(Object obj) { } | 50977 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50977/0a89bcddbb9d1ce0d88185823be827ca474fd6ae/BasePoolableObjectFactory.java/buggy/src/java/org/apache/commons/pool/BasePoolableObjectFactory.java |
public void passivateObject(Object obj) { | public void passivateObject(Object obj) throws Exception { | public void passivateObject(Object obj) { } | 50977 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50977/0a89bcddbb9d1ce0d88185823be827ca474fd6ae/BasePoolableObjectFactory.java/buggy/src/java/org/apache/commons/pool/BasePoolableObjectFactory.java |
if (t.isAlive() == false) return; | if (!t.isAlive()) return; | private void stopMonitor(OutputMonitor m, Thread t) { // taken from com.izforge.izpack.util.FileExecutor m.doStop(); long softTimeout = 500; try { t.join(softTimeout); } catch (InterruptedException e) {} if (t.isAlive() == false) return; t.interrupt(); long hardTimeout = 500; try { t.join(hardTimeout); } catch (InterruptedException e) {} } | 54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/9619b3a25f43787dc92011111668210e06c00c71/ProcessPanelWorker.java/clean/src/lib/com/izforge/izpack/installer/ProcessPanelWorker.java |
this.spec = (XMLElement) parser.parse(); | spec = (XMLElement) parser.parse(); | private boolean readSpec() throws IOException { InputStream input; try { input = ResourceManager.getInstance().getInputStream(SPEC_RESOURCE_NAME); } catch (Exception e) { e.printStackTrace(); return false; } StdXMLParser parser = new StdXMLParser(); parser.setBuilder(new StdXMLBuilder()); parser.setValidator(new NonValidator()); try { parser.setReader(new StdXMLReader(input)); this.spec = (XMLElement) parser.parse(); } catch (Exception e) { System.err.println("Error parsing XML specification for processing."); System.err.println(e.toString()); return false; } if (!this.spec.hasChildren()) return false; // Handle logfile XMLElement lfd = spec.getFirstChildNamed("logfiledir"); if (lfd != null) { logfiledir = lfd.getContent(); } for (Iterator job_it = this.spec.getChildrenNamed("job").iterator(); job_it.hasNext();) { XMLElement job_el = (XMLElement) job_it.next(); // ExecuteForPack Patch // Check if processing required for pack Vector forPacks = job_el.getChildrenNamed("executeForPack"); if (!jobRequiredFor(forPacks)) { continue; } // first check OS constraints - skip jobs not suited for this OS List constraints = OsConstraint.getOsList(job_el); if (OsConstraint.oneMatchesCurrentSystem(constraints)) { List ef_list = new ArrayList(); String job_name = job_el.getAttribute("name", ""); for (Iterator ef_it = job_el.getChildrenNamed("executefile").iterator(); ef_it .hasNext();) { XMLElement ef = (XMLElement) ef_it.next(); String ef_name = ef.getAttribute("name"); if ((ef_name == null) || (ef_name.length() == 0)) { System.err.println("missing \"name\" attribute for <executefile>"); return false; } List args = new ArrayList(); for (Iterator arg_it = ef.getChildrenNamed("arg").iterator(); arg_it.hasNext();) { XMLElement arg_el = (XMLElement) arg_it.next(); String arg_val = arg_el.getContent(); args.add(arg_val); } ef_list.add(new ExecutableFile(ef_name, args)); } for (Iterator ef_it = job_el.getChildrenNamed("executeclass").iterator(); ef_it .hasNext();) { XMLElement ef = (XMLElement) ef_it.next(); String ef_name = ef.getAttribute("name"); if ((ef_name == null) || (ef_name.length() == 0)) { System.err.println("missing \"name\" attribute for <executeclass>"); return false; } List args = new ArrayList(); for (Iterator arg_it = ef.getChildrenNamed("arg").iterator(); arg_it.hasNext();) { XMLElement arg_el = (XMLElement) arg_it.next(); String arg_val = arg_el.getContent(); args.add(arg_val); } ef_list.add(new ExecutableClass(ef_name, args)); } this.jobs.add(new ProcessingJob(job_name, ef_list)); } } return true; } | 54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/9619b3a25f43787dc92011111668210e06c00c71/ProcessPanelWorker.java/clean/src/lib/com/izforge/izpack/installer/ProcessPanelWorker.java |
if (!this.spec.hasChildren()) return false; | if (!spec.hasChildren()) return false; | private boolean readSpec() throws IOException { InputStream input; try { input = ResourceManager.getInstance().getInputStream(SPEC_RESOURCE_NAME); } catch (Exception e) { e.printStackTrace(); return false; } StdXMLParser parser = new StdXMLParser(); parser.setBuilder(new StdXMLBuilder()); parser.setValidator(new NonValidator()); try { parser.setReader(new StdXMLReader(input)); this.spec = (XMLElement) parser.parse(); } catch (Exception e) { System.err.println("Error parsing XML specification for processing."); System.err.println(e.toString()); return false; } if (!this.spec.hasChildren()) return false; // Handle logfile XMLElement lfd = spec.getFirstChildNamed("logfiledir"); if (lfd != null) { logfiledir = lfd.getContent(); } for (Iterator job_it = this.spec.getChildrenNamed("job").iterator(); job_it.hasNext();) { XMLElement job_el = (XMLElement) job_it.next(); // ExecuteForPack Patch // Check if processing required for pack Vector forPacks = job_el.getChildrenNamed("executeForPack"); if (!jobRequiredFor(forPacks)) { continue; } // first check OS constraints - skip jobs not suited for this OS List constraints = OsConstraint.getOsList(job_el); if (OsConstraint.oneMatchesCurrentSystem(constraints)) { List ef_list = new ArrayList(); String job_name = job_el.getAttribute("name", ""); for (Iterator ef_it = job_el.getChildrenNamed("executefile").iterator(); ef_it .hasNext();) { XMLElement ef = (XMLElement) ef_it.next(); String ef_name = ef.getAttribute("name"); if ((ef_name == null) || (ef_name.length() == 0)) { System.err.println("missing \"name\" attribute for <executefile>"); return false; } List args = new ArrayList(); for (Iterator arg_it = ef.getChildrenNamed("arg").iterator(); arg_it.hasNext();) { XMLElement arg_el = (XMLElement) arg_it.next(); String arg_val = arg_el.getContent(); args.add(arg_val); } ef_list.add(new ExecutableFile(ef_name, args)); } for (Iterator ef_it = job_el.getChildrenNamed("executeclass").iterator(); ef_it .hasNext();) { XMLElement ef = (XMLElement) ef_it.next(); String ef_name = ef.getAttribute("name"); if ((ef_name == null) || (ef_name.length() == 0)) { System.err.println("missing \"name\" attribute for <executeclass>"); return false; } List args = new ArrayList(); for (Iterator arg_it = ef.getChildrenNamed("arg").iterator(); arg_it.hasNext();) { XMLElement arg_el = (XMLElement) arg_it.next(); String arg_val = arg_el.getContent(); args.add(arg_val); } ef_list.add(new ExecutableClass(ef_name, args)); } this.jobs.add(new ProcessingJob(job_name, ef_list)); } } return true; } | 54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/9619b3a25f43787dc92011111668210e06c00c71/ProcessPanelWorker.java/clean/src/lib/com/izforge/izpack/installer/ProcessPanelWorker.java |
for (Iterator job_it = this.spec.getChildrenNamed("job").iterator(); job_it.hasNext();) | for (Iterator job_it = spec.getChildrenNamed("job").iterator(); job_it.hasNext();) | private boolean readSpec() throws IOException { InputStream input; try { input = ResourceManager.getInstance().getInputStream(SPEC_RESOURCE_NAME); } catch (Exception e) { e.printStackTrace(); return false; } StdXMLParser parser = new StdXMLParser(); parser.setBuilder(new StdXMLBuilder()); parser.setValidator(new NonValidator()); try { parser.setReader(new StdXMLReader(input)); this.spec = (XMLElement) parser.parse(); } catch (Exception e) { System.err.println("Error parsing XML specification for processing."); System.err.println(e.toString()); return false; } if (!this.spec.hasChildren()) return false; // Handle logfile XMLElement lfd = spec.getFirstChildNamed("logfiledir"); if (lfd != null) { logfiledir = lfd.getContent(); } for (Iterator job_it = this.spec.getChildrenNamed("job").iterator(); job_it.hasNext();) { XMLElement job_el = (XMLElement) job_it.next(); // ExecuteForPack Patch // Check if processing required for pack Vector forPacks = job_el.getChildrenNamed("executeForPack"); if (!jobRequiredFor(forPacks)) { continue; } // first check OS constraints - skip jobs not suited for this OS List constraints = OsConstraint.getOsList(job_el); if (OsConstraint.oneMatchesCurrentSystem(constraints)) { List ef_list = new ArrayList(); String job_name = job_el.getAttribute("name", ""); for (Iterator ef_it = job_el.getChildrenNamed("executefile").iterator(); ef_it .hasNext();) { XMLElement ef = (XMLElement) ef_it.next(); String ef_name = ef.getAttribute("name"); if ((ef_name == null) || (ef_name.length() == 0)) { System.err.println("missing \"name\" attribute for <executefile>"); return false; } List args = new ArrayList(); for (Iterator arg_it = ef.getChildrenNamed("arg").iterator(); arg_it.hasNext();) { XMLElement arg_el = (XMLElement) arg_it.next(); String arg_val = arg_el.getContent(); args.add(arg_val); } ef_list.add(new ExecutableFile(ef_name, args)); } for (Iterator ef_it = job_el.getChildrenNamed("executeclass").iterator(); ef_it .hasNext();) { XMLElement ef = (XMLElement) ef_it.next(); String ef_name = ef.getAttribute("name"); if ((ef_name == null) || (ef_name.length() == 0)) { System.err.println("missing \"name\" attribute for <executeclass>"); return false; } List args = new ArrayList(); for (Iterator arg_it = ef.getChildrenNamed("arg").iterator(); arg_it.hasNext();) { XMLElement arg_el = (XMLElement) arg_it.next(); String arg_val = arg_el.getContent(); args.add(arg_val); } ef_list.add(new ExecutableClass(ef_name, args)); } this.jobs.add(new ProcessingJob(job_name, ef_list)); } } return true; } | 54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/9619b3a25f43787dc92011111668210e06c00c71/ProcessPanelWorker.java/clean/src/lib/com/izforge/izpack/installer/ProcessPanelWorker.java |
this.processingThread = new Thread(this, "processing thread"); | Thread processingThread = new Thread(this, "processing thread"); | public void startThread() { this.processingThread = new Thread(this, "processing thread"); // will call this.run() this.processingThread.start(); } | 54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/9619b3a25f43787dc92011111668210e06c00c71/ProcessPanelWorker.java/clean/src/lib/com/izforge/izpack/installer/ProcessPanelWorker.java |
this.processingThread.start(); | processingThread.start(); | public void startThread() { this.processingThread = new Thread(this, "processing thread"); // will call this.run() this.processingThread.start(); } | 54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/9619b3a25f43787dc92011111668210e06c00c71/ProcessPanelWorker.java/clean/src/lib/com/izforge/izpack/installer/ProcessPanelWorker.java |
protected TestObjectPoolFactory(final String name) { | public TestObjectPoolFactory(final String name) { | protected TestObjectPoolFactory(final String name) { super(name); } | 50977 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50977/c4373c1dc85ccc9f5ff8a6633f2a8c59693dc20b/TestObjectPoolFactory.java/clean/src/test/org/apache/commons/pool/TestObjectPoolFactory.java |
try { String resource = LANG_FILE_NAME + "_" + idata.localeISO3; this.langpack = new LocaleDatabase(ResourceManager.getInstance().getInputStream(resource)); } catch (Throwable exception) {} | public Unpacker( AutomatedInstallData idata, AbstractUIProgressHandler handler) { super("IzPack - Unpacker thread"); this.idata = idata; this.handler = handler; // Initialize the variable substitutor vs = new VariableSubstitutor(idata.getVariables()); } | 54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/97af55405ebcecbed7b6ed9f6138e21b9b76ce0d/Unpacker.java/buggy/src/lib/com/izforge/izpack/installer/Unpacker.java |
|
informListeners(customActions, InstallerListener.BEFORE_PACK,packs.get(i), | informListeners(customActions, InstallerListener.BEFORE_PACK,packs.get(i), | public void run() { instances.add(this); try { // // Initialisations FileOutputStream out = null; ArrayList parsables = new ArrayList(); ArrayList executables = new ArrayList(); ArrayList updatechecks = new ArrayList(); List packs = idata.selectedPacks; int npacks = packs.size(); handler.startAction("Unpacking", npacks); udata = UninstallData.getInstance(); // Custom action listener stuff --- load listeners ---- List [] customActions = getCustomActions(); // Custom action listener stuff --- beforePacks ---- informListeners(customActions, InstallerListener.BEFORE_PACKS,idata, new Integer(npacks), handler); // We unpack the selected packs for (int i = 0; i < npacks; i++) { // We get the pack stream int n = idata.allPacks.indexOf(packs.get(i)); // Custom action listener stuff --- beforePack ---- informListeners(customActions, InstallerListener.BEFORE_PACK,packs.get(i), new Integer(npacks), handler); ObjectInputStream objIn = new ObjectInputStream(getPackAsStream(n)); // We unpack the files int nfiles = objIn.readInt(); handler.nextStep(((Pack) packs.get(i)).name, i + 1, nfiles); for (int j = 0; j < nfiles; j++) { // We read the header PackFile pf = (PackFile) objIn.readObject(); if (OsConstraint.oneMatchesCurrentSystem(pf.osConstraints())) { // We translate & build the path String path = translatePath(pf.getTargetPath()); File pathFile = new File(path); File dest = pathFile; if (! pf.isDirectory()) dest = pathFile.getParentFile(); if (!dest.exists()) { // If there are custom actions which would be called at // creating a directory, create it recursively. List fileListeners = customActions[customActions.length - 1]; if( fileListeners != null && fileListeners.size() > 0 ) mkDirsWithEnhancement(dest, pf, customActions ); else // Create it in on step. { if (!dest.mkdirs()) { handler.emitError( "Error creating directories", "Could not create directory\n" + dest.getPath()); handler.stopAction(); return; } } } if (pf.isDirectory()) continue; // Custom action listener stuff --- beforeFile ---- informListeners(customActions, InstallerListener.BEFORE_FILE,pathFile, pf, null); // We add the path to the log, udata.addFile(path); handler.progress(j, path); //if this file exists and should not be overwritten, check //what to do if ((pathFile.exists()) && (pf.override() != PackFile.OVERRIDE_TRUE)) { boolean overwritefile = false; // don't overwrite file if the user said so if (pf.override() != PackFile.OVERRIDE_FALSE) { if (pf.override() == PackFile.OVERRIDE_TRUE) { overwritefile = true; } else if (pf.override() == PackFile.OVERRIDE_UPDATE) { // check mtime of involved files // (this is not 100% perfect, because the already existing file might // still be modified but the new installed is just a bit newer; we would // need the creation time of the existing file or record with which mtime // it was installed...) overwritefile = (pathFile.lastModified() < pf.lastModified()); } else { int def_choice = -1; if (pf.override() == PackFile.OVERRIDE_ASK_FALSE) def_choice = AbstractUIHandler.ANSWER_NO; if (pf.override() == PackFile.OVERRIDE_ASK_TRUE) def_choice = AbstractUIHandler.ANSWER_YES; int answer = handler.askQuestion( idata.langpack.getString("InstallPanel.overwrite.title") + pathFile.getName(), idata.langpack.getString( "InstallPanel.overwrite.question") + pathFile.getAbsolutePath(), AbstractUIHandler.CHOICES_YES_NO, def_choice); overwritefile = (answer == AbstractUIHandler.ANSWER_YES); } } if (!overwritefile) { if (!pf.isBackReference() && !((Pack)packs.get(i)).loose) objIn.skip(pf.length()); continue; } } // We copy the file out = new FileOutputStream(pathFile); byte[] buffer = new byte[5120]; long bytesCopied = 0; InputStream pis = objIn; if (pf.isBackReference()) { InputStream is = getPackAsStream(pf.previousPackNumber); pis = new ObjectInputStream(is); //must wrap for blockdata use by objectstream (otherwise strange result) //skip on underlaying stream (for some reason not possible on ObjectStream) is.skip(pf.offsetInPreviousPack - 4); //but the stream header is now already read (== 4 bytes) } else if(((Pack)packs.get(i)).loose) { pis = new FileInputStream(pf.sourcePath); } while (bytesCopied < pf.length()) { int maxBytes = (int)Math.min(pf.length() - bytesCopied, buffer.length); int bytesInBuffer = pis.read(buffer, 0, maxBytes); if (bytesInBuffer == -1) throw new IOException("Unexpected end of stream"); out.write(buffer, 0, bytesInBuffer); bytesCopied += bytesInBuffer; } // Cleanings out.close(); if (pis != objIn) pis.close(); // Set file modification time if specified if (pf.lastModified() >= 0) pathFile.setLastModified(pf.lastModified()); // Custom action listener stuff --- afterFile ---- informListeners(customActions, InstallerListener.AFTER_FILE,pathFile, pf, null); } else { if (!pf.isBackReference()) objIn.skip(pf.length()); } } // Load information about parsable files int numParsables = objIn.readInt(); for (int k = 0; k < numParsables; k++) { ParsableFile pf = (ParsableFile) objIn.readObject(); pf.path = translatePath(pf.path); parsables.add(pf); } // Load information about executable files int numExecutables = objIn.readInt(); for (int k = 0; k < numExecutables; k++) { ExecutableFile ef = (ExecutableFile) objIn.readObject(); ef.path = translatePath(ef.path); if (null != ef.argList && !ef.argList.isEmpty()) { String arg = null; for (int j = 0; j < ef.argList.size(); j++) { arg = (String) ef.argList.get(j); arg = translatePath(arg); ef.argList.set(j, arg); } } executables.add(ef); if (ef.executionStage == ExecutableFile.UNINSTALL) { udata.addExecutable(ef); } } // Custom action listener stuff --- uninstall data ---- handleAdditionalUninstallData(udata, customActions); // Load information about updatechecks int numUpdateChecks = objIn.readInt(); for (int k = 0; k < numUpdateChecks; k++) { UpdateCheck uc = (UpdateCheck) objIn.readObject(); updatechecks.add(uc); } objIn.close(); // Custom action listener stuff --- afterPack ---- informListeners(customActions, InstallerListener.AFTER_PACK, packs.get(i), new Integer(i), handler); } // We use the scripts parser ScriptParser parser = new ScriptParser(parsables, vs); parser.parseFiles(); // We use the file executor FileExecutor executor = new FileExecutor(executables); if (executor.executeFiles(ExecutableFile.POSTINSTALL, handler) != 0) handler.emitError( "File execution failed", "The installation was not completed"); // We put the uninstaller (it's not yet complete...) putUninstaller(); // update checks _after_ uninstaller was put, so we don't delete it performUpdateChecks(updatechecks); // Custom action listener stuff --- afterPacks ---- informListeners(customActions, InstallerListener.AFTER_PACKS,idata, handler, null); // The end :-) handler.stopAction(); } catch (Exception err) { // TODO: finer grained error handling with useful error messages handler.stopAction(); handler.emitError("An error occured", err.toString()); err.printStackTrace(); } finally { instances.remove(instances.indexOf(this)); } } | 54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/97af55405ebcecbed7b6ed9f6138e21b9b76ce0d/Unpacker.java/buggy/src/lib/com/izforge/izpack/installer/Unpacker.java |
handler.nextStep(((Pack) packs.get(i)).name, i + 1, nfiles); | final Pack pack = ((Pack) packs.get(i)); String stepname = pack.name; if(langpack !=null && !(pack.id == null || pack.id.equals("")) ) { final String name = langpack.getString(pack.id); if(name !=null && !name.equals("")) { stepname = name; } } handler.nextStep(stepname, i + 1, nfiles); | public void run() { instances.add(this); try { // // Initialisations FileOutputStream out = null; ArrayList parsables = new ArrayList(); ArrayList executables = new ArrayList(); ArrayList updatechecks = new ArrayList(); List packs = idata.selectedPacks; int npacks = packs.size(); handler.startAction("Unpacking", npacks); udata = UninstallData.getInstance(); // Custom action listener stuff --- load listeners ---- List [] customActions = getCustomActions(); // Custom action listener stuff --- beforePacks ---- informListeners(customActions, InstallerListener.BEFORE_PACKS,idata, new Integer(npacks), handler); // We unpack the selected packs for (int i = 0; i < npacks; i++) { // We get the pack stream int n = idata.allPacks.indexOf(packs.get(i)); // Custom action listener stuff --- beforePack ---- informListeners(customActions, InstallerListener.BEFORE_PACK,packs.get(i), new Integer(npacks), handler); ObjectInputStream objIn = new ObjectInputStream(getPackAsStream(n)); // We unpack the files int nfiles = objIn.readInt(); handler.nextStep(((Pack) packs.get(i)).name, i + 1, nfiles); for (int j = 0; j < nfiles; j++) { // We read the header PackFile pf = (PackFile) objIn.readObject(); if (OsConstraint.oneMatchesCurrentSystem(pf.osConstraints())) { // We translate & build the path String path = translatePath(pf.getTargetPath()); File pathFile = new File(path); File dest = pathFile; if (! pf.isDirectory()) dest = pathFile.getParentFile(); if (!dest.exists()) { // If there are custom actions which would be called at // creating a directory, create it recursively. List fileListeners = customActions[customActions.length - 1]; if( fileListeners != null && fileListeners.size() > 0 ) mkDirsWithEnhancement(dest, pf, customActions ); else // Create it in on step. { if (!dest.mkdirs()) { handler.emitError( "Error creating directories", "Could not create directory\n" + dest.getPath()); handler.stopAction(); return; } } } if (pf.isDirectory()) continue; // Custom action listener stuff --- beforeFile ---- informListeners(customActions, InstallerListener.BEFORE_FILE,pathFile, pf, null); // We add the path to the log, udata.addFile(path); handler.progress(j, path); //if this file exists and should not be overwritten, check //what to do if ((pathFile.exists()) && (pf.override() != PackFile.OVERRIDE_TRUE)) { boolean overwritefile = false; // don't overwrite file if the user said so if (pf.override() != PackFile.OVERRIDE_FALSE) { if (pf.override() == PackFile.OVERRIDE_TRUE) { overwritefile = true; } else if (pf.override() == PackFile.OVERRIDE_UPDATE) { // check mtime of involved files // (this is not 100% perfect, because the already existing file might // still be modified but the new installed is just a bit newer; we would // need the creation time of the existing file or record with which mtime // it was installed...) overwritefile = (pathFile.lastModified() < pf.lastModified()); } else { int def_choice = -1; if (pf.override() == PackFile.OVERRIDE_ASK_FALSE) def_choice = AbstractUIHandler.ANSWER_NO; if (pf.override() == PackFile.OVERRIDE_ASK_TRUE) def_choice = AbstractUIHandler.ANSWER_YES; int answer = handler.askQuestion( idata.langpack.getString("InstallPanel.overwrite.title") + pathFile.getName(), idata.langpack.getString( "InstallPanel.overwrite.question") + pathFile.getAbsolutePath(), AbstractUIHandler.CHOICES_YES_NO, def_choice); overwritefile = (answer == AbstractUIHandler.ANSWER_YES); } } if (!overwritefile) { if (!pf.isBackReference() && !((Pack)packs.get(i)).loose) objIn.skip(pf.length()); continue; } } // We copy the file out = new FileOutputStream(pathFile); byte[] buffer = new byte[5120]; long bytesCopied = 0; InputStream pis = objIn; if (pf.isBackReference()) { InputStream is = getPackAsStream(pf.previousPackNumber); pis = new ObjectInputStream(is); //must wrap for blockdata use by objectstream (otherwise strange result) //skip on underlaying stream (for some reason not possible on ObjectStream) is.skip(pf.offsetInPreviousPack - 4); //but the stream header is now already read (== 4 bytes) } else if(((Pack)packs.get(i)).loose) { pis = new FileInputStream(pf.sourcePath); } while (bytesCopied < pf.length()) { int maxBytes = (int)Math.min(pf.length() - bytesCopied, buffer.length); int bytesInBuffer = pis.read(buffer, 0, maxBytes); if (bytesInBuffer == -1) throw new IOException("Unexpected end of stream"); out.write(buffer, 0, bytesInBuffer); bytesCopied += bytesInBuffer; } // Cleanings out.close(); if (pis != objIn) pis.close(); // Set file modification time if specified if (pf.lastModified() >= 0) pathFile.setLastModified(pf.lastModified()); // Custom action listener stuff --- afterFile ---- informListeners(customActions, InstallerListener.AFTER_FILE,pathFile, pf, null); } else { if (!pf.isBackReference()) objIn.skip(pf.length()); } } // Load information about parsable files int numParsables = objIn.readInt(); for (int k = 0; k < numParsables; k++) { ParsableFile pf = (ParsableFile) objIn.readObject(); pf.path = translatePath(pf.path); parsables.add(pf); } // Load information about executable files int numExecutables = objIn.readInt(); for (int k = 0; k < numExecutables; k++) { ExecutableFile ef = (ExecutableFile) objIn.readObject(); ef.path = translatePath(ef.path); if (null != ef.argList && !ef.argList.isEmpty()) { String arg = null; for (int j = 0; j < ef.argList.size(); j++) { arg = (String) ef.argList.get(j); arg = translatePath(arg); ef.argList.set(j, arg); } } executables.add(ef); if (ef.executionStage == ExecutableFile.UNINSTALL) { udata.addExecutable(ef); } } // Custom action listener stuff --- uninstall data ---- handleAdditionalUninstallData(udata, customActions); // Load information about updatechecks int numUpdateChecks = objIn.readInt(); for (int k = 0; k < numUpdateChecks; k++) { UpdateCheck uc = (UpdateCheck) objIn.readObject(); updatechecks.add(uc); } objIn.close(); // Custom action listener stuff --- afterPack ---- informListeners(customActions, InstallerListener.AFTER_PACK, packs.get(i), new Integer(i), handler); } // We use the scripts parser ScriptParser parser = new ScriptParser(parsables, vs); parser.parseFiles(); // We use the file executor FileExecutor executor = new FileExecutor(executables); if (executor.executeFiles(ExecutableFile.POSTINSTALL, handler) != 0) handler.emitError( "File execution failed", "The installation was not completed"); // We put the uninstaller (it's not yet complete...) putUninstaller(); // update checks _after_ uninstaller was put, so we don't delete it performUpdateChecks(updatechecks); // Custom action listener stuff --- afterPacks ---- informListeners(customActions, InstallerListener.AFTER_PACKS,idata, handler, null); // The end :-) handler.stopAction(); } catch (Exception err) { // TODO: finer grained error handling with useful error messages handler.stopAction(); handler.emitError("An error occured", err.toString()); err.printStackTrace(); } finally { instances.remove(instances.indexOf(this)); } } | 54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/97af55405ebcecbed7b6ed9f6138e21b9b76ce0d/Unpacker.java/buggy/src/lib/com/izforge/izpack/installer/Unpacker.java |
public void run() { instances.add(this); try { // // Initialisations FileOutputStream out = null; ArrayList parsables = new ArrayList(); ArrayList executables = new ArrayList(); ArrayList updatechecks = new ArrayList(); List packs = idata.selectedPacks; int npacks = packs.size(); handler.startAction("Unpacking", npacks); udata = UninstallData.getInstance(); // Custom action listener stuff --- load listeners ---- List [] customActions = getCustomActions(); // Custom action listener stuff --- beforePacks ---- informListeners(customActions, InstallerListener.BEFORE_PACKS,idata, new Integer(npacks), handler); // We unpack the selected packs for (int i = 0; i < npacks; i++) { // We get the pack stream int n = idata.allPacks.indexOf(packs.get(i)); // Custom action listener stuff --- beforePack ---- informListeners(customActions, InstallerListener.BEFORE_PACK,packs.get(i), new Integer(npacks), handler); ObjectInputStream objIn = new ObjectInputStream(getPackAsStream(n)); // We unpack the files int nfiles = objIn.readInt(); handler.nextStep(((Pack) packs.get(i)).name, i + 1, nfiles); for (int j = 0; j < nfiles; j++) { // We read the header PackFile pf = (PackFile) objIn.readObject(); if (OsConstraint.oneMatchesCurrentSystem(pf.osConstraints())) { // We translate & build the path String path = translatePath(pf.getTargetPath()); File pathFile = new File(path); File dest = pathFile; if (! pf.isDirectory()) dest = pathFile.getParentFile(); if (!dest.exists()) { // If there are custom actions which would be called at // creating a directory, create it recursively. List fileListeners = customActions[customActions.length - 1]; if( fileListeners != null && fileListeners.size() > 0 ) mkDirsWithEnhancement(dest, pf, customActions ); else // Create it in on step. { if (!dest.mkdirs()) { handler.emitError( "Error creating directories", "Could not create directory\n" + dest.getPath()); handler.stopAction(); return; } } } if (pf.isDirectory()) continue; // Custom action listener stuff --- beforeFile ---- informListeners(customActions, InstallerListener.BEFORE_FILE,pathFile, pf, null); // We add the path to the log, udata.addFile(path); handler.progress(j, path); //if this file exists and should not be overwritten, check //what to do if ((pathFile.exists()) && (pf.override() != PackFile.OVERRIDE_TRUE)) { boolean overwritefile = false; // don't overwrite file if the user said so if (pf.override() != PackFile.OVERRIDE_FALSE) { if (pf.override() == PackFile.OVERRIDE_TRUE) { overwritefile = true; } else if (pf.override() == PackFile.OVERRIDE_UPDATE) { // check mtime of involved files // (this is not 100% perfect, because the already existing file might // still be modified but the new installed is just a bit newer; we would // need the creation time of the existing file or record with which mtime // it was installed...) overwritefile = (pathFile.lastModified() < pf.lastModified()); } else { int def_choice = -1; if (pf.override() == PackFile.OVERRIDE_ASK_FALSE) def_choice = AbstractUIHandler.ANSWER_NO; if (pf.override() == PackFile.OVERRIDE_ASK_TRUE) def_choice = AbstractUIHandler.ANSWER_YES; int answer = handler.askQuestion( idata.langpack.getString("InstallPanel.overwrite.title") + pathFile.getName(), idata.langpack.getString( "InstallPanel.overwrite.question") + pathFile.getAbsolutePath(), AbstractUIHandler.CHOICES_YES_NO, def_choice); overwritefile = (answer == AbstractUIHandler.ANSWER_YES); } } if (!overwritefile) { if (!pf.isBackReference() && !((Pack)packs.get(i)).loose) objIn.skip(pf.length()); continue; } } // We copy the file out = new FileOutputStream(pathFile); byte[] buffer = new byte[5120]; long bytesCopied = 0; InputStream pis = objIn; if (pf.isBackReference()) { InputStream is = getPackAsStream(pf.previousPackNumber); pis = new ObjectInputStream(is); //must wrap for blockdata use by objectstream (otherwise strange result) //skip on underlaying stream (for some reason not possible on ObjectStream) is.skip(pf.offsetInPreviousPack - 4); //but the stream header is now already read (== 4 bytes) } else if(((Pack)packs.get(i)).loose) { pis = new FileInputStream(pf.sourcePath); } while (bytesCopied < pf.length()) { int maxBytes = (int)Math.min(pf.length() - bytesCopied, buffer.length); int bytesInBuffer = pis.read(buffer, 0, maxBytes); if (bytesInBuffer == -1) throw new IOException("Unexpected end of stream"); out.write(buffer, 0, bytesInBuffer); bytesCopied += bytesInBuffer; } // Cleanings out.close(); if (pis != objIn) pis.close(); // Set file modification time if specified if (pf.lastModified() >= 0) pathFile.setLastModified(pf.lastModified()); // Custom action listener stuff --- afterFile ---- informListeners(customActions, InstallerListener.AFTER_FILE,pathFile, pf, null); } else { if (!pf.isBackReference()) objIn.skip(pf.length()); } } // Load information about parsable files int numParsables = objIn.readInt(); for (int k = 0; k < numParsables; k++) { ParsableFile pf = (ParsableFile) objIn.readObject(); pf.path = translatePath(pf.path); parsables.add(pf); } // Load information about executable files int numExecutables = objIn.readInt(); for (int k = 0; k < numExecutables; k++) { ExecutableFile ef = (ExecutableFile) objIn.readObject(); ef.path = translatePath(ef.path); if (null != ef.argList && !ef.argList.isEmpty()) { String arg = null; for (int j = 0; j < ef.argList.size(); j++) { arg = (String) ef.argList.get(j); arg = translatePath(arg); ef.argList.set(j, arg); } } executables.add(ef); if (ef.executionStage == ExecutableFile.UNINSTALL) { udata.addExecutable(ef); } } // Custom action listener stuff --- uninstall data ---- handleAdditionalUninstallData(udata, customActions); // Load information about updatechecks int numUpdateChecks = objIn.readInt(); for (int k = 0; k < numUpdateChecks; k++) { UpdateCheck uc = (UpdateCheck) objIn.readObject(); updatechecks.add(uc); } objIn.close(); // Custom action listener stuff --- afterPack ---- informListeners(customActions, InstallerListener.AFTER_PACK, packs.get(i), new Integer(i), handler); } // We use the scripts parser ScriptParser parser = new ScriptParser(parsables, vs); parser.parseFiles(); // We use the file executor FileExecutor executor = new FileExecutor(executables); if (executor.executeFiles(ExecutableFile.POSTINSTALL, handler) != 0) handler.emitError( "File execution failed", "The installation was not completed"); // We put the uninstaller (it's not yet complete...) putUninstaller(); // update checks _after_ uninstaller was put, so we don't delete it performUpdateChecks(updatechecks); // Custom action listener stuff --- afterPacks ---- informListeners(customActions, InstallerListener.AFTER_PACKS,idata, handler, null); // The end :-) handler.stopAction(); } catch (Exception err) { // TODO: finer grained error handling with useful error messages handler.stopAction(); handler.emitError("An error occured", err.toString()); err.printStackTrace(); } finally { instances.remove(instances.indexOf(this)); } } | 54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/97af55405ebcecbed7b6ed9f6138e21b9b76ce0d/Unpacker.java/buggy/src/lib/com/izforge/izpack/installer/Unpacker.java |
||
public void run() { instances.add(this); try { // // Initialisations FileOutputStream out = null; ArrayList parsables = new ArrayList(); ArrayList executables = new ArrayList(); ArrayList updatechecks = new ArrayList(); List packs = idata.selectedPacks; int npacks = packs.size(); handler.startAction("Unpacking", npacks); udata = UninstallData.getInstance(); // Custom action listener stuff --- load listeners ---- List [] customActions = getCustomActions(); // Custom action listener stuff --- beforePacks ---- informListeners(customActions, InstallerListener.BEFORE_PACKS,idata, new Integer(npacks), handler); // We unpack the selected packs for (int i = 0; i < npacks; i++) { // We get the pack stream int n = idata.allPacks.indexOf(packs.get(i)); // Custom action listener stuff --- beforePack ---- informListeners(customActions, InstallerListener.BEFORE_PACK,packs.get(i), new Integer(npacks), handler); ObjectInputStream objIn = new ObjectInputStream(getPackAsStream(n)); // We unpack the files int nfiles = objIn.readInt(); handler.nextStep(((Pack) packs.get(i)).name, i + 1, nfiles); for (int j = 0; j < nfiles; j++) { // We read the header PackFile pf = (PackFile) objIn.readObject(); if (OsConstraint.oneMatchesCurrentSystem(pf.osConstraints())) { // We translate & build the path String path = translatePath(pf.getTargetPath()); File pathFile = new File(path); File dest = pathFile; if (! pf.isDirectory()) dest = pathFile.getParentFile(); if (!dest.exists()) { // If there are custom actions which would be called at // creating a directory, create it recursively. List fileListeners = customActions[customActions.length - 1]; if( fileListeners != null && fileListeners.size() > 0 ) mkDirsWithEnhancement(dest, pf, customActions ); else // Create it in on step. { if (!dest.mkdirs()) { handler.emitError( "Error creating directories", "Could not create directory\n" + dest.getPath()); handler.stopAction(); return; } } } if (pf.isDirectory()) continue; // Custom action listener stuff --- beforeFile ---- informListeners(customActions, InstallerListener.BEFORE_FILE,pathFile, pf, null); // We add the path to the log, udata.addFile(path); handler.progress(j, path); //if this file exists and should not be overwritten, check //what to do if ((pathFile.exists()) && (pf.override() != PackFile.OVERRIDE_TRUE)) { boolean overwritefile = false; // don't overwrite file if the user said so if (pf.override() != PackFile.OVERRIDE_FALSE) { if (pf.override() == PackFile.OVERRIDE_TRUE) { overwritefile = true; } else if (pf.override() == PackFile.OVERRIDE_UPDATE) { // check mtime of involved files // (this is not 100% perfect, because the already existing file might // still be modified but the new installed is just a bit newer; we would // need the creation time of the existing file or record with which mtime // it was installed...) overwritefile = (pathFile.lastModified() < pf.lastModified()); } else { int def_choice = -1; if (pf.override() == PackFile.OVERRIDE_ASK_FALSE) def_choice = AbstractUIHandler.ANSWER_NO; if (pf.override() == PackFile.OVERRIDE_ASK_TRUE) def_choice = AbstractUIHandler.ANSWER_YES; int answer = handler.askQuestion( idata.langpack.getString("InstallPanel.overwrite.title") + pathFile.getName(), idata.langpack.getString( "InstallPanel.overwrite.question") + pathFile.getAbsolutePath(), AbstractUIHandler.CHOICES_YES_NO, def_choice); overwritefile = (answer == AbstractUIHandler.ANSWER_YES); } } if (!overwritefile) { if (!pf.isBackReference() && !((Pack)packs.get(i)).loose) objIn.skip(pf.length()); continue; } } // We copy the file out = new FileOutputStream(pathFile); byte[] buffer = new byte[5120]; long bytesCopied = 0; InputStream pis = objIn; if (pf.isBackReference()) { InputStream is = getPackAsStream(pf.previousPackNumber); pis = new ObjectInputStream(is); //must wrap for blockdata use by objectstream (otherwise strange result) //skip on underlaying stream (for some reason not possible on ObjectStream) is.skip(pf.offsetInPreviousPack - 4); //but the stream header is now already read (== 4 bytes) } else if(((Pack)packs.get(i)).loose) { pis = new FileInputStream(pf.sourcePath); } while (bytesCopied < pf.length()) { int maxBytes = (int)Math.min(pf.length() - bytesCopied, buffer.length); int bytesInBuffer = pis.read(buffer, 0, maxBytes); if (bytesInBuffer == -1) throw new IOException("Unexpected end of stream"); out.write(buffer, 0, bytesInBuffer); bytesCopied += bytesInBuffer; } // Cleanings out.close(); if (pis != objIn) pis.close(); // Set file modification time if specified if (pf.lastModified() >= 0) pathFile.setLastModified(pf.lastModified()); // Custom action listener stuff --- afterFile ---- informListeners(customActions, InstallerListener.AFTER_FILE,pathFile, pf, null); } else { if (!pf.isBackReference()) objIn.skip(pf.length()); } } // Load information about parsable files int numParsables = objIn.readInt(); for (int k = 0; k < numParsables; k++) { ParsableFile pf = (ParsableFile) objIn.readObject(); pf.path = translatePath(pf.path); parsables.add(pf); } // Load information about executable files int numExecutables = objIn.readInt(); for (int k = 0; k < numExecutables; k++) { ExecutableFile ef = (ExecutableFile) objIn.readObject(); ef.path = translatePath(ef.path); if (null != ef.argList && !ef.argList.isEmpty()) { String arg = null; for (int j = 0; j < ef.argList.size(); j++) { arg = (String) ef.argList.get(j); arg = translatePath(arg); ef.argList.set(j, arg); } } executables.add(ef); if (ef.executionStage == ExecutableFile.UNINSTALL) { udata.addExecutable(ef); } } // Custom action listener stuff --- uninstall data ---- handleAdditionalUninstallData(udata, customActions); // Load information about updatechecks int numUpdateChecks = objIn.readInt(); for (int k = 0; k < numUpdateChecks; k++) { UpdateCheck uc = (UpdateCheck) objIn.readObject(); updatechecks.add(uc); } objIn.close(); // Custom action listener stuff --- afterPack ---- informListeners(customActions, InstallerListener.AFTER_PACK, packs.get(i), new Integer(i), handler); } // We use the scripts parser ScriptParser parser = new ScriptParser(parsables, vs); parser.parseFiles(); // We use the file executor FileExecutor executor = new FileExecutor(executables); if (executor.executeFiles(ExecutableFile.POSTINSTALL, handler) != 0) handler.emitError( "File execution failed", "The installation was not completed"); // We put the uninstaller (it's not yet complete...) putUninstaller(); // update checks _after_ uninstaller was put, so we don't delete it performUpdateChecks(updatechecks); // Custom action listener stuff --- afterPacks ---- informListeners(customActions, InstallerListener.AFTER_PACKS,idata, handler, null); // The end :-) handler.stopAction(); } catch (Exception err) { // TODO: finer grained error handling with useful error messages handler.stopAction(); handler.emitError("An error occured", err.toString()); err.printStackTrace(); } finally { instances.remove(instances.indexOf(this)); } } | 54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/97af55405ebcecbed7b6ed9f6138e21b9b76ce0d/Unpacker.java/buggy/src/lib/com/izforge/izpack/installer/Unpacker.java |
||
informListeners(customActions, InstallerListener.BEFORE_FILE,pathFile, | informListeners(customActions, InstallerListener.BEFORE_FILE,pathFile, | public void run() { instances.add(this); try { // // Initialisations FileOutputStream out = null; ArrayList parsables = new ArrayList(); ArrayList executables = new ArrayList(); ArrayList updatechecks = new ArrayList(); List packs = idata.selectedPacks; int npacks = packs.size(); handler.startAction("Unpacking", npacks); udata = UninstallData.getInstance(); // Custom action listener stuff --- load listeners ---- List [] customActions = getCustomActions(); // Custom action listener stuff --- beforePacks ---- informListeners(customActions, InstallerListener.BEFORE_PACKS,idata, new Integer(npacks), handler); // We unpack the selected packs for (int i = 0; i < npacks; i++) { // We get the pack stream int n = idata.allPacks.indexOf(packs.get(i)); // Custom action listener stuff --- beforePack ---- informListeners(customActions, InstallerListener.BEFORE_PACK,packs.get(i), new Integer(npacks), handler); ObjectInputStream objIn = new ObjectInputStream(getPackAsStream(n)); // We unpack the files int nfiles = objIn.readInt(); handler.nextStep(((Pack) packs.get(i)).name, i + 1, nfiles); for (int j = 0; j < nfiles; j++) { // We read the header PackFile pf = (PackFile) objIn.readObject(); if (OsConstraint.oneMatchesCurrentSystem(pf.osConstraints())) { // We translate & build the path String path = translatePath(pf.getTargetPath()); File pathFile = new File(path); File dest = pathFile; if (! pf.isDirectory()) dest = pathFile.getParentFile(); if (!dest.exists()) { // If there are custom actions which would be called at // creating a directory, create it recursively. List fileListeners = customActions[customActions.length - 1]; if( fileListeners != null && fileListeners.size() > 0 ) mkDirsWithEnhancement(dest, pf, customActions ); else // Create it in on step. { if (!dest.mkdirs()) { handler.emitError( "Error creating directories", "Could not create directory\n" + dest.getPath()); handler.stopAction(); return; } } } if (pf.isDirectory()) continue; // Custom action listener stuff --- beforeFile ---- informListeners(customActions, InstallerListener.BEFORE_FILE,pathFile, pf, null); // We add the path to the log, udata.addFile(path); handler.progress(j, path); //if this file exists and should not be overwritten, check //what to do if ((pathFile.exists()) && (pf.override() != PackFile.OVERRIDE_TRUE)) { boolean overwritefile = false; // don't overwrite file if the user said so if (pf.override() != PackFile.OVERRIDE_FALSE) { if (pf.override() == PackFile.OVERRIDE_TRUE) { overwritefile = true; } else if (pf.override() == PackFile.OVERRIDE_UPDATE) { // check mtime of involved files // (this is not 100% perfect, because the already existing file might // still be modified but the new installed is just a bit newer; we would // need the creation time of the existing file or record with which mtime // it was installed...) overwritefile = (pathFile.lastModified() < pf.lastModified()); } else { int def_choice = -1; if (pf.override() == PackFile.OVERRIDE_ASK_FALSE) def_choice = AbstractUIHandler.ANSWER_NO; if (pf.override() == PackFile.OVERRIDE_ASK_TRUE) def_choice = AbstractUIHandler.ANSWER_YES; int answer = handler.askQuestion( idata.langpack.getString("InstallPanel.overwrite.title") + pathFile.getName(), idata.langpack.getString( "InstallPanel.overwrite.question") + pathFile.getAbsolutePath(), AbstractUIHandler.CHOICES_YES_NO, def_choice); overwritefile = (answer == AbstractUIHandler.ANSWER_YES); } } if (!overwritefile) { if (!pf.isBackReference() && !((Pack)packs.get(i)).loose) objIn.skip(pf.length()); continue; } } // We copy the file out = new FileOutputStream(pathFile); byte[] buffer = new byte[5120]; long bytesCopied = 0; InputStream pis = objIn; if (pf.isBackReference()) { InputStream is = getPackAsStream(pf.previousPackNumber); pis = new ObjectInputStream(is); //must wrap for blockdata use by objectstream (otherwise strange result) //skip on underlaying stream (for some reason not possible on ObjectStream) is.skip(pf.offsetInPreviousPack - 4); //but the stream header is now already read (== 4 bytes) } else if(((Pack)packs.get(i)).loose) { pis = new FileInputStream(pf.sourcePath); } while (bytesCopied < pf.length()) { int maxBytes = (int)Math.min(pf.length() - bytesCopied, buffer.length); int bytesInBuffer = pis.read(buffer, 0, maxBytes); if (bytesInBuffer == -1) throw new IOException("Unexpected end of stream"); out.write(buffer, 0, bytesInBuffer); bytesCopied += bytesInBuffer; } // Cleanings out.close(); if (pis != objIn) pis.close(); // Set file modification time if specified if (pf.lastModified() >= 0) pathFile.setLastModified(pf.lastModified()); // Custom action listener stuff --- afterFile ---- informListeners(customActions, InstallerListener.AFTER_FILE,pathFile, pf, null); } else { if (!pf.isBackReference()) objIn.skip(pf.length()); } } // Load information about parsable files int numParsables = objIn.readInt(); for (int k = 0; k < numParsables; k++) { ParsableFile pf = (ParsableFile) objIn.readObject(); pf.path = translatePath(pf.path); parsables.add(pf); } // Load information about executable files int numExecutables = objIn.readInt(); for (int k = 0; k < numExecutables; k++) { ExecutableFile ef = (ExecutableFile) objIn.readObject(); ef.path = translatePath(ef.path); if (null != ef.argList && !ef.argList.isEmpty()) { String arg = null; for (int j = 0; j < ef.argList.size(); j++) { arg = (String) ef.argList.get(j); arg = translatePath(arg); ef.argList.set(j, arg); } } executables.add(ef); if (ef.executionStage == ExecutableFile.UNINSTALL) { udata.addExecutable(ef); } } // Custom action listener stuff --- uninstall data ---- handleAdditionalUninstallData(udata, customActions); // Load information about updatechecks int numUpdateChecks = objIn.readInt(); for (int k = 0; k < numUpdateChecks; k++) { UpdateCheck uc = (UpdateCheck) objIn.readObject(); updatechecks.add(uc); } objIn.close(); // Custom action listener stuff --- afterPack ---- informListeners(customActions, InstallerListener.AFTER_PACK, packs.get(i), new Integer(i), handler); } // We use the scripts parser ScriptParser parser = new ScriptParser(parsables, vs); parser.parseFiles(); // We use the file executor FileExecutor executor = new FileExecutor(executables); if (executor.executeFiles(ExecutableFile.POSTINSTALL, handler) != 0) handler.emitError( "File execution failed", "The installation was not completed"); // We put the uninstaller (it's not yet complete...) putUninstaller(); // update checks _after_ uninstaller was put, so we don't delete it performUpdateChecks(updatechecks); // Custom action listener stuff --- afterPacks ---- informListeners(customActions, InstallerListener.AFTER_PACKS,idata, handler, null); // The end :-) handler.stopAction(); } catch (Exception err) { // TODO: finer grained error handling with useful error messages handler.stopAction(); handler.emitError("An error occured", err.toString()); err.printStackTrace(); } finally { instances.remove(instances.indexOf(this)); } } | 54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/97af55405ebcecbed7b6ed9f6138e21b9b76ce0d/Unpacker.java/buggy/src/lib/com/izforge/izpack/installer/Unpacker.java |
public void run() { instances.add(this); try { // // Initialisations FileOutputStream out = null; ArrayList parsables = new ArrayList(); ArrayList executables = new ArrayList(); ArrayList updatechecks = new ArrayList(); List packs = idata.selectedPacks; int npacks = packs.size(); handler.startAction("Unpacking", npacks); udata = UninstallData.getInstance(); // Custom action listener stuff --- load listeners ---- List [] customActions = getCustomActions(); // Custom action listener stuff --- beforePacks ---- informListeners(customActions, InstallerListener.BEFORE_PACKS,idata, new Integer(npacks), handler); // We unpack the selected packs for (int i = 0; i < npacks; i++) { // We get the pack stream int n = idata.allPacks.indexOf(packs.get(i)); // Custom action listener stuff --- beforePack ---- informListeners(customActions, InstallerListener.BEFORE_PACK,packs.get(i), new Integer(npacks), handler); ObjectInputStream objIn = new ObjectInputStream(getPackAsStream(n)); // We unpack the files int nfiles = objIn.readInt(); handler.nextStep(((Pack) packs.get(i)).name, i + 1, nfiles); for (int j = 0; j < nfiles; j++) { // We read the header PackFile pf = (PackFile) objIn.readObject(); if (OsConstraint.oneMatchesCurrentSystem(pf.osConstraints())) { // We translate & build the path String path = translatePath(pf.getTargetPath()); File pathFile = new File(path); File dest = pathFile; if (! pf.isDirectory()) dest = pathFile.getParentFile(); if (!dest.exists()) { // If there are custom actions which would be called at // creating a directory, create it recursively. List fileListeners = customActions[customActions.length - 1]; if( fileListeners != null && fileListeners.size() > 0 ) mkDirsWithEnhancement(dest, pf, customActions ); else // Create it in on step. { if (!dest.mkdirs()) { handler.emitError( "Error creating directories", "Could not create directory\n" + dest.getPath()); handler.stopAction(); return; } } } if (pf.isDirectory()) continue; // Custom action listener stuff --- beforeFile ---- informListeners(customActions, InstallerListener.BEFORE_FILE,pathFile, pf, null); // We add the path to the log, udata.addFile(path); handler.progress(j, path); //if this file exists and should not be overwritten, check //what to do if ((pathFile.exists()) && (pf.override() != PackFile.OVERRIDE_TRUE)) { boolean overwritefile = false; // don't overwrite file if the user said so if (pf.override() != PackFile.OVERRIDE_FALSE) { if (pf.override() == PackFile.OVERRIDE_TRUE) { overwritefile = true; } else if (pf.override() == PackFile.OVERRIDE_UPDATE) { // check mtime of involved files // (this is not 100% perfect, because the already existing file might // still be modified but the new installed is just a bit newer; we would // need the creation time of the existing file or record with which mtime // it was installed...) overwritefile = (pathFile.lastModified() < pf.lastModified()); } else { int def_choice = -1; if (pf.override() == PackFile.OVERRIDE_ASK_FALSE) def_choice = AbstractUIHandler.ANSWER_NO; if (pf.override() == PackFile.OVERRIDE_ASK_TRUE) def_choice = AbstractUIHandler.ANSWER_YES; int answer = handler.askQuestion( idata.langpack.getString("InstallPanel.overwrite.title") + pathFile.getName(), idata.langpack.getString( "InstallPanel.overwrite.question") + pathFile.getAbsolutePath(), AbstractUIHandler.CHOICES_YES_NO, def_choice); overwritefile = (answer == AbstractUIHandler.ANSWER_YES); } } if (!overwritefile) { if (!pf.isBackReference() && !((Pack)packs.get(i)).loose) objIn.skip(pf.length()); continue; } } // We copy the file out = new FileOutputStream(pathFile); byte[] buffer = new byte[5120]; long bytesCopied = 0; InputStream pis = objIn; if (pf.isBackReference()) { InputStream is = getPackAsStream(pf.previousPackNumber); pis = new ObjectInputStream(is); //must wrap for blockdata use by objectstream (otherwise strange result) //skip on underlaying stream (for some reason not possible on ObjectStream) is.skip(pf.offsetInPreviousPack - 4); //but the stream header is now already read (== 4 bytes) } else if(((Pack)packs.get(i)).loose) { pis = new FileInputStream(pf.sourcePath); } while (bytesCopied < pf.length()) { int maxBytes = (int)Math.min(pf.length() - bytesCopied, buffer.length); int bytesInBuffer = pis.read(buffer, 0, maxBytes); if (bytesInBuffer == -1) throw new IOException("Unexpected end of stream"); out.write(buffer, 0, bytesInBuffer); bytesCopied += bytesInBuffer; } // Cleanings out.close(); if (pis != objIn) pis.close(); // Set file modification time if specified if (pf.lastModified() >= 0) pathFile.setLastModified(pf.lastModified()); // Custom action listener stuff --- afterFile ---- informListeners(customActions, InstallerListener.AFTER_FILE,pathFile, pf, null); } else { if (!pf.isBackReference()) objIn.skip(pf.length()); } } // Load information about parsable files int numParsables = objIn.readInt(); for (int k = 0; k < numParsables; k++) { ParsableFile pf = (ParsableFile) objIn.readObject(); pf.path = translatePath(pf.path); parsables.add(pf); } // Load information about executable files int numExecutables = objIn.readInt(); for (int k = 0; k < numExecutables; k++) { ExecutableFile ef = (ExecutableFile) objIn.readObject(); ef.path = translatePath(ef.path); if (null != ef.argList && !ef.argList.isEmpty()) { String arg = null; for (int j = 0; j < ef.argList.size(); j++) { arg = (String) ef.argList.get(j); arg = translatePath(arg); ef.argList.set(j, arg); } } executables.add(ef); if (ef.executionStage == ExecutableFile.UNINSTALL) { udata.addExecutable(ef); } } // Custom action listener stuff --- uninstall data ---- handleAdditionalUninstallData(udata, customActions); // Load information about updatechecks int numUpdateChecks = objIn.readInt(); for (int k = 0; k < numUpdateChecks; k++) { UpdateCheck uc = (UpdateCheck) objIn.readObject(); updatechecks.add(uc); } objIn.close(); // Custom action listener stuff --- afterPack ---- informListeners(customActions, InstallerListener.AFTER_PACK, packs.get(i), new Integer(i), handler); } // We use the scripts parser ScriptParser parser = new ScriptParser(parsables, vs); parser.parseFiles(); // We use the file executor FileExecutor executor = new FileExecutor(executables); if (executor.executeFiles(ExecutableFile.POSTINSTALL, handler) != 0) handler.emitError( "File execution failed", "The installation was not completed"); // We put the uninstaller (it's not yet complete...) putUninstaller(); // update checks _after_ uninstaller was put, so we don't delete it performUpdateChecks(updatechecks); // Custom action listener stuff --- afterPacks ---- informListeners(customActions, InstallerListener.AFTER_PACKS,idata, handler, null); // The end :-) handler.stopAction(); } catch (Exception err) { // TODO: finer grained error handling with useful error messages handler.stopAction(); handler.emitError("An error occured", err.toString()); err.printStackTrace(); } finally { instances.remove(instances.indexOf(this)); } } | 54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/97af55405ebcecbed7b6ed9f6138e21b9b76ce0d/Unpacker.java/buggy/src/lib/com/izforge/izpack/installer/Unpacker.java |
||
informListeners(customActions, InstallerListener.AFTER_FILE,pathFile, | informListeners(customActions, InstallerListener.AFTER_FILE,pathFile, | public void run() { instances.add(this); try { // // Initialisations FileOutputStream out = null; ArrayList parsables = new ArrayList(); ArrayList executables = new ArrayList(); ArrayList updatechecks = new ArrayList(); List packs = idata.selectedPacks; int npacks = packs.size(); handler.startAction("Unpacking", npacks); udata = UninstallData.getInstance(); // Custom action listener stuff --- load listeners ---- List [] customActions = getCustomActions(); // Custom action listener stuff --- beforePacks ---- informListeners(customActions, InstallerListener.BEFORE_PACKS,idata, new Integer(npacks), handler); // We unpack the selected packs for (int i = 0; i < npacks; i++) { // We get the pack stream int n = idata.allPacks.indexOf(packs.get(i)); // Custom action listener stuff --- beforePack ---- informListeners(customActions, InstallerListener.BEFORE_PACK,packs.get(i), new Integer(npacks), handler); ObjectInputStream objIn = new ObjectInputStream(getPackAsStream(n)); // We unpack the files int nfiles = objIn.readInt(); handler.nextStep(((Pack) packs.get(i)).name, i + 1, nfiles); for (int j = 0; j < nfiles; j++) { // We read the header PackFile pf = (PackFile) objIn.readObject(); if (OsConstraint.oneMatchesCurrentSystem(pf.osConstraints())) { // We translate & build the path String path = translatePath(pf.getTargetPath()); File pathFile = new File(path); File dest = pathFile; if (! pf.isDirectory()) dest = pathFile.getParentFile(); if (!dest.exists()) { // If there are custom actions which would be called at // creating a directory, create it recursively. List fileListeners = customActions[customActions.length - 1]; if( fileListeners != null && fileListeners.size() > 0 ) mkDirsWithEnhancement(dest, pf, customActions ); else // Create it in on step. { if (!dest.mkdirs()) { handler.emitError( "Error creating directories", "Could not create directory\n" + dest.getPath()); handler.stopAction(); return; } } } if (pf.isDirectory()) continue; // Custom action listener stuff --- beforeFile ---- informListeners(customActions, InstallerListener.BEFORE_FILE,pathFile, pf, null); // We add the path to the log, udata.addFile(path); handler.progress(j, path); //if this file exists and should not be overwritten, check //what to do if ((pathFile.exists()) && (pf.override() != PackFile.OVERRIDE_TRUE)) { boolean overwritefile = false; // don't overwrite file if the user said so if (pf.override() != PackFile.OVERRIDE_FALSE) { if (pf.override() == PackFile.OVERRIDE_TRUE) { overwritefile = true; } else if (pf.override() == PackFile.OVERRIDE_UPDATE) { // check mtime of involved files // (this is not 100% perfect, because the already existing file might // still be modified but the new installed is just a bit newer; we would // need the creation time of the existing file or record with which mtime // it was installed...) overwritefile = (pathFile.lastModified() < pf.lastModified()); } else { int def_choice = -1; if (pf.override() == PackFile.OVERRIDE_ASK_FALSE) def_choice = AbstractUIHandler.ANSWER_NO; if (pf.override() == PackFile.OVERRIDE_ASK_TRUE) def_choice = AbstractUIHandler.ANSWER_YES; int answer = handler.askQuestion( idata.langpack.getString("InstallPanel.overwrite.title") + pathFile.getName(), idata.langpack.getString( "InstallPanel.overwrite.question") + pathFile.getAbsolutePath(), AbstractUIHandler.CHOICES_YES_NO, def_choice); overwritefile = (answer == AbstractUIHandler.ANSWER_YES); } } if (!overwritefile) { if (!pf.isBackReference() && !((Pack)packs.get(i)).loose) objIn.skip(pf.length()); continue; } } // We copy the file out = new FileOutputStream(pathFile); byte[] buffer = new byte[5120]; long bytesCopied = 0; InputStream pis = objIn; if (pf.isBackReference()) { InputStream is = getPackAsStream(pf.previousPackNumber); pis = new ObjectInputStream(is); //must wrap for blockdata use by objectstream (otherwise strange result) //skip on underlaying stream (for some reason not possible on ObjectStream) is.skip(pf.offsetInPreviousPack - 4); //but the stream header is now already read (== 4 bytes) } else if(((Pack)packs.get(i)).loose) { pis = new FileInputStream(pf.sourcePath); } while (bytesCopied < pf.length()) { int maxBytes = (int)Math.min(pf.length() - bytesCopied, buffer.length); int bytesInBuffer = pis.read(buffer, 0, maxBytes); if (bytesInBuffer == -1) throw new IOException("Unexpected end of stream"); out.write(buffer, 0, bytesInBuffer); bytesCopied += bytesInBuffer; } // Cleanings out.close(); if (pis != objIn) pis.close(); // Set file modification time if specified if (pf.lastModified() >= 0) pathFile.setLastModified(pf.lastModified()); // Custom action listener stuff --- afterFile ---- informListeners(customActions, InstallerListener.AFTER_FILE,pathFile, pf, null); } else { if (!pf.isBackReference()) objIn.skip(pf.length()); } } // Load information about parsable files int numParsables = objIn.readInt(); for (int k = 0; k < numParsables; k++) { ParsableFile pf = (ParsableFile) objIn.readObject(); pf.path = translatePath(pf.path); parsables.add(pf); } // Load information about executable files int numExecutables = objIn.readInt(); for (int k = 0; k < numExecutables; k++) { ExecutableFile ef = (ExecutableFile) objIn.readObject(); ef.path = translatePath(ef.path); if (null != ef.argList && !ef.argList.isEmpty()) { String arg = null; for (int j = 0; j < ef.argList.size(); j++) { arg = (String) ef.argList.get(j); arg = translatePath(arg); ef.argList.set(j, arg); } } executables.add(ef); if (ef.executionStage == ExecutableFile.UNINSTALL) { udata.addExecutable(ef); } } // Custom action listener stuff --- uninstall data ---- handleAdditionalUninstallData(udata, customActions); // Load information about updatechecks int numUpdateChecks = objIn.readInt(); for (int k = 0; k < numUpdateChecks; k++) { UpdateCheck uc = (UpdateCheck) objIn.readObject(); updatechecks.add(uc); } objIn.close(); // Custom action listener stuff --- afterPack ---- informListeners(customActions, InstallerListener.AFTER_PACK, packs.get(i), new Integer(i), handler); } // We use the scripts parser ScriptParser parser = new ScriptParser(parsables, vs); parser.parseFiles(); // We use the file executor FileExecutor executor = new FileExecutor(executables); if (executor.executeFiles(ExecutableFile.POSTINSTALL, handler) != 0) handler.emitError( "File execution failed", "The installation was not completed"); // We put the uninstaller (it's not yet complete...) putUninstaller(); // update checks _after_ uninstaller was put, so we don't delete it performUpdateChecks(updatechecks); // Custom action listener stuff --- afterPacks ---- informListeners(customActions, InstallerListener.AFTER_PACKS,idata, handler, null); // The end :-) handler.stopAction(); } catch (Exception err) { // TODO: finer grained error handling with useful error messages handler.stopAction(); handler.emitError("An error occured", err.toString()); err.printStackTrace(); } finally { instances.remove(instances.indexOf(this)); } } | 54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/97af55405ebcecbed7b6ed9f6138e21b9b76ce0d/Unpacker.java/buggy/src/lib/com/izforge/izpack/installer/Unpacker.java |
public void run() { instances.add(this); try { // // Initialisations FileOutputStream out = null; ArrayList parsables = new ArrayList(); ArrayList executables = new ArrayList(); ArrayList updatechecks = new ArrayList(); List packs = idata.selectedPacks; int npacks = packs.size(); handler.startAction("Unpacking", npacks); udata = UninstallData.getInstance(); // Custom action listener stuff --- load listeners ---- List [] customActions = getCustomActions(); // Custom action listener stuff --- beforePacks ---- informListeners(customActions, InstallerListener.BEFORE_PACKS,idata, new Integer(npacks), handler); // We unpack the selected packs for (int i = 0; i < npacks; i++) { // We get the pack stream int n = idata.allPacks.indexOf(packs.get(i)); // Custom action listener stuff --- beforePack ---- informListeners(customActions, InstallerListener.BEFORE_PACK,packs.get(i), new Integer(npacks), handler); ObjectInputStream objIn = new ObjectInputStream(getPackAsStream(n)); // We unpack the files int nfiles = objIn.readInt(); handler.nextStep(((Pack) packs.get(i)).name, i + 1, nfiles); for (int j = 0; j < nfiles; j++) { // We read the header PackFile pf = (PackFile) objIn.readObject(); if (OsConstraint.oneMatchesCurrentSystem(pf.osConstraints())) { // We translate & build the path String path = translatePath(pf.getTargetPath()); File pathFile = new File(path); File dest = pathFile; if (! pf.isDirectory()) dest = pathFile.getParentFile(); if (!dest.exists()) { // If there are custom actions which would be called at // creating a directory, create it recursively. List fileListeners = customActions[customActions.length - 1]; if( fileListeners != null && fileListeners.size() > 0 ) mkDirsWithEnhancement(dest, pf, customActions ); else // Create it in on step. { if (!dest.mkdirs()) { handler.emitError( "Error creating directories", "Could not create directory\n" + dest.getPath()); handler.stopAction(); return; } } } if (pf.isDirectory()) continue; // Custom action listener stuff --- beforeFile ---- informListeners(customActions, InstallerListener.BEFORE_FILE,pathFile, pf, null); // We add the path to the log, udata.addFile(path); handler.progress(j, path); //if this file exists and should not be overwritten, check //what to do if ((pathFile.exists()) && (pf.override() != PackFile.OVERRIDE_TRUE)) { boolean overwritefile = false; // don't overwrite file if the user said so if (pf.override() != PackFile.OVERRIDE_FALSE) { if (pf.override() == PackFile.OVERRIDE_TRUE) { overwritefile = true; } else if (pf.override() == PackFile.OVERRIDE_UPDATE) { // check mtime of involved files // (this is not 100% perfect, because the already existing file might // still be modified but the new installed is just a bit newer; we would // need the creation time of the existing file or record with which mtime // it was installed...) overwritefile = (pathFile.lastModified() < pf.lastModified()); } else { int def_choice = -1; if (pf.override() == PackFile.OVERRIDE_ASK_FALSE) def_choice = AbstractUIHandler.ANSWER_NO; if (pf.override() == PackFile.OVERRIDE_ASK_TRUE) def_choice = AbstractUIHandler.ANSWER_YES; int answer = handler.askQuestion( idata.langpack.getString("InstallPanel.overwrite.title") + pathFile.getName(), idata.langpack.getString( "InstallPanel.overwrite.question") + pathFile.getAbsolutePath(), AbstractUIHandler.CHOICES_YES_NO, def_choice); overwritefile = (answer == AbstractUIHandler.ANSWER_YES); } } if (!overwritefile) { if (!pf.isBackReference() && !((Pack)packs.get(i)).loose) objIn.skip(pf.length()); continue; } } // We copy the file out = new FileOutputStream(pathFile); byte[] buffer = new byte[5120]; long bytesCopied = 0; InputStream pis = objIn; if (pf.isBackReference()) { InputStream is = getPackAsStream(pf.previousPackNumber); pis = new ObjectInputStream(is); //must wrap for blockdata use by objectstream (otherwise strange result) //skip on underlaying stream (for some reason not possible on ObjectStream) is.skip(pf.offsetInPreviousPack - 4); //but the stream header is now already read (== 4 bytes) } else if(((Pack)packs.get(i)).loose) { pis = new FileInputStream(pf.sourcePath); } while (bytesCopied < pf.length()) { int maxBytes = (int)Math.min(pf.length() - bytesCopied, buffer.length); int bytesInBuffer = pis.read(buffer, 0, maxBytes); if (bytesInBuffer == -1) throw new IOException("Unexpected end of stream"); out.write(buffer, 0, bytesInBuffer); bytesCopied += bytesInBuffer; } // Cleanings out.close(); if (pis != objIn) pis.close(); // Set file modification time if specified if (pf.lastModified() >= 0) pathFile.setLastModified(pf.lastModified()); // Custom action listener stuff --- afterFile ---- informListeners(customActions, InstallerListener.AFTER_FILE,pathFile, pf, null); } else { if (!pf.isBackReference()) objIn.skip(pf.length()); } } // Load information about parsable files int numParsables = objIn.readInt(); for (int k = 0; k < numParsables; k++) { ParsableFile pf = (ParsableFile) objIn.readObject(); pf.path = translatePath(pf.path); parsables.add(pf); } // Load information about executable files int numExecutables = objIn.readInt(); for (int k = 0; k < numExecutables; k++) { ExecutableFile ef = (ExecutableFile) objIn.readObject(); ef.path = translatePath(ef.path); if (null != ef.argList && !ef.argList.isEmpty()) { String arg = null; for (int j = 0; j < ef.argList.size(); j++) { arg = (String) ef.argList.get(j); arg = translatePath(arg); ef.argList.set(j, arg); } } executables.add(ef); if (ef.executionStage == ExecutableFile.UNINSTALL) { udata.addExecutable(ef); } } // Custom action listener stuff --- uninstall data ---- handleAdditionalUninstallData(udata, customActions); // Load information about updatechecks int numUpdateChecks = objIn.readInt(); for (int k = 0; k < numUpdateChecks; k++) { UpdateCheck uc = (UpdateCheck) objIn.readObject(); updatechecks.add(uc); } objIn.close(); // Custom action listener stuff --- afterPack ---- informListeners(customActions, InstallerListener.AFTER_PACK, packs.get(i), new Integer(i), handler); } // We use the scripts parser ScriptParser parser = new ScriptParser(parsables, vs); parser.parseFiles(); // We use the file executor FileExecutor executor = new FileExecutor(executables); if (executor.executeFiles(ExecutableFile.POSTINSTALL, handler) != 0) handler.emitError( "File execution failed", "The installation was not completed"); // We put the uninstaller (it's not yet complete...) putUninstaller(); // update checks _after_ uninstaller was put, so we don't delete it performUpdateChecks(updatechecks); // Custom action listener stuff --- afterPacks ---- informListeners(customActions, InstallerListener.AFTER_PACKS,idata, handler, null); // The end :-) handler.stopAction(); } catch (Exception err) { // TODO: finer grained error handling with useful error messages handler.stopAction(); handler.emitError("An error occured", err.toString()); err.printStackTrace(); } finally { instances.remove(instances.indexOf(this)); } } | 54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/97af55405ebcecbed7b6ed9f6138e21b9b76ce0d/Unpacker.java/buggy/src/lib/com/izforge/izpack/installer/Unpacker.java |
||
public WebAccessor(Component parent) | public WebAccessor() | public WebAccessor(Component parent) { this.parent = parent; Locale l = null; if (parent != null) parent.getLocale(); soloCancelOption = UIManager.get("OptionPane.cancelButtonText", l);// TODO: // i18n? Authenticator.setDefault(new MyDialogAuthenticator()); } | 54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/9619b3a25f43787dc92011111668210e06c00c71/WebAccessor.java/buggy/src/lib/com/izforge/izpack/installer/WebAccessor.java |
this.parent = parent; Locale l = null; if (parent != null) parent.getLocale(); soloCancelOption = UIManager.get("OptionPane.cancelButtonText", l); Authenticator.setDefault(new MyDialogAuthenticator()); | throw new UnsupportedOperationException(); | public WebAccessor(Component parent) { this.parent = parent; Locale l = null; if (parent != null) parent.getLocale(); soloCancelOption = UIManager.get("OptionPane.cancelButtonText", l);// TODO: // i18n? Authenticator.setDefault(new MyDialogAuthenticator()); } | 54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/9619b3a25f43787dc92011111668210e06c00c71/WebAccessor.java/buggy/src/lib/com/izforge/izpack/installer/WebAccessor.java |
this.worker = new ProcessPanelWorker(idata, this); | ProcessPanelWorker worker = new ProcessPanelWorker(idata, this); | public void runAutomated(AutomatedInstallData idata, XMLElement panelRoot) { try { this.worker = new ProcessPanelWorker(idata, this); this.worker.run(); } catch (IOException e) { e.printStackTrace(); } } | 54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/9619b3a25f43787dc92011111668210e06c00c71/ProcessPanelAutomationHelper.java/buggy/src/lib/com/izforge/izpack/panels/ProcessPanelAutomationHelper.java |
this.worker.run(); | worker.run(); | public void runAutomated(AutomatedInstallData idata, XMLElement panelRoot) { try { this.worker = new ProcessPanelWorker(idata, this); this.worker.run(); } catch (IOException e) { e.printStackTrace(); } } | 54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/9619b3a25f43787dc92011111668210e06c00c71/ProcessPanelAutomationHelper.java/buggy/src/lib/com/izforge/izpack/panels/ProcessPanelAutomationHelper.java |
JLabel infoLabel = new JLabel(parent.langpack.getString("LicencePanel.info"), parent.icons.getImageIcon("history"), JLabel.TRAILING); | JLabel infoLabel = new JLabel( parent.langpack.getString("LicencePanel.info"), parent.icons.getImageIcon("history"), JLabel.TRAILING); | public LicencePanel(InstallerFrame parent, InstallData idata) { super(parent, idata); // We initialize our layout setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); // We load the licence loadLicence(); // We put our components JLabel infoLabel = new JLabel(parent.langpack.getString("LicencePanel.info"), parent.icons.getImageIcon("history"), JLabel.TRAILING); add(infoLabel); add(Box.createRigidArea(new Dimension(0, 3))); textArea = new JTextArea(licence); textArea.setMargin(new Insets(2,2,2,2)); textArea.setCaretPosition(0); textArea.setEditable(false); textArea.setLineWrap(true); textArea.setWrapStyleWord(true); scroller = new JScrollPane(textArea); scroller.setAlignmentX(LEFT_ALIGNMENT); add(scroller); ButtonGroup group = new ButtonGroup(); yesRadio = new JRadioButton(parent.langpack.getString("LicencePanel.agree"), false); group.add(yesRadio); add(yesRadio); yesRadio.addActionListener(this); noRadio = new JRadioButton(parent.langpack.getString("LicencePanel.notagree"), true); group.add(noRadio); add(noRadio); noRadio.addActionListener(this); } | 54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/6e8ab3930a21f787bcd0f3cf0b9937f9d50c80c0/LicencePanel.java/buggy/src/lib/com/izforge/izpack/panels/LicencePanel.java |
textArea.setMargin(new Insets(2,2,2,2)); | textArea.setMargin(new Insets(2, 2, 2, 2)); | public LicencePanel(InstallerFrame parent, InstallData idata) { super(parent, idata); // We initialize our layout setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); // We load the licence loadLicence(); // We put our components JLabel infoLabel = new JLabel(parent.langpack.getString("LicencePanel.info"), parent.icons.getImageIcon("history"), JLabel.TRAILING); add(infoLabel); add(Box.createRigidArea(new Dimension(0, 3))); textArea = new JTextArea(licence); textArea.setMargin(new Insets(2,2,2,2)); textArea.setCaretPosition(0); textArea.setEditable(false); textArea.setLineWrap(true); textArea.setWrapStyleWord(true); scroller = new JScrollPane(textArea); scroller.setAlignmentX(LEFT_ALIGNMENT); add(scroller); ButtonGroup group = new ButtonGroup(); yesRadio = new JRadioButton(parent.langpack.getString("LicencePanel.agree"), false); group.add(yesRadio); add(yesRadio); yesRadio.addActionListener(this); noRadio = new JRadioButton(parent.langpack.getString("LicencePanel.notagree"), true); group.add(noRadio); add(noRadio); noRadio.addActionListener(this); } | 54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/6e8ab3930a21f787bcd0f3cf0b9937f9d50c80c0/LicencePanel.java/buggy/src/lib/com/izforge/izpack/panels/LicencePanel.java |
yesRadio = new JRadioButton(parent.langpack.getString("LicencePanel.agree"), false); | yesRadio = new JRadioButton(parent.langpack.getString("LicencePanel.agree"), false); | public LicencePanel(InstallerFrame parent, InstallData idata) { super(parent, idata); // We initialize our layout setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); // We load the licence loadLicence(); // We put our components JLabel infoLabel = new JLabel(parent.langpack.getString("LicencePanel.info"), parent.icons.getImageIcon("history"), JLabel.TRAILING); add(infoLabel); add(Box.createRigidArea(new Dimension(0, 3))); textArea = new JTextArea(licence); textArea.setMargin(new Insets(2,2,2,2)); textArea.setCaretPosition(0); textArea.setEditable(false); textArea.setLineWrap(true); textArea.setWrapStyleWord(true); scroller = new JScrollPane(textArea); scroller.setAlignmentX(LEFT_ALIGNMENT); add(scroller); ButtonGroup group = new ButtonGroup(); yesRadio = new JRadioButton(parent.langpack.getString("LicencePanel.agree"), false); group.add(yesRadio); add(yesRadio); yesRadio.addActionListener(this); noRadio = new JRadioButton(parent.langpack.getString("LicencePanel.notagree"), true); group.add(noRadio); add(noRadio); noRadio.addActionListener(this); } | 54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/6e8ab3930a21f787bcd0f3cf0b9937f9d50c80c0/LicencePanel.java/buggy/src/lib/com/izforge/izpack/panels/LicencePanel.java |
noRadio = new JRadioButton(parent.langpack.getString("LicencePanel.notagree"), true); | noRadio = new JRadioButton( parent.langpack.getString("LicencePanel.notagree"), true); | public LicencePanel(InstallerFrame parent, InstallData idata) { super(parent, idata); // We initialize our layout setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); // We load the licence loadLicence(); // We put our components JLabel infoLabel = new JLabel(parent.langpack.getString("LicencePanel.info"), parent.icons.getImageIcon("history"), JLabel.TRAILING); add(infoLabel); add(Box.createRigidArea(new Dimension(0, 3))); textArea = new JTextArea(licence); textArea.setMargin(new Insets(2,2,2,2)); textArea.setCaretPosition(0); textArea.setEditable(false); textArea.setLineWrap(true); textArea.setWrapStyleWord(true); scroller = new JScrollPane(textArea); scroller.setAlignmentX(LEFT_ALIGNMENT); add(scroller); ButtonGroup group = new ButtonGroup(); yesRadio = new JRadioButton(parent.langpack.getString("LicencePanel.agree"), false); group.add(yesRadio); add(yesRadio); yesRadio.addActionListener(this); noRadio = new JRadioButton(parent.langpack.getString("LicencePanel.notagree"), true); group.add(noRadio); add(noRadio); noRadio.addActionListener(this); } | 54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/6e8ab3930a21f787bcd0f3cf0b9937f9d50c80c0/LicencePanel.java/buggy/src/lib/com/izforge/izpack/panels/LicencePanel.java |
} else | } else | public boolean isValidated() { if (noRadio.isSelected()) { parent.exit(); return false; } else return (yesRadio.isSelected()); } | 54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/6e8ab3930a21f787bcd0f3cf0b9937f9d50c80c0/LicencePanel.java/buggy/src/lib/com/izforge/izpack/panels/LicencePanel.java |
} catch (Exception err) | } catch (Exception err) | private void loadLicence() { try { // We read it String resNamePrifix = "LicencePanel.licence"; licence = ResourceManager.getInstance().getTextResource(resNamePrifix); } catch (Exception err) { licence = "Error : could not load the licence text !"; } } | 54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/6e8ab3930a21f787bcd0f3cf0b9937f9d50c80c0/LicencePanel.java/buggy/src/lib/com/izforge/izpack/panels/LicencePanel.java |
if (targetfile_attr == null) { throw new Exception ("missing \"targetfile\" attribute for <parsable> in line "+e.getLineNr()); | if ((targetfile_attr == null) && (executeClass == null)) { throw new Exception ("either \"targetfile\" or \"class\" attribute is required for <executable> in line "+e.getLineNr()); | protected ArrayList getPacks(XMLElement data) throws Exception { // Initialisation ArrayList packs = new ArrayList(); XMLElement root = data.getFirstChildNamed("packs"); if (root == null) { throw new Exception ("no packs specified"); } // dummy variable used for values from XML String val; // We process each pack markup int npacks = root.getChildrenCount(); for (int i = 0; i < npacks; i++) { XMLElement el = root.getChildAtIndex(i); // Trivial initialisations Pack pack = new Pack(); pack.number = i; pack.name = el.getAttribute("name"); if (pack.name == null) { throw new Exception ("missing \"name\" attribute for <pack> in line "+el.getLineNr()); } pack.osConstraints = OsConstraint.getOsList (el); pack.required = el.getAttribute("required").equalsIgnoreCase("yes"); pack.description = el.getFirstChildNamed("description").getContent(); pack.preselected = true; val = el.getAttribute ("preselected"); if ((null != val) && ("no".compareToIgnoreCase (val) == 0)) pack.preselected = false; // We get the parsables list Iterator iter = null; Vector children = el.getChildrenNamed("parsable"); if (null != children && !children.isEmpty()) { iter = children.iterator(); while (iter.hasNext()) { XMLElement p = (XMLElement) iter.next(); String targetFile = p.getAttribute("targetfile"); if (targetFile == null) throw new Exception ("missing \"targetfile\" attribute for <parsable> in line "+p.getLineNr()); List osList = OsConstraint.getOsList (p); pack.parsables.add (new ParsableFile(targetFile, p.getAttribute("type", "plain"), p.getAttribute("encoding", null), osList)); } } // We get the executables list children = el.getChildrenNamed("executable"); if (null != children && !children.isEmpty()) { iter = children.iterator(); while (iter.hasNext()) { XMLElement e = (XMLElement) iter.next(); // when to execute this executable int executeOn = ExecutableFile.NEVER; val = e.getAttribute("stage", "never"); if ("postinstall".compareToIgnoreCase(val) == 0) executeOn = ExecutableFile.POSTINSTALL; else if ("uninstall".compareToIgnoreCase(val) == 0) executeOn = ExecutableFile.UNINSTALL; // main class of this executable String executeClass = e.getAttribute("class"); // type of this executable int executeType = ExecutableFile.BIN; val = e.getAttribute("type", "bin"); if ("jar".compareToIgnoreCase(val) == 0) executeType = ExecutableFile.JAR; // what to do if execution fails int onFailure = ExecutableFile.ASK; val = e.getAttribute("failure", "ask"); if ("abort".compareToIgnoreCase(val) == 0) onFailure = ExecutableFile.ABORT; else if ("warn".compareToIgnoreCase(val) == 0) onFailure = ExecutableFile.WARN; // whether to keep the executable after executing it boolean keepFile = false; val = e.getAttribute ("keep"); if ((null != val) && ("true".compareToIgnoreCase(val) == 0)) keepFile = true; // get arguments for this executable ArrayList argList = new ArrayList(); XMLElement args = e.getFirstChildNamed("args"); if (null != args) { argList = new ArrayList(); Iterator argIterator = args.getChildrenNamed("arg").iterator(); while (argIterator.hasNext()) { XMLElement arg = (XMLElement) argIterator.next(); argList.add(arg.getAttribute("value")); } } List osList = OsConstraint.getOsList(e); String targetfile_attr = e.getAttribute("targetfile"); if (targetfile_attr == null) { throw new Exception ("missing \"targetfile\" attribute for <parsable> in line "+e.getLineNr()); } pack.executables.add(new ExecutableFile(targetfile_attr, executeType, executeClass, executeOn, onFailure, argList, osList, keepFile)); } } // We get the files list iter = el.getChildrenNamed("file").iterator(); while (iter.hasNext()) { XMLElement f = (XMLElement) iter.next(); String src_attr = f.getAttribute ("src"); if (src_attr == null) { throw new Exception ("missing \"src\" attribute for <file> in line "+f.getLineNr()); } String path; if (new File(src_attr).isAbsolute()) { path = src_attr; } else { path = basedir + File.separator + src_attr; } File file = new File(path); int override = getOverrideValue (f); List osList = OsConstraint.getOsList (f); String targetdir_attr = f.getAttribute ("targetdir"); if (targetdir_attr == null) { throw new Exception ("missing \"targetdir\" attribute for <file> in line "+f.getLineNr()); } addFile(file, targetdir_attr, osList, override, pack.packFiles); } // We get the singlefiles list iter = el.getChildrenNamed("singlefile").iterator(); while (iter.hasNext()) { XMLElement f = (XMLElement) iter.next(); String src_attr = f.getAttribute ("src"); if (src_attr == null) { throw new Exception ("missing \"src\" attribute for <file> in line "+f.getLineNr()); } String path; if (new File (src_attr).isAbsolute ()) { path = src_attr; } else { path = basedir + File.separator + src_attr; } File file = new File(path); int override = getOverrideValue (f); List osList = OsConstraint.getOsList (f); String target_attr = f.getAttribute ("target"); if (target_attr == null) { throw new Exception ("missing \"target\" attribute for <file> in line "+f.getLineNr()); } addSingleFile(file, target_attr, osList, override, pack.packFiles); } // We get the fileset list iter = el.getChildrenNamed("fileset").iterator(); while (iter.hasNext()) { XMLElement f = (XMLElement) iter.next(); String dir_attr = f.getAttribute ("dir"); if (dir_attr == null) { throw new Exception ("missing \"dir\" attribute for fileset in line "+f.getLineNr()); } String path; if (new File(dir_attr).isAbsolute()) { path = dir_attr; } else { path = basedir + File.separator + dir_attr; } String casesensitive = f.getAttribute("casesensitive"); // get includes and excludes Vector xcludesList = f.getChildrenNamed("include"); String[] includes = null; XMLElement xclude = null; if (xcludesList.size() > 0) { includes = new String[xcludesList.size()]; for (int j = 0; j < xcludesList.size(); j++) { xclude = (XMLElement) xcludesList.get(j); includes[j] = xclude.getAttribute("name"); } } xcludesList = f.getChildrenNamed("exclude"); String[] excludes = null; xclude = null; if (xcludesList.size() > 0) { excludes = new String[xcludesList.size()]; for (int j = 0; j < xcludesList.size(); j++) { xclude = (XMLElement) xcludesList.get(j); excludes[j] = xclude.getAttribute("name"); } } int override = getOverrideValue (f); String targetdir_attr = f.getAttribute ("targetdir"); if (targetdir_attr == null) { throw new Exception ("missing \"targetdir\" attribute for <fileset> in line "+f.getLineNr()); } List osList = OsConstraint.getOsList (f); addFileSet(path, includes, excludes, targetdir_attr, osList, pack.packFiles, casesensitive, override); } // We add the pack packs.add(pack); } // We return the ArrayList return packs; } | 54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/53b1e54c98a1f7db891cd9985df036951ebe9cbe/Compiler.java/buggy/src/lib/com/izforge/izpack/compiler/Compiler.java |
vs = new VariableSubstitutor(idata.getVariableValueMap()); | vs = new VariableSubstitutor(idata.getVariables()); | public Unpacker( AutomatedInstallData idata, AbstractUIProgressHandler handler) { super("IzPack - Unpacker thread"); this.idata = idata; this.handler = handler; // Initialize the variable substitutor vs = new VariableSubstitutor(idata.getVariableValueMap()); } | 54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/6822c9086a6716a2c03b2ad638f19542678f38a5/Unpacker.java/clean/src/lib/com/izforge/izpack/installer/Unpacker.java |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.