rem
stringlengths 0
477k
| add
stringlengths 0
313k
| context
stringlengths 6
599k
| meta
stringlengths 141
403
|
---|---|---|---|
protected void loadLookAndFeel() throws Exception { // Do we have any preference for this OS ? String sysos = System.getProperty("os.name"); String syskey = "unix"; if (sysos.regionMatches(true, 0, "windows", 0, 7)) { syskey = "windows"; } else if (sysos.regionMatches(true, 0, "mac", 0, 3)) { syskey = "mac"; } String laf = null; if (installdata.guiPrefs.lookAndFeelMapping.containsKey(syskey)) { laf = (String) installdata.guiPrefs.lookAndFeelMapping.get(syskey); } // Let's use the system LAF // Resolve whether button icons should be used or not. boolean useButtonIcons = true; if(installdata.guiPrefs.modifier.containsKey("useButtonIcons") && ((String)installdata.guiPrefs.modifier. get("useButtonIcons")).equalsIgnoreCase("no") ) useButtonIcons = false; ButtonFactory.useButtonIcons(useButtonIcons); boolean useLabelIcons = true; if(installdata.guiPrefs.modifier.containsKey("useLabelIcons") && ((String)installdata.guiPrefs.modifier. get("useLabelIcons")).equalsIgnoreCase("no") ) useLabelIcons = false; LabelFactory.setUseLabelIcons(useLabelIcons); if (laf == null) { if (!syskey.equals("mac")) { String syslaf = UIManager.getSystemLookAndFeelClassName(); UIManager.setLookAndFeel(syslaf); if (UIManager.getLookAndFeel() instanceof MetalLookAndFeel) { MetalLookAndFeel.setCurrentTheme(new IzPackMetalTheme()); ButtonFactory.useHighlightButtons(); // Reset the use button icons state because useHighlightButtons // make it always true. ButtonFactory.useButtonIcons(useButtonIcons); installdata.buttonsHColor = new Color(182, 182, 204); } } lnf = "swing"; return; } // Kunststoff (http://www.incors.org/) if (laf.equals("kunststoff")) { ButtonFactory.useHighlightButtons(); // Reset the use button icons state because useHighlightButtons // make it always true. ButtonFactory.useButtonIcons(useButtonIcons); installdata.buttonsHColor = new Color(255, 255, 255); Class lafClass = Class .forName("com.incors.plaf.kunststoff.KunststoffLookAndFeel"); Class mtheme = Class.forName("javax.swing.plaf.metal.MetalTheme"); Class[] params = { mtheme}; Class theme = Class.forName("com.izforge.izpack.gui.IzPackKMetalTheme"); Method setCurrentThemeMethod = lafClass.getMethod("setCurrentTheme", params); // We invoke and place Kunststoff as our L&F LookAndFeel kunststoff = (LookAndFeel) lafClass.newInstance(); MetalTheme ktheme = (MetalTheme) theme.newInstance(); Object[] kparams = { ktheme}; UIManager.setLookAndFeel(kunststoff); setCurrentThemeMethod.invoke(kunststoff, kparams); lnf = "kunststoff"; return; } // Liquid (http://liquidlnf.sourceforge.net/) if (laf.equals("liquid")) { UIManager.setLookAndFeel("com.birosoft.liquid.LiquidLookAndFeel"); lnf = "liquid"; Map params = (Map)installdata.guiPrefs.lookAndFeelParams.get(laf); if (params.containsKey("decorate.frames")) { String value = (String)params.get("decorate.frames"); if (value.equals("yes")) { JFrame.setDefaultLookAndFeelDecorated(true); } } if (params.containsKey("decorate.dialogs")) { String value = (String)params.get("decorate.dialogs"); if (value.equals("yes")) { JDialog.setDefaultLookAndFeelDecorated(true); } } return; } // Metouia (http://mlf.sourceforge.net/) if (laf.equals("metouia")) { UIManager.setLookAndFeel("net.sourceforge.mlf.metouia.MetouiaLookAndFeel"); lnf = "metouia"; return; } // JGoodies Looks (http://looks.dev.java.net/) if (laf.equals("looks")) { Map variants = new TreeMap(); variants.put("extwin", "com.jgoodies.plaf.windows.ExtWindowsLookAndFeel "); variants.put("plastic", "com.jgoodies.plaf.plastic.PlasticLookAndFeel"); variants.put("plastic3D", "com.jgoodies.plaf.plastic.Plastic3DLookAndFeel"); variants.put("plasticXP", "com.jgoodies.plaf.plastic.PlasticXPLookAndFeel"); String variant = (String)variants.get("plasticXP"); Map params = (Map)installdata.guiPrefs.lookAndFeelParams.get(laf); if (params.containsKey("variant")) { String param = (String)params.get("variant"); if (variants.containsKey(param)) { variant = (String)variants.get(param); } } UIManager.setLookAndFeel(variant); } } | 54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/d2cee8f5165671d318a97cc2eed7768c8b3c691c/GUIInstaller.java/buggy/src/lib/com/izforge/izpack/installer/GUIInstaller.java |
||
protected void loadLookAndFeel() throws Exception { // Do we have any preference for this OS ? String sysos = System.getProperty("os.name"); String syskey = "unix"; if (sysos.regionMatches(true, 0, "windows", 0, 7)) { syskey = "windows"; } else if (sysos.regionMatches(true, 0, "mac", 0, 3)) { syskey = "mac"; } String laf = null; if (installdata.guiPrefs.lookAndFeelMapping.containsKey(syskey)) { laf = (String) installdata.guiPrefs.lookAndFeelMapping.get(syskey); } // Let's use the system LAF // Resolve whether button icons should be used or not. boolean useButtonIcons = true; if(installdata.guiPrefs.modifier.containsKey("useButtonIcons") && ((String)installdata.guiPrefs.modifier. get("useButtonIcons")).equalsIgnoreCase("no") ) useButtonIcons = false; ButtonFactory.useButtonIcons(useButtonIcons); boolean useLabelIcons = true; if(installdata.guiPrefs.modifier.containsKey("useLabelIcons") && ((String)installdata.guiPrefs.modifier. get("useLabelIcons")).equalsIgnoreCase("no") ) useLabelIcons = false; LabelFactory.setUseLabelIcons(useLabelIcons); if (laf == null) { if (!syskey.equals("mac")) { String syslaf = UIManager.getSystemLookAndFeelClassName(); UIManager.setLookAndFeel(syslaf); if (UIManager.getLookAndFeel() instanceof MetalLookAndFeel) { MetalLookAndFeel.setCurrentTheme(new IzPackMetalTheme()); ButtonFactory.useHighlightButtons(); // Reset the use button icons state because useHighlightButtons // make it always true. ButtonFactory.useButtonIcons(useButtonIcons); installdata.buttonsHColor = new Color(182, 182, 204); } } lnf = "swing"; return; } // Kunststoff (http://www.incors.org/) if (laf.equals("kunststoff")) { ButtonFactory.useHighlightButtons(); // Reset the use button icons state because useHighlightButtons // make it always true. ButtonFactory.useButtonIcons(useButtonIcons); installdata.buttonsHColor = new Color(255, 255, 255); Class lafClass = Class .forName("com.incors.plaf.kunststoff.KunststoffLookAndFeel"); Class mtheme = Class.forName("javax.swing.plaf.metal.MetalTheme"); Class[] params = { mtheme}; Class theme = Class.forName("com.izforge.izpack.gui.IzPackKMetalTheme"); Method setCurrentThemeMethod = lafClass.getMethod("setCurrentTheme", params); // We invoke and place Kunststoff as our L&F LookAndFeel kunststoff = (LookAndFeel) lafClass.newInstance(); MetalTheme ktheme = (MetalTheme) theme.newInstance(); Object[] kparams = { ktheme}; UIManager.setLookAndFeel(kunststoff); setCurrentThemeMethod.invoke(kunststoff, kparams); lnf = "kunststoff"; return; } // Liquid (http://liquidlnf.sourceforge.net/) if (laf.equals("liquid")) { UIManager.setLookAndFeel("com.birosoft.liquid.LiquidLookAndFeel"); lnf = "liquid"; Map params = (Map)installdata.guiPrefs.lookAndFeelParams.get(laf); if (params.containsKey("decorate.frames")) { String value = (String)params.get("decorate.frames"); if (value.equals("yes")) { JFrame.setDefaultLookAndFeelDecorated(true); } } if (params.containsKey("decorate.dialogs")) { String value = (String)params.get("decorate.dialogs"); if (value.equals("yes")) { JDialog.setDefaultLookAndFeelDecorated(true); } } return; } // Metouia (http://mlf.sourceforge.net/) if (laf.equals("metouia")) { UIManager.setLookAndFeel("net.sourceforge.mlf.metouia.MetouiaLookAndFeel"); lnf = "metouia"; return; } // JGoodies Looks (http://looks.dev.java.net/) if (laf.equals("looks")) { Map variants = new TreeMap(); variants.put("extwin", "com.jgoodies.plaf.windows.ExtWindowsLookAndFeel "); variants.put("plastic", "com.jgoodies.plaf.plastic.PlasticLookAndFeel"); variants.put("plastic3D", "com.jgoodies.plaf.plastic.Plastic3DLookAndFeel"); variants.put("plasticXP", "com.jgoodies.plaf.plastic.PlasticXPLookAndFeel"); String variant = (String)variants.get("plasticXP"); Map params = (Map)installdata.guiPrefs.lookAndFeelParams.get(laf); if (params.containsKey("variant")) { String param = (String)params.get("variant"); if (variants.containsKey(param)) { variant = (String)variants.get(param); } } UIManager.setLookAndFeel(variant); } } | 54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/d2cee8f5165671d318a97cc2eed7768c8b3c691c/GUIInstaller.java/buggy/src/lib/com/izforge/izpack/installer/GUIInstaller.java |
||
protected void loadLookAndFeel() throws Exception { // Do we have any preference for this OS ? String sysos = System.getProperty("os.name"); String syskey = "unix"; if (sysos.regionMatches(true, 0, "windows", 0, 7)) { syskey = "windows"; } else if (sysos.regionMatches(true, 0, "mac", 0, 3)) { syskey = "mac"; } String laf = null; if (installdata.guiPrefs.lookAndFeelMapping.containsKey(syskey)) { laf = (String) installdata.guiPrefs.lookAndFeelMapping.get(syskey); } // Let's use the system LAF // Resolve whether button icons should be used or not. boolean useButtonIcons = true; if(installdata.guiPrefs.modifier.containsKey("useButtonIcons") && ((String)installdata.guiPrefs.modifier. get("useButtonIcons")).equalsIgnoreCase("no") ) useButtonIcons = false; ButtonFactory.useButtonIcons(useButtonIcons); boolean useLabelIcons = true; if(installdata.guiPrefs.modifier.containsKey("useLabelIcons") && ((String)installdata.guiPrefs.modifier. get("useLabelIcons")).equalsIgnoreCase("no") ) useLabelIcons = false; LabelFactory.setUseLabelIcons(useLabelIcons); if (laf == null) { if (!syskey.equals("mac")) { String syslaf = UIManager.getSystemLookAndFeelClassName(); UIManager.setLookAndFeel(syslaf); if (UIManager.getLookAndFeel() instanceof MetalLookAndFeel) { MetalLookAndFeel.setCurrentTheme(new IzPackMetalTheme()); ButtonFactory.useHighlightButtons(); // Reset the use button icons state because useHighlightButtons // make it always true. ButtonFactory.useButtonIcons(useButtonIcons); installdata.buttonsHColor = new Color(182, 182, 204); } } lnf = "swing"; return; } // Kunststoff (http://www.incors.org/) if (laf.equals("kunststoff")) { ButtonFactory.useHighlightButtons(); // Reset the use button icons state because useHighlightButtons // make it always true. ButtonFactory.useButtonIcons(useButtonIcons); installdata.buttonsHColor = new Color(255, 255, 255); Class lafClass = Class .forName("com.incors.plaf.kunststoff.KunststoffLookAndFeel"); Class mtheme = Class.forName("javax.swing.plaf.metal.MetalTheme"); Class[] params = { mtheme}; Class theme = Class.forName("com.izforge.izpack.gui.IzPackKMetalTheme"); Method setCurrentThemeMethod = lafClass.getMethod("setCurrentTheme", params); // We invoke and place Kunststoff as our L&F LookAndFeel kunststoff = (LookAndFeel) lafClass.newInstance(); MetalTheme ktheme = (MetalTheme) theme.newInstance(); Object[] kparams = { ktheme}; UIManager.setLookAndFeel(kunststoff); setCurrentThemeMethod.invoke(kunststoff, kparams); lnf = "kunststoff"; return; } // Liquid (http://liquidlnf.sourceforge.net/) if (laf.equals("liquid")) { UIManager.setLookAndFeel("com.birosoft.liquid.LiquidLookAndFeel"); lnf = "liquid"; Map params = (Map)installdata.guiPrefs.lookAndFeelParams.get(laf); if (params.containsKey("decorate.frames")) { String value = (String)params.get("decorate.frames"); if (value.equals("yes")) { JFrame.setDefaultLookAndFeelDecorated(true); } } if (params.containsKey("decorate.dialogs")) { String value = (String)params.get("decorate.dialogs"); if (value.equals("yes")) { JDialog.setDefaultLookAndFeelDecorated(true); } } return; } // Metouia (http://mlf.sourceforge.net/) if (laf.equals("metouia")) { UIManager.setLookAndFeel("net.sourceforge.mlf.metouia.MetouiaLookAndFeel"); lnf = "metouia"; return; } // JGoodies Looks (http://looks.dev.java.net/) if (laf.equals("looks")) { Map variants = new TreeMap(); variants.put("extwin", "com.jgoodies.plaf.windows.ExtWindowsLookAndFeel "); variants.put("plastic", "com.jgoodies.plaf.plastic.PlasticLookAndFeel"); variants.put("plastic3D", "com.jgoodies.plaf.plastic.Plastic3DLookAndFeel"); variants.put("plasticXP", "com.jgoodies.plaf.plastic.PlasticXPLookAndFeel"); String variant = (String)variants.get("plasticXP"); Map params = (Map)installdata.guiPrefs.lookAndFeelParams.get(laf); if (params.containsKey("variant")) { String param = (String)params.get("variant"); if (variants.containsKey(param)) { variant = (String)variants.get(param); } } UIManager.setLookAndFeel(variant); } } | 54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/d2cee8f5165671d318a97cc2eed7768c8b3c691c/GUIInstaller.java/buggy/src/lib/com/izforge/izpack/installer/GUIInstaller.java |
||
protected void loadLookAndFeel() throws Exception { // Do we have any preference for this OS ? String sysos = System.getProperty("os.name"); String syskey = "unix"; if (sysos.regionMatches(true, 0, "windows", 0, 7)) { syskey = "windows"; } else if (sysos.regionMatches(true, 0, "mac", 0, 3)) { syskey = "mac"; } String laf = null; if (installdata.guiPrefs.lookAndFeelMapping.containsKey(syskey)) { laf = (String) installdata.guiPrefs.lookAndFeelMapping.get(syskey); } // Let's use the system LAF // Resolve whether button icons should be used or not. boolean useButtonIcons = true; if(installdata.guiPrefs.modifier.containsKey("useButtonIcons") && ((String)installdata.guiPrefs.modifier. get("useButtonIcons")).equalsIgnoreCase("no") ) useButtonIcons = false; ButtonFactory.useButtonIcons(useButtonIcons); boolean useLabelIcons = true; if(installdata.guiPrefs.modifier.containsKey("useLabelIcons") && ((String)installdata.guiPrefs.modifier. get("useLabelIcons")).equalsIgnoreCase("no") ) useLabelIcons = false; LabelFactory.setUseLabelIcons(useLabelIcons); if (laf == null) { if (!syskey.equals("mac")) { String syslaf = UIManager.getSystemLookAndFeelClassName(); UIManager.setLookAndFeel(syslaf); if (UIManager.getLookAndFeel() instanceof MetalLookAndFeel) { MetalLookAndFeel.setCurrentTheme(new IzPackMetalTheme()); ButtonFactory.useHighlightButtons(); // Reset the use button icons state because useHighlightButtons // make it always true. ButtonFactory.useButtonIcons(useButtonIcons); installdata.buttonsHColor = new Color(182, 182, 204); } } lnf = "swing"; return; } // Kunststoff (http://www.incors.org/) if (laf.equals("kunststoff")) { ButtonFactory.useHighlightButtons(); // Reset the use button icons state because useHighlightButtons // make it always true. ButtonFactory.useButtonIcons(useButtonIcons); installdata.buttonsHColor = new Color(255, 255, 255); Class lafClass = Class .forName("com.incors.plaf.kunststoff.KunststoffLookAndFeel"); Class mtheme = Class.forName("javax.swing.plaf.metal.MetalTheme"); Class[] params = { mtheme}; Class theme = Class.forName("com.izforge.izpack.gui.IzPackKMetalTheme"); Method setCurrentThemeMethod = lafClass.getMethod("setCurrentTheme", params); // We invoke and place Kunststoff as our L&F LookAndFeel kunststoff = (LookAndFeel) lafClass.newInstance(); MetalTheme ktheme = (MetalTheme) theme.newInstance(); Object[] kparams = { ktheme}; UIManager.setLookAndFeel(kunststoff); setCurrentThemeMethod.invoke(kunststoff, kparams); lnf = "kunststoff"; return; } // Liquid (http://liquidlnf.sourceforge.net/) if (laf.equals("liquid")) { UIManager.setLookAndFeel("com.birosoft.liquid.LiquidLookAndFeel"); lnf = "liquid"; Map params = (Map)installdata.guiPrefs.lookAndFeelParams.get(laf); if (params.containsKey("decorate.frames")) { String value = (String)params.get("decorate.frames"); if (value.equals("yes")) { JFrame.setDefaultLookAndFeelDecorated(true); } } if (params.containsKey("decorate.dialogs")) { String value = (String)params.get("decorate.dialogs"); if (value.equals("yes")) { JDialog.setDefaultLookAndFeelDecorated(true); } } return; } // Metouia (http://mlf.sourceforge.net/) if (laf.equals("metouia")) { UIManager.setLookAndFeel("net.sourceforge.mlf.metouia.MetouiaLookAndFeel"); lnf = "metouia"; return; } // JGoodies Looks (http://looks.dev.java.net/) if (laf.equals("looks")) { Map variants = new TreeMap(); variants.put("extwin", "com.jgoodies.plaf.windows.ExtWindowsLookAndFeel "); variants.put("plastic", "com.jgoodies.plaf.plastic.PlasticLookAndFeel"); variants.put("plastic3D", "com.jgoodies.plaf.plastic.Plastic3DLookAndFeel"); variants.put("plasticXP", "com.jgoodies.plaf.plastic.PlasticXPLookAndFeel"); String variant = (String)variants.get("plasticXP"); Map params = (Map)installdata.guiPrefs.lookAndFeelParams.get(laf); if (params.containsKey("variant")) { String param = (String)params.get("variant"); if (variants.containsKey(param)) { variant = (String)variants.get(param); } } UIManager.setLookAndFeel(variant); } } | 54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/d2cee8f5165671d318a97cc2eed7768c8b3c691c/GUIInstaller.java/buggy/src/lib/com/izforge/izpack/installer/GUIInstaller.java |
||
variants.put("extwin", "com.jgoodies.plaf.windows.ExtWindowsLookAndFeel "); | variants.put("extwin", "com.jgoodies.plaf.windows.ExtWindowsLookAndFeel"); | protected void loadLookAndFeel() throws Exception { // Do we have any preference for this OS ? String sysos = System.getProperty("os.name"); String syskey = "unix"; if (sysos.regionMatches(true, 0, "windows", 0, 7)) { syskey = "windows"; } else if (sysos.regionMatches(true, 0, "mac", 0, 3)) { syskey = "mac"; } String laf = null; if (installdata.guiPrefs.lookAndFeelMapping.containsKey(syskey)) { laf = (String) installdata.guiPrefs.lookAndFeelMapping.get(syskey); } // Let's use the system LAF // Resolve whether button icons should be used or not. boolean useButtonIcons = true; if(installdata.guiPrefs.modifier.containsKey("useButtonIcons") && ((String)installdata.guiPrefs.modifier. get("useButtonIcons")).equalsIgnoreCase("no") ) useButtonIcons = false; ButtonFactory.useButtonIcons(useButtonIcons); boolean useLabelIcons = true; if(installdata.guiPrefs.modifier.containsKey("useLabelIcons") && ((String)installdata.guiPrefs.modifier. get("useLabelIcons")).equalsIgnoreCase("no") ) useLabelIcons = false; LabelFactory.setUseLabelIcons(useLabelIcons); if (laf == null) { if (!syskey.equals("mac")) { String syslaf = UIManager.getSystemLookAndFeelClassName(); UIManager.setLookAndFeel(syslaf); if (UIManager.getLookAndFeel() instanceof MetalLookAndFeel) { MetalLookAndFeel.setCurrentTheme(new IzPackMetalTheme()); ButtonFactory.useHighlightButtons(); // Reset the use button icons state because useHighlightButtons // make it always true. ButtonFactory.useButtonIcons(useButtonIcons); installdata.buttonsHColor = new Color(182, 182, 204); } } lnf = "swing"; return; } // Kunststoff (http://www.incors.org/) if (laf.equals("kunststoff")) { ButtonFactory.useHighlightButtons(); // Reset the use button icons state because useHighlightButtons // make it always true. ButtonFactory.useButtonIcons(useButtonIcons); installdata.buttonsHColor = new Color(255, 255, 255); Class lafClass = Class .forName("com.incors.plaf.kunststoff.KunststoffLookAndFeel"); Class mtheme = Class.forName("javax.swing.plaf.metal.MetalTheme"); Class[] params = { mtheme}; Class theme = Class.forName("com.izforge.izpack.gui.IzPackKMetalTheme"); Method setCurrentThemeMethod = lafClass.getMethod("setCurrentTheme", params); // We invoke and place Kunststoff as our L&F LookAndFeel kunststoff = (LookAndFeel) lafClass.newInstance(); MetalTheme ktheme = (MetalTheme) theme.newInstance(); Object[] kparams = { ktheme}; UIManager.setLookAndFeel(kunststoff); setCurrentThemeMethod.invoke(kunststoff, kparams); lnf = "kunststoff"; return; } // Liquid (http://liquidlnf.sourceforge.net/) if (laf.equals("liquid")) { UIManager.setLookAndFeel("com.birosoft.liquid.LiquidLookAndFeel"); lnf = "liquid"; Map params = (Map)installdata.guiPrefs.lookAndFeelParams.get(laf); if (params.containsKey("decorate.frames")) { String value = (String)params.get("decorate.frames"); if (value.equals("yes")) { JFrame.setDefaultLookAndFeelDecorated(true); } } if (params.containsKey("decorate.dialogs")) { String value = (String)params.get("decorate.dialogs"); if (value.equals("yes")) { JDialog.setDefaultLookAndFeelDecorated(true); } } return; } // Metouia (http://mlf.sourceforge.net/) if (laf.equals("metouia")) { UIManager.setLookAndFeel("net.sourceforge.mlf.metouia.MetouiaLookAndFeel"); lnf = "metouia"; return; } // JGoodies Looks (http://looks.dev.java.net/) if (laf.equals("looks")) { Map variants = new TreeMap(); variants.put("extwin", "com.jgoodies.plaf.windows.ExtWindowsLookAndFeel "); variants.put("plastic", "com.jgoodies.plaf.plastic.PlasticLookAndFeel"); variants.put("plastic3D", "com.jgoodies.plaf.plastic.Plastic3DLookAndFeel"); variants.put("plasticXP", "com.jgoodies.plaf.plastic.PlasticXPLookAndFeel"); String variant = (String)variants.get("plasticXP"); Map params = (Map)installdata.guiPrefs.lookAndFeelParams.get(laf); if (params.containsKey("variant")) { String param = (String)params.get("variant"); if (variants.containsKey(param)) { variant = (String)variants.get(param); } } UIManager.setLookAndFeel(variant); } } | 54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/d2cee8f5165671d318a97cc2eed7768c8b3c691c/GUIInstaller.java/buggy/src/lib/com/izforge/izpack/installer/GUIInstaller.java |
protected void loadLookAndFeel() throws Exception { // Do we have any preference for this OS ? String sysos = System.getProperty("os.name"); String syskey = "unix"; if (sysos.regionMatches(true, 0, "windows", 0, 7)) { syskey = "windows"; } else if (sysos.regionMatches(true, 0, "mac", 0, 3)) { syskey = "mac"; } String laf = null; if (installdata.guiPrefs.lookAndFeelMapping.containsKey(syskey)) { laf = (String) installdata.guiPrefs.lookAndFeelMapping.get(syskey); } // Let's use the system LAF // Resolve whether button icons should be used or not. boolean useButtonIcons = true; if(installdata.guiPrefs.modifier.containsKey("useButtonIcons") && ((String)installdata.guiPrefs.modifier. get("useButtonIcons")).equalsIgnoreCase("no") ) useButtonIcons = false; ButtonFactory.useButtonIcons(useButtonIcons); boolean useLabelIcons = true; if(installdata.guiPrefs.modifier.containsKey("useLabelIcons") && ((String)installdata.guiPrefs.modifier. get("useLabelIcons")).equalsIgnoreCase("no") ) useLabelIcons = false; LabelFactory.setUseLabelIcons(useLabelIcons); if (laf == null) { if (!syskey.equals("mac")) { String syslaf = UIManager.getSystemLookAndFeelClassName(); UIManager.setLookAndFeel(syslaf); if (UIManager.getLookAndFeel() instanceof MetalLookAndFeel) { MetalLookAndFeel.setCurrentTheme(new IzPackMetalTheme()); ButtonFactory.useHighlightButtons(); // Reset the use button icons state because useHighlightButtons // make it always true. ButtonFactory.useButtonIcons(useButtonIcons); installdata.buttonsHColor = new Color(182, 182, 204); } } lnf = "swing"; return; } // Kunststoff (http://www.incors.org/) if (laf.equals("kunststoff")) { ButtonFactory.useHighlightButtons(); // Reset the use button icons state because useHighlightButtons // make it always true. ButtonFactory.useButtonIcons(useButtonIcons); installdata.buttonsHColor = new Color(255, 255, 255); Class lafClass = Class .forName("com.incors.plaf.kunststoff.KunststoffLookAndFeel"); Class mtheme = Class.forName("javax.swing.plaf.metal.MetalTheme"); Class[] params = { mtheme}; Class theme = Class.forName("com.izforge.izpack.gui.IzPackKMetalTheme"); Method setCurrentThemeMethod = lafClass.getMethod("setCurrentTheme", params); // We invoke and place Kunststoff as our L&F LookAndFeel kunststoff = (LookAndFeel) lafClass.newInstance(); MetalTheme ktheme = (MetalTheme) theme.newInstance(); Object[] kparams = { ktheme}; UIManager.setLookAndFeel(kunststoff); setCurrentThemeMethod.invoke(kunststoff, kparams); lnf = "kunststoff"; return; } // Liquid (http://liquidlnf.sourceforge.net/) if (laf.equals("liquid")) { UIManager.setLookAndFeel("com.birosoft.liquid.LiquidLookAndFeel"); lnf = "liquid"; Map params = (Map)installdata.guiPrefs.lookAndFeelParams.get(laf); if (params.containsKey("decorate.frames")) { String value = (String)params.get("decorate.frames"); if (value.equals("yes")) { JFrame.setDefaultLookAndFeelDecorated(true); } } if (params.containsKey("decorate.dialogs")) { String value = (String)params.get("decorate.dialogs"); if (value.equals("yes")) { JDialog.setDefaultLookAndFeelDecorated(true); } } return; } // Metouia (http://mlf.sourceforge.net/) if (laf.equals("metouia")) { UIManager.setLookAndFeel("net.sourceforge.mlf.metouia.MetouiaLookAndFeel"); lnf = "metouia"; return; } // JGoodies Looks (http://looks.dev.java.net/) if (laf.equals("looks")) { Map variants = new TreeMap(); variants.put("extwin", "com.jgoodies.plaf.windows.ExtWindowsLookAndFeel "); variants.put("plastic", "com.jgoodies.plaf.plastic.PlasticLookAndFeel"); variants.put("plastic3D", "com.jgoodies.plaf.plastic.Plastic3DLookAndFeel"); variants.put("plasticXP", "com.jgoodies.plaf.plastic.PlasticXPLookAndFeel"); String variant = (String)variants.get("plasticXP"); Map params = (Map)installdata.guiPrefs.lookAndFeelParams.get(laf); if (params.containsKey("variant")) { String param = (String)params.get("variant"); if (variants.containsKey(param)) { variant = (String)variants.get(param); } } UIManager.setLookAndFeel(variant); } } | 54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/d2cee8f5165671d318a97cc2eed7768c8b3c691c/GUIInstaller.java/buggy/src/lib/com/izforge/izpack/installer/GUIInstaller.java |
||
protected void loadLookAndFeel() throws Exception { // Do we have any preference for this OS ? String sysos = System.getProperty("os.name"); String syskey = "unix"; if (sysos.regionMatches(true, 0, "windows", 0, 7)) { syskey = "windows"; } else if (sysos.regionMatches(true, 0, "mac", 0, 3)) { syskey = "mac"; } String laf = null; if (installdata.guiPrefs.lookAndFeelMapping.containsKey(syskey)) { laf = (String) installdata.guiPrefs.lookAndFeelMapping.get(syskey); } // Let's use the system LAF // Resolve whether button icons should be used or not. boolean useButtonIcons = true; if(installdata.guiPrefs.modifier.containsKey("useButtonIcons") && ((String)installdata.guiPrefs.modifier. get("useButtonIcons")).equalsIgnoreCase("no") ) useButtonIcons = false; ButtonFactory.useButtonIcons(useButtonIcons); boolean useLabelIcons = true; if(installdata.guiPrefs.modifier.containsKey("useLabelIcons") && ((String)installdata.guiPrefs.modifier. get("useLabelIcons")).equalsIgnoreCase("no") ) useLabelIcons = false; LabelFactory.setUseLabelIcons(useLabelIcons); if (laf == null) { if (!syskey.equals("mac")) { String syslaf = UIManager.getSystemLookAndFeelClassName(); UIManager.setLookAndFeel(syslaf); if (UIManager.getLookAndFeel() instanceof MetalLookAndFeel) { MetalLookAndFeel.setCurrentTheme(new IzPackMetalTheme()); ButtonFactory.useHighlightButtons(); // Reset the use button icons state because useHighlightButtons // make it always true. ButtonFactory.useButtonIcons(useButtonIcons); installdata.buttonsHColor = new Color(182, 182, 204); } } lnf = "swing"; return; } // Kunststoff (http://www.incors.org/) if (laf.equals("kunststoff")) { ButtonFactory.useHighlightButtons(); // Reset the use button icons state because useHighlightButtons // make it always true. ButtonFactory.useButtonIcons(useButtonIcons); installdata.buttonsHColor = new Color(255, 255, 255); Class lafClass = Class .forName("com.incors.plaf.kunststoff.KunststoffLookAndFeel"); Class mtheme = Class.forName("javax.swing.plaf.metal.MetalTheme"); Class[] params = { mtheme}; Class theme = Class.forName("com.izforge.izpack.gui.IzPackKMetalTheme"); Method setCurrentThemeMethod = lafClass.getMethod("setCurrentTheme", params); // We invoke and place Kunststoff as our L&F LookAndFeel kunststoff = (LookAndFeel) lafClass.newInstance(); MetalTheme ktheme = (MetalTheme) theme.newInstance(); Object[] kparams = { ktheme}; UIManager.setLookAndFeel(kunststoff); setCurrentThemeMethod.invoke(kunststoff, kparams); lnf = "kunststoff"; return; } // Liquid (http://liquidlnf.sourceforge.net/) if (laf.equals("liquid")) { UIManager.setLookAndFeel("com.birosoft.liquid.LiquidLookAndFeel"); lnf = "liquid"; Map params = (Map)installdata.guiPrefs.lookAndFeelParams.get(laf); if (params.containsKey("decorate.frames")) { String value = (String)params.get("decorate.frames"); if (value.equals("yes")) { JFrame.setDefaultLookAndFeelDecorated(true); } } if (params.containsKey("decorate.dialogs")) { String value = (String)params.get("decorate.dialogs"); if (value.equals("yes")) { JDialog.setDefaultLookAndFeelDecorated(true); } } return; } // Metouia (http://mlf.sourceforge.net/) if (laf.equals("metouia")) { UIManager.setLookAndFeel("net.sourceforge.mlf.metouia.MetouiaLookAndFeel"); lnf = "metouia"; return; } // JGoodies Looks (http://looks.dev.java.net/) if (laf.equals("looks")) { Map variants = new TreeMap(); variants.put("extwin", "com.jgoodies.plaf.windows.ExtWindowsLookAndFeel "); variants.put("plastic", "com.jgoodies.plaf.plastic.PlasticLookAndFeel"); variants.put("plastic3D", "com.jgoodies.plaf.plastic.Plastic3DLookAndFeel"); variants.put("plasticXP", "com.jgoodies.plaf.plastic.PlasticXPLookAndFeel"); String variant = (String)variants.get("plasticXP"); Map params = (Map)installdata.guiPrefs.lookAndFeelParams.get(laf); if (params.containsKey("variant")) { String param = (String)params.get("variant"); if (variants.containsKey(param)) { variant = (String)variants.get(param); } } UIManager.setLookAndFeel(variant); } } | 54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/d2cee8f5165671d318a97cc2eed7768c8b3c691c/GUIInstaller.java/buggy/src/lib/com/izforge/izpack/installer/GUIInstaller.java |
||
centerPanel.add(LabelFactory.create(parent.langpack.getString("FinishPanel.fail"), | add(LabelFactory.create(parent.langpack.getString("FinishPanel.fail"), | public void panelActivate() { parent.lockNextButton(); parent.lockPrevButton(); parent.setQuitButtonText(parent.langpack.getString("FinishPanel.done")); parent.setQuitButtonIcon("done"); if (idata.installSuccess) { // We set the information add(LabelFactory.create(parent.icons.getImageIcon("check"))); add(IzPanelLayout.createParagraphGap()); add(LabelFactory.create(parent.langpack.getString("FinishPanel.success"), parent.icons.getImageIcon("information"), LEADING), NEXT_LINE); add(IzPanelLayout.createParagraphGap()); if (idata.uninstallOutJar != null) { // We prepare a message for the uninstaller feature String path = translatePath("$INSTALL_PATH") + File.separator + "Uninstaller"; add(LabelFactory.create(parent.langpack .getString("FinishPanel.uninst.info"), parent.icons .getImageIcon("information"), LEADING), NEXT_LINE); add(LabelFactory.create(path, parent.icons.getImageIcon("empty"), LEADING), NEXT_LINE); } } else centerPanel.add(LabelFactory.create(parent.langpack.getString("FinishPanel.fail"), parent.icons.getImageIcon("information"), LEADING)); getLayoutHelper().completeLayout(); // Call, or call not? } | 54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/70962d5e45783a05271609095130a61620295d86/SimpleFinishPanel.java/clean/src/lib/com/izforge/izpack/panels/SimpleFinishPanel.java |
public int executeFiles() | public int executeFiles(int currentStage) | public int executeFiles() { int exitStatus = 0; String[] output = new String[2]; String pathSep = System.getProperty("path.separator"); String osName = System.getProperty("os.name").toLowerCase(); String permissions = (System.getProperty("user.name").equals("root")) ? "a+x" : "u+x"; // loop through all executables Iterator efileIterator = files.iterator(); while ((exitStatus == 0) && efileIterator.hasNext()) { boolean deleteAfterwards = true; ExecutableFile efile = (ExecutableFile) efileIterator.next(); File file = new File(efile.path); Debug.trace("handeling executable file "+efile); // fix executable permission for unix systems if (pathSep.equals(":") && (!osName.startsWith("mac") || osName.endsWith("x"))) { Debug.trace("making file executable (setting executable flag)"); String[] params = {"/bin/chmod", permissions, file.toString()}; exitStatus = executeCommand(params, output); } // loop through all operating systems Iterator osIterator = efile.osList.iterator(); if (!osIterator.hasNext()) { Debug.trace("no os to install the file on!"); } while (osIterator.hasNext()) { Os os = (Os) osIterator.next(); Debug.trace("checking if os param on file "+os+" equals current os"); if (os.matchCurrentSystem()) { Debug.trace("match current os"); // execute command in POSTINSTALL stage if ((exitStatus == 0) && (efile.executionStage == ExecutableFile.POSTINSTALL)) { List paramList = new ArrayList(); if (ExecutableFile.BIN == efile.type) paramList.add(file.toString()); else if (ExecutableFile.JAR == efile.type && null == efile.mainClass) { paramList.add(System.getProperty("java.home") + "/bin/java"); paramList.add("-jar"); paramList.add(file.toString()); } else if (ExecutableFile.JAR == efile.type && null != efile.mainClass) { paramList.add(System.getProperty("java.home") + "/bin/java"); paramList.add("-cp=" + file.toString()); paramList.add(efile.mainClass); } if (null != efile.argList && !efile.argList.isEmpty()) paramList.addAll(efile.argList); String[] params = new String[paramList.size()]; for (int i = 0; i < paramList.size(); i++) params[i] = (String) paramList.get(i); exitStatus = executeCommand(params, output); // bring a dialog depending on return code and failure handling if (exitStatus != 0) { deleteAfterwards = false; String message = output[0] + "\n" + output[1]; if (message.length() == 1) message = new String("Failed to execute " + file.toString() + "."); if (efile.onFailure == ExecutableFile.ABORT) javax.swing.JOptionPane.showMessageDialog(null, message, "Installation error", javax.swing.JOptionPane.ERROR_MESSAGE); else if (efile.onFailure == ExecutableFile.WARN) { javax.swing.JOptionPane.showMessageDialog(null, message, "Installation warning", javax.swing.JOptionPane.WARNING_MESSAGE); exitStatus = 0; } else if ( javax.swing.JOptionPane.showConfirmDialog(null, message + "Would you like to proceed?", "Installation Warning", javax.swing.JOptionPane.YES_NO_OPTION) == javax.swing.JOptionPane.YES_OPTION) exitStatus = 0; } } } else { Debug.trace("-no match with current os!"); } } // POSTINSTALL executables will be deleted if (efile.executionStage == ExecutableFile.POSTINSTALL && deleteAfterwards) { if (file.canWrite()) file.delete(); } } return exitStatus; } | 54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/85d99afd9a4052ba0a6796445a7aa6be8c4054c9/FileExecutor.java/buggy/src/lib/com/izforge/izpack/util/FileExecutor.java |
if (pathSep.equals(":") && (!osName.startsWith("mac") || osName.endsWith("x"))) | if(currentStage!=ExecutableFile.UNINSTALL) | public int executeFiles() { int exitStatus = 0; String[] output = new String[2]; String pathSep = System.getProperty("path.separator"); String osName = System.getProperty("os.name").toLowerCase(); String permissions = (System.getProperty("user.name").equals("root")) ? "a+x" : "u+x"; // loop through all executables Iterator efileIterator = files.iterator(); while ((exitStatus == 0) && efileIterator.hasNext()) { boolean deleteAfterwards = true; ExecutableFile efile = (ExecutableFile) efileIterator.next(); File file = new File(efile.path); Debug.trace("handeling executable file "+efile); // fix executable permission for unix systems if (pathSep.equals(":") && (!osName.startsWith("mac") || osName.endsWith("x"))) { Debug.trace("making file executable (setting executable flag)"); String[] params = {"/bin/chmod", permissions, file.toString()}; exitStatus = executeCommand(params, output); } // loop through all operating systems Iterator osIterator = efile.osList.iterator(); if (!osIterator.hasNext()) { Debug.trace("no os to install the file on!"); } while (osIterator.hasNext()) { Os os = (Os) osIterator.next(); Debug.trace("checking if os param on file "+os+" equals current os"); if (os.matchCurrentSystem()) { Debug.trace("match current os"); // execute command in POSTINSTALL stage if ((exitStatus == 0) && (efile.executionStage == ExecutableFile.POSTINSTALL)) { List paramList = new ArrayList(); if (ExecutableFile.BIN == efile.type) paramList.add(file.toString()); else if (ExecutableFile.JAR == efile.type && null == efile.mainClass) { paramList.add(System.getProperty("java.home") + "/bin/java"); paramList.add("-jar"); paramList.add(file.toString()); } else if (ExecutableFile.JAR == efile.type && null != efile.mainClass) { paramList.add(System.getProperty("java.home") + "/bin/java"); paramList.add("-cp=" + file.toString()); paramList.add(efile.mainClass); } if (null != efile.argList && !efile.argList.isEmpty()) paramList.addAll(efile.argList); String[] params = new String[paramList.size()]; for (int i = 0; i < paramList.size(); i++) params[i] = (String) paramList.get(i); exitStatus = executeCommand(params, output); // bring a dialog depending on return code and failure handling if (exitStatus != 0) { deleteAfterwards = false; String message = output[0] + "\n" + output[1]; if (message.length() == 1) message = new String("Failed to execute " + file.toString() + "."); if (efile.onFailure == ExecutableFile.ABORT) javax.swing.JOptionPane.showMessageDialog(null, message, "Installation error", javax.swing.JOptionPane.ERROR_MESSAGE); else if (efile.onFailure == ExecutableFile.WARN) { javax.swing.JOptionPane.showMessageDialog(null, message, "Installation warning", javax.swing.JOptionPane.WARNING_MESSAGE); exitStatus = 0; } else if ( javax.swing.JOptionPane.showConfirmDialog(null, message + "Would you like to proceed?", "Installation Warning", javax.swing.JOptionPane.YES_NO_OPTION) == javax.swing.JOptionPane.YES_OPTION) exitStatus = 0; } } } else { Debug.trace("-no match with current os!"); } } // POSTINSTALL executables will be deleted if (efile.executionStage == ExecutableFile.POSTINSTALL && deleteAfterwards) { if (file.canWrite()) file.delete(); } } return exitStatus; } | 54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/85d99afd9a4052ba0a6796445a7aa6be8c4054c9/FileExecutor.java/buggy/src/lib/com/izforge/izpack/util/FileExecutor.java |
Debug.trace("making file executable (setting executable flag)"); String[] params = {"/bin/chmod", permissions, file.toString()}; exitStatus = executeCommand(params, output); | if (pathSep.equals(":") && (!osName.startsWith("mac") || osName.endsWith("x"))) { Debug.trace("making file executable (setting executable flag)"); String[] params = {"/bin/chmod", permissions, file.toString()}; exitStatus = executeCommand(params, output); } | public int executeFiles() { int exitStatus = 0; String[] output = new String[2]; String pathSep = System.getProperty("path.separator"); String osName = System.getProperty("os.name").toLowerCase(); String permissions = (System.getProperty("user.name").equals("root")) ? "a+x" : "u+x"; // loop through all executables Iterator efileIterator = files.iterator(); while ((exitStatus == 0) && efileIterator.hasNext()) { boolean deleteAfterwards = true; ExecutableFile efile = (ExecutableFile) efileIterator.next(); File file = new File(efile.path); Debug.trace("handeling executable file "+efile); // fix executable permission for unix systems if (pathSep.equals(":") && (!osName.startsWith("mac") || osName.endsWith("x"))) { Debug.trace("making file executable (setting executable flag)"); String[] params = {"/bin/chmod", permissions, file.toString()}; exitStatus = executeCommand(params, output); } // loop through all operating systems Iterator osIterator = efile.osList.iterator(); if (!osIterator.hasNext()) { Debug.trace("no os to install the file on!"); } while (osIterator.hasNext()) { Os os = (Os) osIterator.next(); Debug.trace("checking if os param on file "+os+" equals current os"); if (os.matchCurrentSystem()) { Debug.trace("match current os"); // execute command in POSTINSTALL stage if ((exitStatus == 0) && (efile.executionStage == ExecutableFile.POSTINSTALL)) { List paramList = new ArrayList(); if (ExecutableFile.BIN == efile.type) paramList.add(file.toString()); else if (ExecutableFile.JAR == efile.type && null == efile.mainClass) { paramList.add(System.getProperty("java.home") + "/bin/java"); paramList.add("-jar"); paramList.add(file.toString()); } else if (ExecutableFile.JAR == efile.type && null != efile.mainClass) { paramList.add(System.getProperty("java.home") + "/bin/java"); paramList.add("-cp=" + file.toString()); paramList.add(efile.mainClass); } if (null != efile.argList && !efile.argList.isEmpty()) paramList.addAll(efile.argList); String[] params = new String[paramList.size()]; for (int i = 0; i < paramList.size(); i++) params[i] = (String) paramList.get(i); exitStatus = executeCommand(params, output); // bring a dialog depending on return code and failure handling if (exitStatus != 0) { deleteAfterwards = false; String message = output[0] + "\n" + output[1]; if (message.length() == 1) message = new String("Failed to execute " + file.toString() + "."); if (efile.onFailure == ExecutableFile.ABORT) javax.swing.JOptionPane.showMessageDialog(null, message, "Installation error", javax.swing.JOptionPane.ERROR_MESSAGE); else if (efile.onFailure == ExecutableFile.WARN) { javax.swing.JOptionPane.showMessageDialog(null, message, "Installation warning", javax.swing.JOptionPane.WARNING_MESSAGE); exitStatus = 0; } else if ( javax.swing.JOptionPane.showConfirmDialog(null, message + "Would you like to proceed?", "Installation Warning", javax.swing.JOptionPane.YES_NO_OPTION) == javax.swing.JOptionPane.YES_OPTION) exitStatus = 0; } } } else { Debug.trace("-no match with current os!"); } } // POSTINSTALL executables will be deleted if (efile.executionStage == ExecutableFile.POSTINSTALL && deleteAfterwards) { if (file.canWrite()) file.delete(); } } return exitStatus; } | 54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/85d99afd9a4052ba0a6796445a7aa6be8c4054c9/FileExecutor.java/buggy/src/lib/com/izforge/izpack/util/FileExecutor.java |
if ((exitStatus == 0) && (efile.executionStage == ExecutableFile.POSTINSTALL)) | if ((exitStatus == 0) && ((currentStage == ExecutableFile.POSTINSTALL && efile.executionStage == ExecutableFile.POSTINSTALL) || (currentStage==ExecutableFile.UNINSTALL && efile.executionStage == ExecutableFile.UNINSTALL))) | public int executeFiles() { int exitStatus = 0; String[] output = new String[2]; String pathSep = System.getProperty("path.separator"); String osName = System.getProperty("os.name").toLowerCase(); String permissions = (System.getProperty("user.name").equals("root")) ? "a+x" : "u+x"; // loop through all executables Iterator efileIterator = files.iterator(); while ((exitStatus == 0) && efileIterator.hasNext()) { boolean deleteAfterwards = true; ExecutableFile efile = (ExecutableFile) efileIterator.next(); File file = new File(efile.path); Debug.trace("handeling executable file "+efile); // fix executable permission for unix systems if (pathSep.equals(":") && (!osName.startsWith("mac") || osName.endsWith("x"))) { Debug.trace("making file executable (setting executable flag)"); String[] params = {"/bin/chmod", permissions, file.toString()}; exitStatus = executeCommand(params, output); } // loop through all operating systems Iterator osIterator = efile.osList.iterator(); if (!osIterator.hasNext()) { Debug.trace("no os to install the file on!"); } while (osIterator.hasNext()) { Os os = (Os) osIterator.next(); Debug.trace("checking if os param on file "+os+" equals current os"); if (os.matchCurrentSystem()) { Debug.trace("match current os"); // execute command in POSTINSTALL stage if ((exitStatus == 0) && (efile.executionStage == ExecutableFile.POSTINSTALL)) { List paramList = new ArrayList(); if (ExecutableFile.BIN == efile.type) paramList.add(file.toString()); else if (ExecutableFile.JAR == efile.type && null == efile.mainClass) { paramList.add(System.getProperty("java.home") + "/bin/java"); paramList.add("-jar"); paramList.add(file.toString()); } else if (ExecutableFile.JAR == efile.type && null != efile.mainClass) { paramList.add(System.getProperty("java.home") + "/bin/java"); paramList.add("-cp=" + file.toString()); paramList.add(efile.mainClass); } if (null != efile.argList && !efile.argList.isEmpty()) paramList.addAll(efile.argList); String[] params = new String[paramList.size()]; for (int i = 0; i < paramList.size(); i++) params[i] = (String) paramList.get(i); exitStatus = executeCommand(params, output); // bring a dialog depending on return code and failure handling if (exitStatus != 0) { deleteAfterwards = false; String message = output[0] + "\n" + output[1]; if (message.length() == 1) message = new String("Failed to execute " + file.toString() + "."); if (efile.onFailure == ExecutableFile.ABORT) javax.swing.JOptionPane.showMessageDialog(null, message, "Installation error", javax.swing.JOptionPane.ERROR_MESSAGE); else if (efile.onFailure == ExecutableFile.WARN) { javax.swing.JOptionPane.showMessageDialog(null, message, "Installation warning", javax.swing.JOptionPane.WARNING_MESSAGE); exitStatus = 0; } else if ( javax.swing.JOptionPane.showConfirmDialog(null, message + "Would you like to proceed?", "Installation Warning", javax.swing.JOptionPane.YES_NO_OPTION) == javax.swing.JOptionPane.YES_OPTION) exitStatus = 0; } } } else { Debug.trace("-no match with current os!"); } } // POSTINSTALL executables will be deleted if (efile.executionStage == ExecutableFile.POSTINSTALL && deleteAfterwards) { if (file.canWrite()) file.delete(); } } return exitStatus; } | 54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/85d99afd9a4052ba0a6796445a7aa6be8c4054c9/FileExecutor.java/buggy/src/lib/com/izforge/izpack/util/FileExecutor.java |
public int executeFiles() { int exitStatus = 0; String[] output = new String[2]; String pathSep = System.getProperty("path.separator"); String osName = System.getProperty("os.name").toLowerCase(); String permissions = (System.getProperty("user.name").equals("root")) ? "a+x" : "u+x"; // loop through all executables Iterator efileIterator = files.iterator(); while ((exitStatus == 0) && efileIterator.hasNext()) { boolean deleteAfterwards = true; ExecutableFile efile = (ExecutableFile) efileIterator.next(); File file = new File(efile.path); Debug.trace("handeling executable file "+efile); // fix executable permission for unix systems if (pathSep.equals(":") && (!osName.startsWith("mac") || osName.endsWith("x"))) { Debug.trace("making file executable (setting executable flag)"); String[] params = {"/bin/chmod", permissions, file.toString()}; exitStatus = executeCommand(params, output); } // loop through all operating systems Iterator osIterator = efile.osList.iterator(); if (!osIterator.hasNext()) { Debug.trace("no os to install the file on!"); } while (osIterator.hasNext()) { Os os = (Os) osIterator.next(); Debug.trace("checking if os param on file "+os+" equals current os"); if (os.matchCurrentSystem()) { Debug.trace("match current os"); // execute command in POSTINSTALL stage if ((exitStatus == 0) && (efile.executionStage == ExecutableFile.POSTINSTALL)) { List paramList = new ArrayList(); if (ExecutableFile.BIN == efile.type) paramList.add(file.toString()); else if (ExecutableFile.JAR == efile.type && null == efile.mainClass) { paramList.add(System.getProperty("java.home") + "/bin/java"); paramList.add("-jar"); paramList.add(file.toString()); } else if (ExecutableFile.JAR == efile.type && null != efile.mainClass) { paramList.add(System.getProperty("java.home") + "/bin/java"); paramList.add("-cp=" + file.toString()); paramList.add(efile.mainClass); } if (null != efile.argList && !efile.argList.isEmpty()) paramList.addAll(efile.argList); String[] params = new String[paramList.size()]; for (int i = 0; i < paramList.size(); i++) params[i] = (String) paramList.get(i); exitStatus = executeCommand(params, output); // bring a dialog depending on return code and failure handling if (exitStatus != 0) { deleteAfterwards = false; String message = output[0] + "\n" + output[1]; if (message.length() == 1) message = new String("Failed to execute " + file.toString() + "."); if (efile.onFailure == ExecutableFile.ABORT) javax.swing.JOptionPane.showMessageDialog(null, message, "Installation error", javax.swing.JOptionPane.ERROR_MESSAGE); else if (efile.onFailure == ExecutableFile.WARN) { javax.swing.JOptionPane.showMessageDialog(null, message, "Installation warning", javax.swing.JOptionPane.WARNING_MESSAGE); exitStatus = 0; } else if ( javax.swing.JOptionPane.showConfirmDialog(null, message + "Would you like to proceed?", "Installation Warning", javax.swing.JOptionPane.YES_NO_OPTION) == javax.swing.JOptionPane.YES_OPTION) exitStatus = 0; } } } else { Debug.trace("-no match with current os!"); } } // POSTINSTALL executables will be deleted if (efile.executionStage == ExecutableFile.POSTINSTALL && deleteAfterwards) { if (file.canWrite()) file.delete(); } } return exitStatus; } | 54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/85d99afd9a4052ba0a6796445a7aa6be8c4054c9/FileExecutor.java/buggy/src/lib/com/izforge/izpack/util/FileExecutor.java |
||
public Pack(String name, String description, List osConstraints, boolean required, boolean preselected) | public Pack( String name, String description, List osConstraints, boolean required, boolean preselected) | public Pack(String name, String description, List osConstraints, boolean required, boolean preselected) { this.name = name; this.description = description; this.osConstraints = osConstraints; this.required = required; this.preselected = preselected; nbytes = 0; } | 54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/6e8ab3930a21f787bcd0f3cf0b9937f9d50c80c0/Pack.java/clean/src/lib/com/izforge/izpack/Pack.java |
} else if (bytes < (GIGABYTES)) | } else if (bytes < (GIGABYTES)) | public static String toByteUnitsString(int bytes) { if (bytes < KILOBYTES) return String.valueOf(bytes) + " bytes"; else if (bytes < (MEGABYTES)) { double value = bytes / KILOBYTES; return formatter.format(value) + " KB"; } else if (bytes < (GIGABYTES)) { double value = bytes / MEGABYTES; return formatter.format(value) + " MB"; } else { double value = bytes / GIGABYTES; return formatter.format(value) + " GB"; } } | 54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/6e8ab3930a21f787bcd0f3cf0b9937f9d50c80c0/Pack.java/clean/src/lib/com/izforge/izpack/Pack.java |
} else | } else | public static String toByteUnitsString(int bytes) { if (bytes < KILOBYTES) return String.valueOf(bytes) + " bytes"; else if (bytes < (MEGABYTES)) { double value = bytes / KILOBYTES; return formatter.format(value) + " KB"; } else if (bytes < (GIGABYTES)) { double value = bytes / MEGABYTES; return formatter.format(value) + " MB"; } else { double value = bytes / GIGABYTES; return formatter.format(value) + " GB"; } } | 54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/6e8ab3930a21f787bcd0f3cf0b9937f9d50c80c0/Pack.java/clean/src/lib/com/izforge/izpack/Pack.java |
if(System.currentTimeMillis() - pair.tstamp > _minEvictableIdleTimeMillis) { try { cursor.remove(); _factory.destroyObject(pair.value); } catch(Exception e) { ; } | if(_minEvictableIdleTimeMillis > 0 && System.currentTimeMillis() - pair.tstamp > _minEvictableIdleTimeMillis) { try { cursor.remove(); _factory.destroyObject(pair.value); } catch(Exception e) { ; } | public void run() { CursorableLinkedList.Cursor cursor = null; while(!_cancelled) { long sleeptime = 0L; synchronized(GenericObjectPool.this) { sleeptime = _timeBetweenEvictionRunsMillis; } try { Thread.currentThread().sleep(_timeBetweenEvictionRunsMillis); } catch(Exception e) { ; // ignored } try { synchronized(GenericObjectPool.this) { if(!_pool.isEmpty()) { if(null == cursor) { cursor = (CursorableLinkedList.Cursor)(_pool.cursor(_pool.size())); } else if(!cursor.hasPrevious()) { cursor.close(); cursor = (CursorableLinkedList.Cursor)(_pool.cursor(_pool.size())); } for(int i=0,m=getNumTests();i<m;i++) { if(!cursor.hasPrevious()) { cursor.close(); cursor = (CursorableLinkedList.Cursor)(_pool.cursor(_pool.size())); } else { ObjectTimestampPair pair = (ObjectTimestampPair)(cursor.previous()); if(System.currentTimeMillis() - pair.tstamp > _minEvictableIdleTimeMillis) { try { cursor.remove(); _factory.destroyObject(pair.value); } catch(Exception e) { ; // ignored } } else if(_testWhileIdle) { boolean active = false; try { _factory.activateObject(pair.value); active = true; } catch(Exception e) { cursor.remove(); try { _factory.passivateObject(pair.value); } catch(Exception ex) { ; // ignored } _factory.destroyObject(pair.value); } if(active) { if(!_factory.validateObject(pair.value)) { cursor.remove(); try { _factory.passivateObject(pair.value); } catch(Exception ex) { ; // ignored } _factory.destroyObject(pair.value); } else { try { _factory.passivateObject(pair.value); } catch(Exception e) { cursor.remove(); _factory.destroyObject(pair.value); } } } } } } } } } catch(Exception e) { // ignored } } if(null != cursor) { cursor.close(); } } | 50977 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50977/efc6cc449e39844e28ad04b1b4d5b8ed261445fa/GenericObjectPool.java/buggy/src/java/org/apache/commons/pool/impl/GenericObjectPool.java |
pixelsID); | pixs.getPixelsDimensions().getId().longValue()); | PixelsDimensions getPixelsDimensions(long pixelsID) throws DSOutOfServiceException, DSAccessException { try { IQuery query = getIQueryService(); Pixels pixs = (Pixels) query.get(Pixels.class, pixelsID); return (PixelsDimensions) query.get(PixelsDimensions.class, pixelsID); } catch (Exception e) { handleException(e, "Cannot retrieve the dimension of "+ "the pixels set."); } return null; } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/0af61836ca32086c893ee2b504beaa9d90e1627b/OMEROGateway.java/buggy/SRC/org/openmicroscopy/shoola/env/data/OMEROGateway.java |
entry = new ServiceFactory(); | entry = new ServiceFactory(new Login(userName, "ome")); | ExperimenterData login(String userName, String password) throws DSOutOfServiceException { System.getProperties().setProperty("omero.user", userName); //TODO: Remove it asap System.getProperties().setProperty("omero.pass", "ome"); //System.getProperties().setProperty("omero.pass", password); try { entry = new ServiceFactory(); connected = true; return getUserDetails(userName); } catch (Exception e) { connected = false; String s = "Can't connect to OMERO. OMERO info not valid."; e.printStackTrace(); throw new DSOutOfServiceException(s, e); } } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/0af61836ca32086c893ee2b504beaa9d90e1627b/OMEROGateway.java/buggy/SRC/org/openmicroscopy/shoola/env/data/OMEROGateway.java |
} catch (Exception err) | } catch (Exception err) | public void actionPerformed(ActionEvent e) { // Prepares the file chooser JFileChooser fc = new JFileChooser(); fc.setCurrentDirectory(new File(idata.getInstallPath())); fc.setMultiSelectionEnabled(false); fc.addChoosableFileFilter(fc.getAcceptAllFileFilter()); //fc.setCurrentDirectory(new File(".")); // Shows it try { if (fc.showSaveDialog(this) == JFileChooser.APPROVE_OPTION) { // We handle the xml data writing File file = fc.getSelectedFile(); FileOutputStream out = new FileOutputStream(file); BufferedOutputStream outBuff = new BufferedOutputStream(out, 5120); parent.writeXMLTree(idata.xmlData, outBuff); outBuff.flush(); outBuff.close(); autoButton.setEnabled(false); } } catch (Exception err) { err.printStackTrace(); JOptionPane.showMessageDialog(this, err.toString(), parent.langpack.getString("installer.error"), JOptionPane.ERROR_MESSAGE); } } | 54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/6e8ab3930a21f787bcd0f3cf0b9937f9d50c80c0/FinishPanel.java/clean/src/lib/com/izforge/izpack/panels/FinishPanel.java |
JOptionPane.showMessageDialog(this, err.toString(), | JOptionPane.showMessageDialog( this, err.toString(), | public void actionPerformed(ActionEvent e) { // Prepares the file chooser JFileChooser fc = new JFileChooser(); fc.setCurrentDirectory(new File(idata.getInstallPath())); fc.setMultiSelectionEnabled(false); fc.addChoosableFileFilter(fc.getAcceptAllFileFilter()); //fc.setCurrentDirectory(new File(".")); // Shows it try { if (fc.showSaveDialog(this) == JFileChooser.APPROVE_OPTION) { // We handle the xml data writing File file = fc.getSelectedFile(); FileOutputStream out = new FileOutputStream(file); BufferedOutputStream outBuff = new BufferedOutputStream(out, 5120); parent.writeXMLTree(idata.xmlData, outBuff); outBuff.flush(); outBuff.close(); autoButton.setEnabled(false); } } catch (Exception err) { err.printStackTrace(); JOptionPane.showMessageDialog(this, err.toString(), parent.langpack.getString("installer.error"), JOptionPane.ERROR_MESSAGE); } } | 54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/6e8ab3930a21f787bcd0f3cf0b9937f9d50c80c0/FinishPanel.java/clean/src/lib/com/izforge/izpack/panels/FinishPanel.java |
centerPanel.add(new JLabel(parent.langpack.getString("FinishPanel.success"), parent.icons.getImageIcon("information"), JLabel.TRAILING)); | centerPanel.add( new JLabel( parent.langpack.getString("FinishPanel.success"), parent.icons.getImageIcon("information"), JLabel.TRAILING)); | public void panelActivate() { parent.lockNextButton(); parent.lockPrevButton(); if (idata.installSuccess) { // We set the information centerPanel.add(new JLabel(parent.langpack.getString("FinishPanel.success"), parent.icons.getImageIcon("information"), JLabel.TRAILING)); centerPanel.add(Box.createVerticalStrut(20)); if (idata.info.getWriteUninstaller()) { // We prepare a message for the uninstaller feature String path = translatePath("$INSTALL_PATH") + File.separator + "Uninstaller"; centerPanel.add(new JLabel(parent.langpack.getString("FinishPanel.uninst.info"), parent.icons.getImageIcon("information"), JLabel.TRAILING)); centerPanel.add(new JLabel(path, parent.icons.getImageIcon("empty"), JLabel.TRAILING)); } // We add the autoButton centerPanel.add(Box.createVerticalStrut(20)); autoButton = ButtonFactory.createButton(parent.langpack.getString("FinishPanel.auto"), parent.icons.getImageIcon("edit"), idata.buttonsHColor); autoButton.setToolTipText(parent.langpack.getString("FinishPanel.auto.tip")); autoButton.addActionListener(this); centerPanel.add(autoButton); } else centerPanel.add(new JLabel(parent.langpack.getString("FinishPanel.fail"), parent.icons.getImageIcon("information"), JLabel.TRAILING)); } | 54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/6e8ab3930a21f787bcd0f3cf0b9937f9d50c80c0/FinishPanel.java/clean/src/lib/com/izforge/izpack/panels/FinishPanel.java |
public void panelActivate() { parent.lockNextButton(); parent.lockPrevButton(); if (idata.installSuccess) { // We set the information centerPanel.add(new JLabel(parent.langpack.getString("FinishPanel.success"), parent.icons.getImageIcon("information"), JLabel.TRAILING)); centerPanel.add(Box.createVerticalStrut(20)); if (idata.info.getWriteUninstaller()) { // We prepare a message for the uninstaller feature String path = translatePath("$INSTALL_PATH") + File.separator + "Uninstaller"; centerPanel.add(new JLabel(parent.langpack.getString("FinishPanel.uninst.info"), parent.icons.getImageIcon("information"), JLabel.TRAILING)); centerPanel.add(new JLabel(path, parent.icons.getImageIcon("empty"), JLabel.TRAILING)); } // We add the autoButton centerPanel.add(Box.createVerticalStrut(20)); autoButton = ButtonFactory.createButton(parent.langpack.getString("FinishPanel.auto"), parent.icons.getImageIcon("edit"), idata.buttonsHColor); autoButton.setToolTipText(parent.langpack.getString("FinishPanel.auto.tip")); autoButton.addActionListener(this); centerPanel.add(autoButton); } else centerPanel.add(new JLabel(parent.langpack.getString("FinishPanel.fail"), parent.icons.getImageIcon("information"), JLabel.TRAILING)); } | 54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/6e8ab3930a21f787bcd0f3cf0b9937f9d50c80c0/FinishPanel.java/clean/src/lib/com/izforge/izpack/panels/FinishPanel.java |
||
String path = translatePath("$INSTALL_PATH") + File.separator + "Uninstaller"; | String path = translatePath("$INSTALL_PATH") + File.separator + "Uninstaller"; | public void panelActivate() { parent.lockNextButton(); parent.lockPrevButton(); if (idata.installSuccess) { // We set the information centerPanel.add(new JLabel(parent.langpack.getString("FinishPanel.success"), parent.icons.getImageIcon("information"), JLabel.TRAILING)); centerPanel.add(Box.createVerticalStrut(20)); if (idata.info.getWriteUninstaller()) { // We prepare a message for the uninstaller feature String path = translatePath("$INSTALL_PATH") + File.separator + "Uninstaller"; centerPanel.add(new JLabel(parent.langpack.getString("FinishPanel.uninst.info"), parent.icons.getImageIcon("information"), JLabel.TRAILING)); centerPanel.add(new JLabel(path, parent.icons.getImageIcon("empty"), JLabel.TRAILING)); } // We add the autoButton centerPanel.add(Box.createVerticalStrut(20)); autoButton = ButtonFactory.createButton(parent.langpack.getString("FinishPanel.auto"), parent.icons.getImageIcon("edit"), idata.buttonsHColor); autoButton.setToolTipText(parent.langpack.getString("FinishPanel.auto.tip")); autoButton.addActionListener(this); centerPanel.add(autoButton); } else centerPanel.add(new JLabel(parent.langpack.getString("FinishPanel.fail"), parent.icons.getImageIcon("information"), JLabel.TRAILING)); } | 54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/6e8ab3930a21f787bcd0f3cf0b9937f9d50c80c0/FinishPanel.java/clean/src/lib/com/izforge/izpack/panels/FinishPanel.java |
centerPanel.add(new JLabel(parent.langpack.getString("FinishPanel.uninst.info"), parent.icons.getImageIcon("information"), JLabel.TRAILING)); centerPanel.add(new JLabel(path, parent.icons.getImageIcon("empty"), JLabel.TRAILING)); | centerPanel.add( new JLabel( parent.langpack.getString("FinishPanel.uninst.info"), parent.icons.getImageIcon("information"), JLabel.TRAILING)); centerPanel.add( new JLabel( path, parent.icons.getImageIcon("empty"), JLabel.TRAILING)); | public void panelActivate() { parent.lockNextButton(); parent.lockPrevButton(); if (idata.installSuccess) { // We set the information centerPanel.add(new JLabel(parent.langpack.getString("FinishPanel.success"), parent.icons.getImageIcon("information"), JLabel.TRAILING)); centerPanel.add(Box.createVerticalStrut(20)); if (idata.info.getWriteUninstaller()) { // We prepare a message for the uninstaller feature String path = translatePath("$INSTALL_PATH") + File.separator + "Uninstaller"; centerPanel.add(new JLabel(parent.langpack.getString("FinishPanel.uninst.info"), parent.icons.getImageIcon("information"), JLabel.TRAILING)); centerPanel.add(new JLabel(path, parent.icons.getImageIcon("empty"), JLabel.TRAILING)); } // We add the autoButton centerPanel.add(Box.createVerticalStrut(20)); autoButton = ButtonFactory.createButton(parent.langpack.getString("FinishPanel.auto"), parent.icons.getImageIcon("edit"), idata.buttonsHColor); autoButton.setToolTipText(parent.langpack.getString("FinishPanel.auto.tip")); autoButton.addActionListener(this); centerPanel.add(autoButton); } else centerPanel.add(new JLabel(parent.langpack.getString("FinishPanel.fail"), parent.icons.getImageIcon("information"), JLabel.TRAILING)); } | 54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/6e8ab3930a21f787bcd0f3cf0b9937f9d50c80c0/FinishPanel.java/clean/src/lib/com/izforge/izpack/panels/FinishPanel.java |
autoButton = ButtonFactory.createButton(parent.langpack.getString("FinishPanel.auto"), parent.icons.getImageIcon("edit"), idata.buttonsHColor); autoButton.setToolTipText(parent.langpack.getString("FinishPanel.auto.tip")); | autoButton = ButtonFactory.createButton( parent.langpack.getString("FinishPanel.auto"), parent.icons.getImageIcon("edit"), idata.buttonsHColor); autoButton.setToolTipText( parent.langpack.getString("FinishPanel.auto.tip")); | public void panelActivate() { parent.lockNextButton(); parent.lockPrevButton(); if (idata.installSuccess) { // We set the information centerPanel.add(new JLabel(parent.langpack.getString("FinishPanel.success"), parent.icons.getImageIcon("information"), JLabel.TRAILING)); centerPanel.add(Box.createVerticalStrut(20)); if (idata.info.getWriteUninstaller()) { // We prepare a message for the uninstaller feature String path = translatePath("$INSTALL_PATH") + File.separator + "Uninstaller"; centerPanel.add(new JLabel(parent.langpack.getString("FinishPanel.uninst.info"), parent.icons.getImageIcon("information"), JLabel.TRAILING)); centerPanel.add(new JLabel(path, parent.icons.getImageIcon("empty"), JLabel.TRAILING)); } // We add the autoButton centerPanel.add(Box.createVerticalStrut(20)); autoButton = ButtonFactory.createButton(parent.langpack.getString("FinishPanel.auto"), parent.icons.getImageIcon("edit"), idata.buttonsHColor); autoButton.setToolTipText(parent.langpack.getString("FinishPanel.auto.tip")); autoButton.addActionListener(this); centerPanel.add(autoButton); } else centerPanel.add(new JLabel(parent.langpack.getString("FinishPanel.fail"), parent.icons.getImageIcon("information"), JLabel.TRAILING)); } | 54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/6e8ab3930a21f787bcd0f3cf0b9937f9d50c80c0/FinishPanel.java/clean/src/lib/com/izforge/izpack/panels/FinishPanel.java |
} else centerPanel.add(new JLabel(parent.langpack.getString("FinishPanel.fail"), parent.icons.getImageIcon("information"), JLabel.TRAILING)); | } else centerPanel.add( new JLabel( parent.langpack.getString("FinishPanel.fail"), parent.icons.getImageIcon("information"), JLabel.TRAILING)); | public void panelActivate() { parent.lockNextButton(); parent.lockPrevButton(); if (idata.installSuccess) { // We set the information centerPanel.add(new JLabel(parent.langpack.getString("FinishPanel.success"), parent.icons.getImageIcon("information"), JLabel.TRAILING)); centerPanel.add(Box.createVerticalStrut(20)); if (idata.info.getWriteUninstaller()) { // We prepare a message for the uninstaller feature String path = translatePath("$INSTALL_PATH") + File.separator + "Uninstaller"; centerPanel.add(new JLabel(parent.langpack.getString("FinishPanel.uninst.info"), parent.icons.getImageIcon("information"), JLabel.TRAILING)); centerPanel.add(new JLabel(path, parent.icons.getImageIcon("empty"), JLabel.TRAILING)); } // We add the autoButton centerPanel.add(Box.createVerticalStrut(20)); autoButton = ButtonFactory.createButton(parent.langpack.getString("FinishPanel.auto"), parent.icons.getImageIcon("edit"), idata.buttonsHColor); autoButton.setToolTipText(parent.langpack.getString("FinishPanel.auto.tip")); autoButton.addActionListener(this); centerPanel.add(autoButton); } else centerPanel.add(new JLabel(parent.langpack.getString("FinishPanel.fail"), parent.icons.getImageIcon("information"), JLabel.TRAILING)); } | 54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/6e8ab3930a21f787bcd0f3cf0b9937f9d50c80c0/FinishPanel.java/clean/src/lib/com/izforge/izpack/panels/FinishPanel.java |
filter = new UpdateFilter( sec, (LocalQuery) sf.getQueryService() ); | filter = new UpdateFilter( ); | protected void setUp() throws Exception { super.setUp(); sf = new MockServiceFactory(); ec = new ThreadLocalEventContext(); sec = new BasicSecuritySystem (sf,ec ); sf.mockAdmin = mock(IAdmin.class); sf.mockQuery = mock(LocalQuery.class); sf.mockTypes = mock(ITypes.class); filter = new UpdateFilter( sec, (LocalQuery) sf.getQueryService() ); rootLogin(); } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/1fa4aa1df076354d9e858cfea9c54d59ae47d22a/AbstractLoginMockTest.java/buggy/components/server/test/ome/server/utests/AbstractLoginMockTest.java |
public abstract void addLangPack(String iso3, InputStream input) throws Exception; | public abstract void addLangPack(String iso3, InputStream input) throws Exception; | public abstract void addLangPack(String iso3, InputStream input) throws Exception; | 54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/6e8ab3930a21f787bcd0f3cf0b9937f9d50c80c0/Packager.java/clean/src/lib/com/izforge/izpack/compiler/Packager.java |
public abstract void addNativeLibrary(String name, InputStream input) throws Exception; | public abstract void addNativeLibrary(String name, InputStream input) throws Exception; | public abstract void addNativeLibrary(String name, InputStream input) throws Exception; | 54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/6e8ab3930a21f787bcd0f3cf0b9937f9d50c80c0/Packager.java/clean/src/lib/com/izforge/izpack/compiler/Packager.java |
public abstract ZipOutputStream addPack(int packNumber, String name, List osConstraints, boolean required, String description, boolean preselected) throws Exception; | public abstract ZipOutputStream addPack( int packNumber, String name, List osConstraints, boolean required, String description, boolean preselected) throws Exception; | public abstract ZipOutputStream addPack(int packNumber, String name, List osConstraints, boolean required, String description, boolean preselected) throws Exception; | 54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/6e8ab3930a21f787bcd0f3cf0b9937f9d50c80c0/Packager.java/clean/src/lib/com/izforge/izpack/compiler/Packager.java |
throws Exception; | throws Exception; | public abstract void addPanelClass(String classFilename, InputStream input) throws Exception; | 54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/6e8ab3930a21f787bcd0f3cf0b9937f9d50c80c0/Packager.java/clean/src/lib/com/izforge/izpack/compiler/Packager.java |
public abstract void addResource(String resId, InputStream input) throws Exception; | public abstract void addResource(String resId, InputStream input) throws Exception; | public abstract void addResource(String resId, InputStream input) throws Exception; | 54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/6e8ab3930a21f787bcd0f3cf0b9937f9d50c80c0/Packager.java/clean/src/lib/com/izforge/izpack/compiler/Packager.java |
throws IOException | throws IOException | protected long copyStream(InputStream in, OutputStream out) throws IOException { byte[] buffer = new byte[5120]; long bytesCopied = 0; int bytesInBuffer; while ((bytesInBuffer = in.read(buffer)) != -1) { out.write(buffer, 0, bytesInBuffer); bytesCopied += bytesInBuffer; } return bytesCopied; } | 54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/6e8ab3930a21f787bcd0f3cf0b9937f9d50c80c0/Packager.java/clean/src/lib/com/izforge/izpack/compiler/Packager.java |
public void writeSkeletonInstaller (JarOutputStream out) throws Exception | public void writeSkeletonInstaller(JarOutputStream out) throws Exception | public void writeSkeletonInstaller (JarOutputStream out) throws Exception { InputStream is = getClass().getResourceAsStream("/lib/installer.jar"); ZipInputStream skeleton_is = null; if (is != null) { skeleton_is = new ZipInputStream (is); } if (skeleton_is == null) { skeleton_is = new ZipInputStream (new FileInputStream ( Compiler.IZPACK_HOME + "lib" + File.separator + "installer.jar")); } ZipEntry zentry; while ((zentry = skeleton_is.getNextEntry()) != null) { // Puts a new entry out.putNextEntry(new ZipEntry(zentry.getName())); // Copy the data copyStream(skeleton_is, out); out.closeEntry(); skeleton_is.closeEntry(); } } | 54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/6e8ab3930a21f787bcd0f3cf0b9937f9d50c80c0/Packager.java/clean/src/lib/com/izforge/izpack/compiler/Packager.java |
skeleton_is = new ZipInputStream (is); | skeleton_is = new ZipInputStream(is); | public void writeSkeletonInstaller (JarOutputStream out) throws Exception { InputStream is = getClass().getResourceAsStream("/lib/installer.jar"); ZipInputStream skeleton_is = null; if (is != null) { skeleton_is = new ZipInputStream (is); } if (skeleton_is == null) { skeleton_is = new ZipInputStream (new FileInputStream ( Compiler.IZPACK_HOME + "lib" + File.separator + "installer.jar")); } ZipEntry zentry; while ((zentry = skeleton_is.getNextEntry()) != null) { // Puts a new entry out.putNextEntry(new ZipEntry(zentry.getName())); // Copy the data copyStream(skeleton_is, out); out.closeEntry(); skeleton_is.closeEntry(); } } | 54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/6e8ab3930a21f787bcd0f3cf0b9937f9d50c80c0/Packager.java/clean/src/lib/com/izforge/izpack/compiler/Packager.java |
skeleton_is = new ZipInputStream (new FileInputStream ( Compiler.IZPACK_HOME + "lib" + File.separator + "installer.jar")); | skeleton_is = new ZipInputStream( new FileInputStream( Compiler.IZPACK_HOME + "lib" + File.separator + "installer.jar")); | public void writeSkeletonInstaller (JarOutputStream out) throws Exception { InputStream is = getClass().getResourceAsStream("/lib/installer.jar"); ZipInputStream skeleton_is = null; if (is != null) { skeleton_is = new ZipInputStream (is); } if (skeleton_is == null) { skeleton_is = new ZipInputStream (new FileInputStream ( Compiler.IZPACK_HOME + "lib" + File.separator + "installer.jar")); } ZipEntry zentry; while ((zentry = skeleton_is.getNextEntry()) != null) { // Puts a new entry out.putNextEntry(new ZipEntry(zentry.getName())); // Copy the data copyStream(skeleton_is, out); out.closeEntry(); skeleton_is.closeEntry(); } } | 54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/6e8ab3930a21f787bcd0f3cf0b9937f9d50c80c0/Packager.java/clean/src/lib/com/izforge/izpack/compiler/Packager.java |
public void writeSkeletonInstaller (JarOutputStream out) throws Exception { InputStream is = getClass().getResourceAsStream("/lib/installer.jar"); ZipInputStream skeleton_is = null; if (is != null) { skeleton_is = new ZipInputStream (is); } if (skeleton_is == null) { skeleton_is = new ZipInputStream (new FileInputStream ( Compiler.IZPACK_HOME + "lib" + File.separator + "installer.jar")); } ZipEntry zentry; while ((zentry = skeleton_is.getNextEntry()) != null) { // Puts a new entry out.putNextEntry(new ZipEntry(zentry.getName())); // Copy the data copyStream(skeleton_is, out); out.closeEntry(); skeleton_is.closeEntry(); } } | 54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/6e8ab3930a21f787bcd0f3cf0b9937f9d50c80c0/Packager.java/clean/src/lib/com/izforge/izpack/compiler/Packager.java |
||
public void writeSkeletonInstaller (JarOutputStream out) throws Exception { InputStream is = getClass().getResourceAsStream("/lib/installer.jar"); ZipInputStream skeleton_is = null; if (is != null) { skeleton_is = new ZipInputStream (is); } if (skeleton_is == null) { skeleton_is = new ZipInputStream (new FileInputStream ( Compiler.IZPACK_HOME + "lib" + File.separator + "installer.jar")); } ZipEntry zentry; while ((zentry = skeleton_is.getNextEntry()) != null) { // Puts a new entry out.putNextEntry(new ZipEntry(zentry.getName())); // Copy the data copyStream(skeleton_is, out); out.closeEntry(); skeleton_is.closeEntry(); } } | 54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/6e8ab3930a21f787bcd0f3cf0b9937f9d50c80c0/Packager.java/clean/src/lib/com/izforge/izpack/compiler/Packager.java |
||
public void writeSkeletonInstaller (JarOutputStream out) throws Exception { InputStream is = getClass().getResourceAsStream("/lib/installer.jar"); ZipInputStream skeleton_is = null; if (is != null) { skeleton_is = new ZipInputStream (is); } if (skeleton_is == null) { skeleton_is = new ZipInputStream (new FileInputStream ( Compiler.IZPACK_HOME + "lib" + File.separator + "installer.jar")); } ZipEntry zentry; while ((zentry = skeleton_is.getNextEntry()) != null) { // Puts a new entry out.putNextEntry(new ZipEntry(zentry.getName())); // Copy the data copyStream(skeleton_is, out); out.closeEntry(); skeleton_is.closeEntry(); } } | 54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/6e8ab3930a21f787bcd0f3cf0b9937f9d50c80c0/Packager.java/clean/src/lib/com/izforge/izpack/compiler/Packager.java |
||
if (pack.id == null || pack.id.equals("")){ | if (langpack == null || pack.id == null || pack.id.equals("")){ | public Object getValueAt(int rowIndex, int columnIndex) { Pack pack = (Pack) packs.get(rowIndex); switch (columnIndex) { case 0 : int val = 0; if (pack.required) { val = -1; } else { val = (packsToInstall.contains(pack) ? 1 : 0); } return new Integer(val); case 1 : if (pack.id == null || pack.id.equals("")){ return pack.name; }else{ return langpack.getString(pack.id); } case 2 : return Pack.toByteUnitsString((int) pack.nbytes); default : return null; } } | 54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/97af55405ebcecbed7b6ed9f6138e21b9b76ce0d/PacksPanel.java/clean/src/lib/com/izforge/izpack/panels/PacksPanel.java |
if (pack.id != null && !pack.id.equals("")) | if (langpack != null && pack.id != null && !pack.id.equals("")) | public void valueChanged(ListSelectionEvent e) { int i = packsTable.getSelectedRow(); if (i >= 0) { Pack pack = (Pack) idata.availablePacks.get(i); String desc = ""; if (pack.id != null && !pack.id.equals("")) { desc = langpack.getString(pack.id+".description"); } if (desc.equals("")) { desc = pack.description; } descriptionArea.setText(desc); } } | 54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/97af55405ebcecbed7b6ed9f6138e21b9b76ce0d/PacksPanel.java/clean/src/lib/com/izforge/izpack/panels/PacksPanel.java |
infoLabel = new JLabel(parent.langpack.getString("LicencePanel.info"), parent.icons.getImageIcon("history"), JLabel.TRAILING); | infoLabel = new JLabel( parent.langpack.getString("LicencePanel.info"), parent.icons.getImageIcon("history"), JLabel.TRAILING); | public HTMLLicencePanel(InstallerFrame parent, InstallData idata) { super(parent, idata); // We initialize our layout layout = new GridBagLayout(); gbConstraints = new GridBagConstraints(); setLayout(layout); // We load the licence loadLicence(); // We put our components infoLabel = new JLabel(parent.langpack.getString("LicencePanel.info"), parent.icons.getImageIcon("history"), JLabel.TRAILING); parent.buildConstraints(gbConstraints, 0, 0, 2, 1, 1.0, 0.0); gbConstraints.insets = new Insets(5, 5, 5, 5); gbConstraints.fill = GridBagConstraints.NONE; gbConstraints.anchor = GridBagConstraints.WEST; layout.addLayoutComponent(infoLabel, gbConstraints); add(infoLabel); try { textArea = new JEditorPane(); textArea.setEditable(false); textArea.addHyperlinkListener(this); JScrollPane scroller = new JScrollPane(textArea); textArea.setPage(loadLicence()); parent.buildConstraints(gbConstraints, 0, 1, 2, 1, 1.0, 1.0); gbConstraints.anchor = GridBagConstraints.CENTER; gbConstraints.fill = GridBagConstraints.BOTH; layout.addLayoutComponent(scroller, gbConstraints); add(scroller); } catch (Exception err) { err.printStackTrace(); } agreeLabel = new JLabel(parent.langpack.getString("LicencePanel.agree"), parent.icons.getImageIcon("help"), JLabel.TRAILING); parent.buildConstraints(gbConstraints, 0, 2, 2, 1, 1.0, 0.0); gbConstraints.anchor = GridBagConstraints.WEST; gbConstraints.fill = GridBagConstraints.NONE; layout.addLayoutComponent(agreeLabel, gbConstraints); add(agreeLabel); ButtonGroup group = new ButtonGroup(); yesRadio = new JRadioButton(parent.langpack.getString("LicencePanel.yes"), false); group.add(yesRadio); parent.buildConstraints(gbConstraints, 0, 3, 1, 1, 0.5, 0.0); gbConstraints.anchor = GridBagConstraints.WEST; layout.addLayoutComponent(yesRadio, gbConstraints); add(yesRadio); yesRadio.addActionListener(this); noRadio = new JRadioButton(parent.langpack.getString("LicencePanel.no"), false); group.add(noRadio); parent.buildConstraints(gbConstraints, 1, 3, 1, 1, 0.5, 0.0); gbConstraints.anchor = GridBagConstraints.EAST; layout.addLayoutComponent(noRadio, gbConstraints); add(noRadio); noRadio.addActionListener(this); } | 54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/6e8ab3930a21f787bcd0f3cf0b9937f9d50c80c0/HTMLLicencePanel.java/buggy/src/lib/com/izforge/izpack/panels/HTMLLicencePanel.java |
} catch (Exception err) | } catch (Exception err) | public HTMLLicencePanel(InstallerFrame parent, InstallData idata) { super(parent, idata); // We initialize our layout layout = new GridBagLayout(); gbConstraints = new GridBagConstraints(); setLayout(layout); // We load the licence loadLicence(); // We put our components infoLabel = new JLabel(parent.langpack.getString("LicencePanel.info"), parent.icons.getImageIcon("history"), JLabel.TRAILING); parent.buildConstraints(gbConstraints, 0, 0, 2, 1, 1.0, 0.0); gbConstraints.insets = new Insets(5, 5, 5, 5); gbConstraints.fill = GridBagConstraints.NONE; gbConstraints.anchor = GridBagConstraints.WEST; layout.addLayoutComponent(infoLabel, gbConstraints); add(infoLabel); try { textArea = new JEditorPane(); textArea.setEditable(false); textArea.addHyperlinkListener(this); JScrollPane scroller = new JScrollPane(textArea); textArea.setPage(loadLicence()); parent.buildConstraints(gbConstraints, 0, 1, 2, 1, 1.0, 1.0); gbConstraints.anchor = GridBagConstraints.CENTER; gbConstraints.fill = GridBagConstraints.BOTH; layout.addLayoutComponent(scroller, gbConstraints); add(scroller); } catch (Exception err) { err.printStackTrace(); } agreeLabel = new JLabel(parent.langpack.getString("LicencePanel.agree"), parent.icons.getImageIcon("help"), JLabel.TRAILING); parent.buildConstraints(gbConstraints, 0, 2, 2, 1, 1.0, 0.0); gbConstraints.anchor = GridBagConstraints.WEST; gbConstraints.fill = GridBagConstraints.NONE; layout.addLayoutComponent(agreeLabel, gbConstraints); add(agreeLabel); ButtonGroup group = new ButtonGroup(); yesRadio = new JRadioButton(parent.langpack.getString("LicencePanel.yes"), false); group.add(yesRadio); parent.buildConstraints(gbConstraints, 0, 3, 1, 1, 0.5, 0.0); gbConstraints.anchor = GridBagConstraints.WEST; layout.addLayoutComponent(yesRadio, gbConstraints); add(yesRadio); yesRadio.addActionListener(this); noRadio = new JRadioButton(parent.langpack.getString("LicencePanel.no"), false); group.add(noRadio); parent.buildConstraints(gbConstraints, 1, 3, 1, 1, 0.5, 0.0); gbConstraints.anchor = GridBagConstraints.EAST; layout.addLayoutComponent(noRadio, gbConstraints); add(noRadio); noRadio.addActionListener(this); } | 54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/6e8ab3930a21f787bcd0f3cf0b9937f9d50c80c0/HTMLLicencePanel.java/buggy/src/lib/com/izforge/izpack/panels/HTMLLicencePanel.java |
agreeLabel = new JLabel(parent.langpack.getString("LicencePanel.agree"), parent.icons.getImageIcon("help"), JLabel.TRAILING); | agreeLabel = new JLabel( parent.langpack.getString("LicencePanel.agree"), parent.icons.getImageIcon("help"), JLabel.TRAILING); | public HTMLLicencePanel(InstallerFrame parent, InstallData idata) { super(parent, idata); // We initialize our layout layout = new GridBagLayout(); gbConstraints = new GridBagConstraints(); setLayout(layout); // We load the licence loadLicence(); // We put our components infoLabel = new JLabel(parent.langpack.getString("LicencePanel.info"), parent.icons.getImageIcon("history"), JLabel.TRAILING); parent.buildConstraints(gbConstraints, 0, 0, 2, 1, 1.0, 0.0); gbConstraints.insets = new Insets(5, 5, 5, 5); gbConstraints.fill = GridBagConstraints.NONE; gbConstraints.anchor = GridBagConstraints.WEST; layout.addLayoutComponent(infoLabel, gbConstraints); add(infoLabel); try { textArea = new JEditorPane(); textArea.setEditable(false); textArea.addHyperlinkListener(this); JScrollPane scroller = new JScrollPane(textArea); textArea.setPage(loadLicence()); parent.buildConstraints(gbConstraints, 0, 1, 2, 1, 1.0, 1.0); gbConstraints.anchor = GridBagConstraints.CENTER; gbConstraints.fill = GridBagConstraints.BOTH; layout.addLayoutComponent(scroller, gbConstraints); add(scroller); } catch (Exception err) { err.printStackTrace(); } agreeLabel = new JLabel(parent.langpack.getString("LicencePanel.agree"), parent.icons.getImageIcon("help"), JLabel.TRAILING); parent.buildConstraints(gbConstraints, 0, 2, 2, 1, 1.0, 0.0); gbConstraints.anchor = GridBagConstraints.WEST; gbConstraints.fill = GridBagConstraints.NONE; layout.addLayoutComponent(agreeLabel, gbConstraints); add(agreeLabel); ButtonGroup group = new ButtonGroup(); yesRadio = new JRadioButton(parent.langpack.getString("LicencePanel.yes"), false); group.add(yesRadio); parent.buildConstraints(gbConstraints, 0, 3, 1, 1, 0.5, 0.0); gbConstraints.anchor = GridBagConstraints.WEST; layout.addLayoutComponent(yesRadio, gbConstraints); add(yesRadio); yesRadio.addActionListener(this); noRadio = new JRadioButton(parent.langpack.getString("LicencePanel.no"), false); group.add(noRadio); parent.buildConstraints(gbConstraints, 1, 3, 1, 1, 0.5, 0.0); gbConstraints.anchor = GridBagConstraints.EAST; layout.addLayoutComponent(noRadio, gbConstraints); add(noRadio); noRadio.addActionListener(this); } | 54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/6e8ab3930a21f787bcd0f3cf0b9937f9d50c80c0/HTMLLicencePanel.java/buggy/src/lib/com/izforge/izpack/panels/HTMLLicencePanel.java |
yesRadio = new JRadioButton(parent.langpack.getString("LicencePanel.yes"), false); | yesRadio = new JRadioButton(parent.langpack.getString("LicencePanel.yes"), false); | public HTMLLicencePanel(InstallerFrame parent, InstallData idata) { super(parent, idata); // We initialize our layout layout = new GridBagLayout(); gbConstraints = new GridBagConstraints(); setLayout(layout); // We load the licence loadLicence(); // We put our components infoLabel = new JLabel(parent.langpack.getString("LicencePanel.info"), parent.icons.getImageIcon("history"), JLabel.TRAILING); parent.buildConstraints(gbConstraints, 0, 0, 2, 1, 1.0, 0.0); gbConstraints.insets = new Insets(5, 5, 5, 5); gbConstraints.fill = GridBagConstraints.NONE; gbConstraints.anchor = GridBagConstraints.WEST; layout.addLayoutComponent(infoLabel, gbConstraints); add(infoLabel); try { textArea = new JEditorPane(); textArea.setEditable(false); textArea.addHyperlinkListener(this); JScrollPane scroller = new JScrollPane(textArea); textArea.setPage(loadLicence()); parent.buildConstraints(gbConstraints, 0, 1, 2, 1, 1.0, 1.0); gbConstraints.anchor = GridBagConstraints.CENTER; gbConstraints.fill = GridBagConstraints.BOTH; layout.addLayoutComponent(scroller, gbConstraints); add(scroller); } catch (Exception err) { err.printStackTrace(); } agreeLabel = new JLabel(parent.langpack.getString("LicencePanel.agree"), parent.icons.getImageIcon("help"), JLabel.TRAILING); parent.buildConstraints(gbConstraints, 0, 2, 2, 1, 1.0, 0.0); gbConstraints.anchor = GridBagConstraints.WEST; gbConstraints.fill = GridBagConstraints.NONE; layout.addLayoutComponent(agreeLabel, gbConstraints); add(agreeLabel); ButtonGroup group = new ButtonGroup(); yesRadio = new JRadioButton(parent.langpack.getString("LicencePanel.yes"), false); group.add(yesRadio); parent.buildConstraints(gbConstraints, 0, 3, 1, 1, 0.5, 0.0); gbConstraints.anchor = GridBagConstraints.WEST; layout.addLayoutComponent(yesRadio, gbConstraints); add(yesRadio); yesRadio.addActionListener(this); noRadio = new JRadioButton(parent.langpack.getString("LicencePanel.no"), false); group.add(noRadio); parent.buildConstraints(gbConstraints, 1, 3, 1, 1, 0.5, 0.0); gbConstraints.anchor = GridBagConstraints.EAST; layout.addLayoutComponent(noRadio, gbConstraints); add(noRadio); noRadio.addActionListener(this); } | 54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/6e8ab3930a21f787bcd0f3cf0b9937f9d50c80c0/HTMLLicencePanel.java/buggy/src/lib/com/izforge/izpack/panels/HTMLLicencePanel.java |
noRadio = new JRadioButton(parent.langpack.getString("LicencePanel.no"), false); | noRadio = new JRadioButton(parent.langpack.getString("LicencePanel.no"), false); | public HTMLLicencePanel(InstallerFrame parent, InstallData idata) { super(parent, idata); // We initialize our layout layout = new GridBagLayout(); gbConstraints = new GridBagConstraints(); setLayout(layout); // We load the licence loadLicence(); // We put our components infoLabel = new JLabel(parent.langpack.getString("LicencePanel.info"), parent.icons.getImageIcon("history"), JLabel.TRAILING); parent.buildConstraints(gbConstraints, 0, 0, 2, 1, 1.0, 0.0); gbConstraints.insets = new Insets(5, 5, 5, 5); gbConstraints.fill = GridBagConstraints.NONE; gbConstraints.anchor = GridBagConstraints.WEST; layout.addLayoutComponent(infoLabel, gbConstraints); add(infoLabel); try { textArea = new JEditorPane(); textArea.setEditable(false); textArea.addHyperlinkListener(this); JScrollPane scroller = new JScrollPane(textArea); textArea.setPage(loadLicence()); parent.buildConstraints(gbConstraints, 0, 1, 2, 1, 1.0, 1.0); gbConstraints.anchor = GridBagConstraints.CENTER; gbConstraints.fill = GridBagConstraints.BOTH; layout.addLayoutComponent(scroller, gbConstraints); add(scroller); } catch (Exception err) { err.printStackTrace(); } agreeLabel = new JLabel(parent.langpack.getString("LicencePanel.agree"), parent.icons.getImageIcon("help"), JLabel.TRAILING); parent.buildConstraints(gbConstraints, 0, 2, 2, 1, 1.0, 0.0); gbConstraints.anchor = GridBagConstraints.WEST; gbConstraints.fill = GridBagConstraints.NONE; layout.addLayoutComponent(agreeLabel, gbConstraints); add(agreeLabel); ButtonGroup group = new ButtonGroup(); yesRadio = new JRadioButton(parent.langpack.getString("LicencePanel.yes"), false); group.add(yesRadio); parent.buildConstraints(gbConstraints, 0, 3, 1, 1, 0.5, 0.0); gbConstraints.anchor = GridBagConstraints.WEST; layout.addLayoutComponent(yesRadio, gbConstraints); add(yesRadio); yesRadio.addActionListener(this); noRadio = new JRadioButton(parent.langpack.getString("LicencePanel.no"), false); group.add(noRadio); parent.buildConstraints(gbConstraints, 1, 3, 1, 1, 0.5, 0.0); gbConstraints.anchor = GridBagConstraints.EAST; layout.addLayoutComponent(noRadio, gbConstraints); add(noRadio); noRadio.addActionListener(this); } | 54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/6e8ab3930a21f787bcd0f3cf0b9937f9d50c80c0/HTMLLicencePanel.java/buggy/src/lib/com/izforge/izpack/panels/HTMLLicencePanel.java |
catch (Exception err) {} | public void hyperlinkUpdate(HyperlinkEvent e) { try { if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) textArea.setPage(e.getURL()); } catch (Exception err) {} } | 54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/6e8ab3930a21f787bcd0f3cf0b9937f9d50c80c0/HTMLLicencePanel.java/buggy/src/lib/com/izforge/izpack/panels/HTMLLicencePanel.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/HTMLLicencePanel.java/buggy/src/lib/com/izforge/izpack/panels/HTMLLicencePanel.java |
} catch (Exception ex) | } catch (Exception ex) | private URL loadLicence() { String resNamePrifix = "HTMLLicencePanel.licence"; try { return ResourceManager.getInstance().getURL(resNamePrifix); } catch (Exception ex) { ex.printStackTrace(); } return null; } | 54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/6e8ab3930a21f787bcd0f3cf0b9937f9d50c80c0/HTMLLicencePanel.java/buggy/src/lib/com/izforge/izpack/panels/HTMLLicencePanel.java |
} catch (ResourceNotFoundException rnfe) {} } | public static void loadDefaultInstallDir(InstallerFrame parentFrame, InstallData idata) { // Load only once ... if (getDefaultInstallDir() != null) return; BufferedReader br = null; try { InputStream in = null; if (OsVersion.IS_WINDOWS) in = parentFrame.getResource("TargetPanel.dir.windows"); else if (OsVersion.IS_OSX) in = parentFrame.getResource("TargetPanel.dir.macosx"); else { String os = System.getProperty("os.name"); // first try to look up by specific os name os = os.replace(' ', '_'); // avoid spaces in file names os = os.toLowerCase(); // for consistency among TargetPanel res // files try { in = parentFrame.getResource("TargetPanel.dir.".concat(os)); } catch (ResourceNotFoundException rnfe) {} // if not specific os, try getting generic 'unix' resource file if (in == null) in = parentFrame.getResource("TargetPanel.dir.unix"); // if all those failed, try to look up a generic dir file if (in == null) { try { in = parentFrame.getResource("TargetPanel.dir.unix"); } catch (ResourceNotFoundException eee) {} } } // if all above tests failed, there is no resource file, // so use system default if (in == null) { try { in = parentFrame.getResource("TargetPanel.dir"); } catch (ResourceNotFoundException eee) {} } // now read the file, once we've identified which one to read InputStreamReader isr = new InputStreamReader(in); br = new BufferedReader(isr); String line; while ((line = br.readLine()) != null) { line = line.trim(); // use the first non-blank line if (!"".equals(line)) break; } defaultInstallDir = line; VariableSubstitutor vs = new VariableSubstitutor(idata.getVariables()); defaultInstallDir = vs.substitute(defaultInstallDir, null); } catch (Exception e) { defaultInstallDir = null; // leave unset to take the system default set by Installer class } finally { try { if (br != null) br.close(); } catch (IOException ignored) {} } } | 54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/eb7a5df4d2709fd7dfd80506427f4d31c17dfe27/PathInputPanel.java/clean/src/lib/com/izforge/izpack/panels/PathInputPanel.java |
|
e.printStackTrace(); | public static void loadDefaultInstallDir(InstallerFrame parentFrame, InstallData idata) { // Load only once ... if (getDefaultInstallDir() != null) return; BufferedReader br = null; try { InputStream in = null; if (OsVersion.IS_WINDOWS) in = parentFrame.getResource("TargetPanel.dir.windows"); else if (OsVersion.IS_OSX) in = parentFrame.getResource("TargetPanel.dir.macosx"); else { String os = System.getProperty("os.name"); // first try to look up by specific os name os = os.replace(' ', '_'); // avoid spaces in file names os = os.toLowerCase(); // for consistency among TargetPanel res // files try { in = parentFrame.getResource("TargetPanel.dir.".concat(os)); } catch (ResourceNotFoundException rnfe) {} // if not specific os, try getting generic 'unix' resource file if (in == null) in = parentFrame.getResource("TargetPanel.dir.unix"); // if all those failed, try to look up a generic dir file if (in == null) { try { in = parentFrame.getResource("TargetPanel.dir.unix"); } catch (ResourceNotFoundException eee) {} } } // if all above tests failed, there is no resource file, // so use system default if (in == null) { try { in = parentFrame.getResource("TargetPanel.dir"); } catch (ResourceNotFoundException eee) {} } // now read the file, once we've identified which one to read InputStreamReader isr = new InputStreamReader(in); br = new BufferedReader(isr); String line; while ((line = br.readLine()) != null) { line = line.trim(); // use the first non-blank line if (!"".equals(line)) break; } defaultInstallDir = line; VariableSubstitutor vs = new VariableSubstitutor(idata.getVariables()); defaultInstallDir = vs.substitute(defaultInstallDir, null); } catch (Exception e) { defaultInstallDir = null; // leave unset to take the system default set by Installer class } finally { try { if (br != null) br.close(); } catch (IOException ignored) {} } } | 54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/eb7a5df4d2709fd7dfd80506427f4d31c17dfe27/PathInputPanel.java/clean/src/lib/com/izforge/izpack/panels/PathInputPanel.java |
|
_factory.activateObject(pair.value); if(_testOnBorrow && !_factory.validateObject(pair.value)) { _factory.destroyObject(pair.value); | try { _factory.activateObject(pair.value); if(_testOnBorrow && !_factory.validateObject(pair.value)) { throw new Exception("validateObject failed"); } _numActive++; return pair.value; } catch (Exception e) { try { _factory.destroyObject(pair.value); } catch (Exception e2) { } | public synchronized Object borrowObject() throws Exception { assertOpen(); long starttime = System.currentTimeMillis(); boolean newlyCreated = false; 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); newlyCreated = true; } 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); if(newlyCreated) { throw new NoSuchElementException("Could not create a validated object"); } // else keep looping } else { _numActive++; return pair.value; } } } | 50977 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50977/9edfa6440c9902186229544c41e8449da42b6b9a/GenericObjectPool.java/clean/src/java/org/apache/commons/pool/impl/GenericObjectPool.java |
} } else { _numActive++; return pair.value; | } else { continue; } | public synchronized Object borrowObject() throws Exception { assertOpen(); long starttime = System.currentTimeMillis(); boolean newlyCreated = false; 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); newlyCreated = true; } 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); if(newlyCreated) { throw new NoSuchElementException("Could not create a validated object"); } // else keep looping } else { _numActive++; return pair.value; } } } | 50977 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50977/9edfa6440c9902186229544c41e8449da42b6b9a/GenericObjectPool.java/clean/src/java/org/apache/commons/pool/impl/GenericObjectPool.java |
if (image == null) { UserNotifier un = control.getRegistry().getUserNotifier(); un.notifyInfo("Save image", saveMessage); cancelPreviewSaveImage(); return; } | private void handleSaveImage() { image = control.getDisplayImage(); lensImage = null; saveMessage = MAIN_MSG; preview.setImage(image); UIUtilities.centerAndShow(preview); } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/3be8a75dd7408b3e6496ef60f81dc46c2c18b171/ImageSaverMng.java/buggy/SRC/org/openmicroscopy/shoola/agents/viewer/util/ImageSaverMng.java |
|
if (image == null) { UserNotifier un = control.getRegistry().getUserNotifier(); un.notifyInfo("Save image", saveMessage); cancelPreviewSaveImage(); return; } | private void handleSaveImageAndROI() { image = control.getImageAndROIs(); lensImage = null; saveMessage = MAIN_MSG; preview.setImage(image); UIUtilities.centerAndShow(preview); } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/3be8a75dd7408b3e6496ef60f81dc46c2c18b171/ImageSaverMng.java/buggy/SRC/org/openmicroscopy/shoola/agents/viewer/util/ImageSaverMng.java |
|
if (image == null || lensImage == null) { UserNotifier un = control.getRegistry().getUserNotifier(); un.notifyInfo("Save image", saveMessage); cancelPreviewSaveImage(); return; } | private void handleSavePinAndImage() { JCheckBox box = view.selection.paintingOnOff; if (box.isSelected()) { int i = view.selection.colors.getSelectedIndex(); image = control.getDisplayImageWithPinArea(true, colorSelection[i]); } else image = control.getDisplayImage(); saveMessage = BOTH_MSG; lensImage = control.getPinImage(); preview.setImages(image, lensImage); UIUtilities.centerAndShow(preview); } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/3be8a75dd7408b3e6496ef60f81dc46c2c18b171/ImageSaverMng.java/buggy/SRC/org/openmicroscopy/shoola/agents/viewer/util/ImageSaverMng.java |
|
if (image == null) { UserNotifier un = control.getRegistry().getUserNotifier(); un.notifyInfo("Save image", saveMessage); cancelPreviewSaveImage(); return; } | private void handleSavePinBottomLeft() { JCheckBox box = view.selection.paintingOnOff; Color c = null; if (box.isSelected()) { int i = view.selection.colors.getSelectedIndex(); c = colorSelection[i]; } image = control.getPinOnSideBottomLeft(box.isSelected(), c); lensImage = null; saveMessage = BOTH_MSG; preview.setImage(image); UIUtilities.centerAndShow(preview); } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/3be8a75dd7408b3e6496ef60f81dc46c2c18b171/ImageSaverMng.java/buggy/SRC/org/openmicroscopy/shoola/agents/viewer/util/ImageSaverMng.java |
|
if (image == null) { UserNotifier un = control.getRegistry().getUserNotifier(); un.notifyInfo("Save image", saveMessage); cancelPreviewSaveImage(); return; } | private void handleSavePinBottomRight() { JCheckBox box = view.selection.paintingOnOff; Color c = null; if (box.isSelected()) { int i = view.selection.colors.getSelectedIndex(); c = colorSelection[i]; } image = control.getPinOnSideBottomRight(box.isSelected(), c); lensImage = null; saveMessage = BOTH_MSG; preview.setImage(image); UIUtilities.centerAndShow(preview); } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/3be8a75dd7408b3e6496ef60f81dc46c2c18b171/ImageSaverMng.java/buggy/SRC/org/openmicroscopy/shoola/agents/viewer/util/ImageSaverMng.java |
|
if (image == null) { UserNotifier un = control.getRegistry().getUserNotifier(); un.notifyInfo("Save image", saveMessage); cancelPreviewSaveImage(); return; } | private void handleSavePinImage() { image = control.getPinImage(); lensImage = null; saveMessage = PIN_MSG; preview.setImage(image); UIUtilities.centerAndShow(preview); } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/3be8a75dd7408b3e6496ef60f81dc46c2c18b171/ImageSaverMng.java/buggy/SRC/org/openmicroscopy/shoola/agents/viewer/util/ImageSaverMng.java |
|
if (image == null) { UserNotifier un = control.getRegistry().getUserNotifier(); un.notifyInfo("Save image", saveMessage); cancelPreviewSaveImage(); return; } | private void handleSavePinOnImage() { image = control.getPinOnImage(); saveMessage = BOTH_MSG; lensImage = null; preview.setImage(image); UIUtilities.centerAndShow(preview); } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/3be8a75dd7408b3e6496ef60f81dc46c2c18b171/ImageSaverMng.java/buggy/SRC/org/openmicroscopy/shoola/agents/viewer/util/ImageSaverMng.java |
|
if (image == null) { UserNotifier un = control.getRegistry().getUserNotifier(); un.notifyInfo("Save image", saveMessage); cancelPreviewSaveImage(); return; } | private void handleSavePinTopLeft() { JCheckBox box = view.selection.paintingOnOff; Color c = null; if (box.isSelected()) { int i = view.selection.colors.getSelectedIndex(); c = colorSelection[i]; } image = control.getPinOnSideTopLeft(box.isSelected(), c); lensImage = null; saveMessage = BOTH_MSG; preview.setImage(image); UIUtilities.centerAndShow(preview); } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/3be8a75dd7408b3e6496ef60f81dc46c2c18b171/ImageSaverMng.java/buggy/SRC/org/openmicroscopy/shoola/agents/viewer/util/ImageSaverMng.java |
|
if (image == null) { UserNotifier un = control.getRegistry().getUserNotifier(); un.notifyInfo("Save image", saveMessage); cancelPreviewSaveImage(); return; } | private void handleSavePinTopRight() { JCheckBox box = view.selection.paintingOnOff; Color c = null; if (box.isSelected()) { int i = view.selection.colors.getSelectedIndex(); c = colorSelection[i]; } image = control.getPinOnSideTopRight(box.isSelected(), c); lensImage = null; saveMessage = BOTH_MSG; preview.setImage(image); UIUtilities.centerAndShow(preview); } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/3be8a75dd7408b3e6496ef60f81dc46c2c18b171/ImageSaverMng.java/buggy/SRC/org/openmicroscopy/shoola/agents/viewer/util/ImageSaverMng.java |
|
if (img == null) return; | void setImage(BufferedImage img) { int w = img.getWidth()+3*ViewerUIF.START; int h = img.getHeight()+2*ViewerUIF.START; setContainerSize(new Dimension(w, h)); w += 2*ViewerUIF.START; h += 2*ViewerUIF.START; setWindowSize(w, h); canvas.paintImage(img); } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/3be8a75dd7408b3e6496ef60f81dc46c2c18b171/Preview.java/buggy/SRC/org/openmicroscopy/shoola/agents/viewer/util/Preview.java |
|
if (img == null || lensImage == null) return; | void setImages(BufferedImage img, BufferedImage lensImage) { int w = img.getWidth()+lensImage.getWidth()+3*ViewerUIF.START; int h = img.getHeight()+lensImage.getHeight()+2*ViewerUIF.START; setContainerSize(new Dimension(w, h)); w += 2*ViewerUIF.START; h += 2*ViewerUIF.START; setWindowSize(w, h); canvas.paintImages(img, lensImage); } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/3be8a75dd7408b3e6496ef60f81dc46c2c18b171/Preview.java/buggy/SRC/org/openmicroscopy/shoola/agents/viewer/util/Preview.java |
|
if (!override.equalsIgnoreCase("true")) | if (!"true".equalsIgnoreCase(override)) | private void performValueSetting(XMLElement regEntry, VariableSubstitutor substitutor) throws Exception { SpecHelper specHelper = getSpecHelper(); String name = specHelper.getRequiredAttribute(regEntry, REG_BASENAME); name = substitutor.substitute(name, null); String keypath = specHelper.getRequiredAttribute(regEntry, REG_KEYPATH); keypath = substitutor.substitute(keypath, null); String root = specHelper.getRequiredAttribute(regEntry, REG_ROOT); int rootId = resolveRoot(regEntry, root, substitutor); RegistryHandler rh = RegistryDefaultHandler.getInstance(); if (rh == null) return; rh.setRoot(rootId); String override = regEntry.getAttribute(REG_OVERRIDE, "true"); if (!override.equalsIgnoreCase("true")) { // Do not set value if override is not true and the value exist. if (rh.getValue(keypath, name, null) != null) return; } String value = regEntry.getAttribute(REG_DWORD); if (value != null) { // Value type is DWord; placeholder possible. value = substitutor.substitute(value, null); rh.setValue(keypath, name, Long.parseLong(value)); return; } value = regEntry.getAttribute(REG_STRING); if (value != null) { // Value type is string; placeholder possible. value = substitutor.substitute(value, null); rh.setValue(keypath, name, value); return; } Vector values = regEntry.getChildrenNamed(REG_MULTI); if (values != null && !values.isEmpty()) { // Value type is REG_MULTI_SZ; placeholder possible. Iterator multiIter = values.iterator(); String[] multiString = new String[values.size()]; for (int i = 0; multiIter.hasNext(); ++i) { XMLElement element = (XMLElement) multiIter.next(); multiString[i] = specHelper.getRequiredAttribute(element, REG_DATA); multiString[i] = substitutor.substitute(multiString[i], null); } rh.setValue(keypath, name, multiString); return; } values = regEntry.getChildrenNamed(REG_BIN); if (values != null && !values.isEmpty()) { // Value type is REG_BINARY; placeholder possible or not ??? why not // ... Iterator multiIter = values.iterator(); StringBuffer buf = new StringBuffer(); for (int i = 0; multiIter.hasNext(); ++i) { XMLElement element = (XMLElement) multiIter.next(); String tmp = specHelper.getRequiredAttribute(element, REG_DATA); buf.append(tmp); if (!tmp.endsWith(",") && multiIter.hasNext()) buf.append(","); } byte[] bytes = extractBytes(regEntry, substitutor.substitute(buf.toString(), null)); rh.setValue(keypath, name, bytes); return; } specHelper.parseError(regEntry, "No data found."); } | 54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/9619b3a25f43787dc92011111668210e06c00c71/RegistryInstallerListener.java/buggy/src/lib/com/izforge/izpack/event/RegistryInstallerListener.java |
root = substitutor.substitute(root, null); Integer tmp = (Integer) RegistryHandler.ROOT_KEY_MAP.get(root); | String root1 = substitutor.substitute(root, null); Integer tmp = (Integer) RegistryHandler.ROOT_KEY_MAP.get(root1); | private int resolveRoot(XMLElement regEntry, String root, VariableSubstitutor substitutor) throws Exception { root = substitutor.substitute(root, null); Integer tmp = (Integer) RegistryHandler.ROOT_KEY_MAP.get(root); if (tmp != null) return (tmp.intValue()); getSpecHelper().parseError(regEntry, "Unknown value (" + root + ")for registry root."); return 0; } | 54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/9619b3a25f43787dc92011111668210e06c00c71/RegistryInstallerListener.java/buggy/src/lib/com/izforge/izpack/event/RegistryInstallerListener.java |
getSpecHelper().parseError(regEntry, "Unknown value (" + root + ")for registry root."); | getSpecHelper().parseError(regEntry, "Unknown value (" + root1 + ")for registry root."); | private int resolveRoot(XMLElement regEntry, String root, VariableSubstitutor substitutor) throws Exception { root = substitutor.substitute(root, null); Integer tmp = (Integer) RegistryHandler.ROOT_KEY_MAP.get(root); if (tmp != null) return (tmp.intValue()); getSpecHelper().parseError(regEntry, "Unknown value (" + root + ")for registry root."); return 0; } | 54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/9619b3a25f43787dc92011111668210e06c00c71/RegistryInstallerListener.java/buggy/src/lib/com/izforge/izpack/event/RegistryInstallerListener.java |
while(!_cancelled) { try { Thread.sleep(_delay); } catch(Exception e) { } try { evict(); } catch(Exception e) { } try { ensureMinIdle(); } catch(Exception e) { } | try { evict(); } catch(Exception e) { } try { ensureMinIdle(); } catch(Exception e) { | public void run() { while(!_cancelled) { try { Thread.sleep(_delay); } catch(Exception e) { // ignored } try { evict(); } catch(Exception e) { // ignored } try { ensureMinIdle(); } catch(Exception e) { // ignored } } } | 50977 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50977/040416e9a1f3dc7bd49171b76ed6a766164e6fed/GenericObjectPool.java/clean/src/java/org/apache/commons/pool/impl/GenericObjectPool.java |
Method target = clazz.getMethod("uninstall", new Class[] {String[].class}); | Method target = clazz.getMethod("uninstall", new Class[] { String[].class }); | public static void main(String[] args) { try { Class clazz = Uninstaller.class; Method target = clazz.getMethod("uninstall", new Class[] {String[].class}); new SelfModifier(target).invoke(args); } catch (Exception ioeOrTypo) { System.err.println(ioeOrTypo.getMessage()); ioeOrTypo.printStackTrace(); System.err.println("Unable to exec java as a subprocess."); System.err.println("The uninstall may not fully complete."); uninstall(args); } } | 54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/6e8ab3930a21f787bcd0f3cf0b9937f9d50c80c0/Uninstaller.java/clean/src/lib/com/izforge/izpack/uninstaller/Uninstaller.java |
} catch (Exception ioeOrTypo) | } catch (Exception ioeOrTypo) | public static void main(String[] args) { try { Class clazz = Uninstaller.class; Method target = clazz.getMethod("uninstall", new Class[] {String[].class}); new SelfModifier(target).invoke(args); } catch (Exception ioeOrTypo) { System.err.println(ioeOrTypo.getMessage()); ioeOrTypo.printStackTrace(); System.err.println("Unable to exec java as a subprocess."); System.err.println("The uninstall may not fully complete."); uninstall(args); } } | 54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/6e8ab3930a21f787bcd0f3cf0b9937f9d50c80c0/Uninstaller.java/clean/src/lib/com/izforge/izpack/uninstaller/Uninstaller.java |
} catch (Exception err) | } catch (Exception err) | public static void uninstall(String[] args) { try { MetalLookAndFeel.setCurrentTheme(new IzPackMetalTheme()); new UninstallerFrame(); } catch (Exception err) { System.err.println("- Error -"); err.printStackTrace(); System.exit(0); } } | 54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/6e8ab3930a21f787bcd0f3cf0b9937f9d50c80c0/Uninstaller.java/clean/src/lib/com/izforge/izpack/uninstaller/Uninstaller.java |
public SelfModifier(Method method) throws IOException | private SelfModifier() throws IOException | public SelfModifier(Method method) throws IOException { phase = 1; initJavaExec(); initMethod(method); } | 54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/08ecc635ba8049aeb419722893f373a4a7f99a77/SelfModifier.java/buggy/src/lib/com/izforge/izpack/uninstaller/SelfModifier.java |
phase = 1; initJavaExec(); initMethod(method); | phase = Integer.parseInt(System.getProperty(PHASE_KEY)); String cName = System.getProperty(CLASS_KEY); String tName = System.getProperty(METHOD_KEY); jarFile = new File(System.getProperty(JAR_KEY)); logFile = new File(System.getProperty(BASE_KEY) + ".log"); sandbox = new File(System.getProperty(BASE_KEY) + ".d"); try { Class clazz = Class.forName(cName); Method method = clazz.getMethod(tName, new Class[] { String[].class }); initMethod(method); } catch (ClassNotFoundException x1) { log("No class found for " + cName); } catch (NoSuchMethodException x2) { log("No method " + tName + " found in " + cName); } | public SelfModifier(Method method) throws IOException { phase = 1; initJavaExec(); initMethod(method); } | 54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/08ecc635ba8049aeb419722893f373a4a7f99a77/SelfModifier.java/buggy/src/lib/com/izforge/izpack/uninstaller/SelfModifier.java |
for (int i = 0; i < this.pathComboBox.getItemCount(); ++i) { String path = (String)this.pathComboBox.getItemAt (i); | for (int i = 0; i < this.pathComboBox.getItemCount(); ++i) { String path = (String) this.pathComboBox.getItemAt(i); | public boolean autodetect () { //Checks whether a placeholder item is in the combobox //and resolve the pathes automatically: ///usr/lib/* searches all folders in usr/lib to find /usr/lib/*/lib/tools.jar for (int i = 0; i < this.pathComboBox.getItemCount(); ++i) { String path = (String)this.pathComboBox.getItemAt (i); if (path.endsWith("*")) { path = path.substring(0,path.length()-1); File dir = new File(path); if (dir.isDirectory()) { File[] subdirs = dir.listFiles(); for (int x=0;x<subdirs.length;x++) { String search = subdirs[x].getAbsolutePath(); if (this.pathMatches (search)) { items.add(search); } } } } else { items.add(path); } } //Now clear the combobox and add the items out of the newly //generated vector this.pathComboBox.removeAllItems(); VariableSubstitutor vs = new VariableSubstitutor(idata.getVariables()); for (int i=0;i<items.size();i++) { this.pathComboBox.addItem(vs.substitute((String)items.get(i), "plain")); } // loop through all items for (int i = 0; i < this.pathComboBox.getItemCount(); ++i) { String path = (String)this.pathComboBox.getItemAt (i); if (this.pathMatches (path)) { this.pathComboBox.setSelectedIndex (i); return true; } } // if the user entered something else, it's not listed as an item if (this.pathMatches ((String)this.pathComboBox.getSelectedItem())) { return true; } return false; } | 54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/de1cbb1d267cd3c3d263ea7223133711bab5b186/UserInputPanel.java/buggy/src/lib/com/izforge/izpack/panels/UserInputPanel.java |
if (path.endsWith("*")) { path = path.substring(0,path.length()-1); File dir = new File(path); | if (path.endsWith("*")) { path = path.substring(0, path.length() - 1); File dir = new File(path); | public boolean autodetect () { //Checks whether a placeholder item is in the combobox //and resolve the pathes automatically: ///usr/lib/* searches all folders in usr/lib to find /usr/lib/*/lib/tools.jar for (int i = 0; i < this.pathComboBox.getItemCount(); ++i) { String path = (String)this.pathComboBox.getItemAt (i); if (path.endsWith("*")) { path = path.substring(0,path.length()-1); File dir = new File(path); if (dir.isDirectory()) { File[] subdirs = dir.listFiles(); for (int x=0;x<subdirs.length;x++) { String search = subdirs[x].getAbsolutePath(); if (this.pathMatches (search)) { items.add(search); } } } } else { items.add(path); } } //Now clear the combobox and add the items out of the newly //generated vector this.pathComboBox.removeAllItems(); VariableSubstitutor vs = new VariableSubstitutor(idata.getVariables()); for (int i=0;i<items.size();i++) { this.pathComboBox.addItem(vs.substitute((String)items.get(i), "plain")); } // loop through all items for (int i = 0; i < this.pathComboBox.getItemCount(); ++i) { String path = (String)this.pathComboBox.getItemAt (i); if (this.pathMatches (path)) { this.pathComboBox.setSelectedIndex (i); return true; } } // if the user entered something else, it's not listed as an item if (this.pathMatches ((String)this.pathComboBox.getSelectedItem())) { return true; } return false; } | 54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/de1cbb1d267cd3c3d263ea7223133711bab5b186/UserInputPanel.java/buggy/src/lib/com/izforge/izpack/panels/UserInputPanel.java |
if (dir.isDirectory()) { File[] subdirs = dir.listFiles(); for (int x=0;x<subdirs.length;x++) { String search = subdirs[x].getAbsolutePath(); if (this.pathMatches (search)) { items.add(search); } } } } else { items.add(path); } } this.pathComboBox.removeAllItems(); VariableSubstitutor vs = new VariableSubstitutor(idata.getVariables()); for (int i=0;i<items.size();i++) { this.pathComboBox.addItem(vs.substitute((String)items.get(i), "plain")); } for (int i = 0; i < this.pathComboBox.getItemCount(); ++i) { String path = (String)this.pathComboBox.getItemAt (i); if (this.pathMatches (path)) { this.pathComboBox.setSelectedIndex (i); return true; | if (dir.isDirectory()) { File[] subdirs = dir.listFiles(); for (int x = 0; x < subdirs.length; x++) { String search = subdirs[x].getAbsolutePath(); if (this.pathMatches(search)) { items.add(search); } } } } else { items.add(path); } | public boolean autodetect () { //Checks whether a placeholder item is in the combobox //and resolve the pathes automatically: ///usr/lib/* searches all folders in usr/lib to find /usr/lib/*/lib/tools.jar for (int i = 0; i < this.pathComboBox.getItemCount(); ++i) { String path = (String)this.pathComboBox.getItemAt (i); if (path.endsWith("*")) { path = path.substring(0,path.length()-1); File dir = new File(path); if (dir.isDirectory()) { File[] subdirs = dir.listFiles(); for (int x=0;x<subdirs.length;x++) { String search = subdirs[x].getAbsolutePath(); if (this.pathMatches (search)) { items.add(search); } } } } else { items.add(path); } } //Now clear the combobox and add the items out of the newly //generated vector this.pathComboBox.removeAllItems(); VariableSubstitutor vs = new VariableSubstitutor(idata.getVariables()); for (int i=0;i<items.size();i++) { this.pathComboBox.addItem(vs.substitute((String)items.get(i), "plain")); } // loop through all items for (int i = 0; i < this.pathComboBox.getItemCount(); ++i) { String path = (String)this.pathComboBox.getItemAt (i); if (this.pathMatches (path)) { this.pathComboBox.setSelectedIndex (i); return true; } } // if the user entered something else, it's not listed as an item if (this.pathMatches ((String)this.pathComboBox.getSelectedItem())) { return true; } return false; } | 54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/de1cbb1d267cd3c3d263ea7223133711bab5b186/UserInputPanel.java/buggy/src/lib/com/izforge/izpack/panels/UserInputPanel.java |
if (this.pathMatches ((String)this.pathComboBox.getSelectedItem())) { return true; } return false; } | public boolean autodetect () { //Checks whether a placeholder item is in the combobox //and resolve the pathes automatically: ///usr/lib/* searches all folders in usr/lib to find /usr/lib/*/lib/tools.jar for (int i = 0; i < this.pathComboBox.getItemCount(); ++i) { String path = (String)this.pathComboBox.getItemAt (i); if (path.endsWith("*")) { path = path.substring(0,path.length()-1); File dir = new File(path); if (dir.isDirectory()) { File[] subdirs = dir.listFiles(); for (int x=0;x<subdirs.length;x++) { String search = subdirs[x].getAbsolutePath(); if (this.pathMatches (search)) { items.add(search); } } } } else { items.add(path); } } //Now clear the combobox and add the items out of the newly //generated vector this.pathComboBox.removeAllItems(); VariableSubstitutor vs = new VariableSubstitutor(idata.getVariables()); for (int i=0;i<items.size();i++) { this.pathComboBox.addItem(vs.substitute((String)items.get(i), "plain")); } // loop through all items for (int i = 0; i < this.pathComboBox.getItemCount(); ++i) { String path = (String)this.pathComboBox.getItemAt (i); if (this.pathMatches (path)) { this.pathComboBox.setSelectedIndex (i); return true; } } // if the user entered something else, it's not listed as an item if (this.pathMatches ((String)this.pathComboBox.getSelectedItem())) { return true; } return false; } | 54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/de1cbb1d267cd3c3d263ea7223133711bab5b186/UserInputPanel.java/buggy/src/lib/com/izforge/izpack/panels/UserInputPanel.java |
|
public abstract ZipOutputStream addPack(int packNumber, String name, | public abstract ZipOutputStream addPack(int packNumber, String name, String targetOs, | public abstract ZipOutputStream addPack(int packNumber, String name, boolean required, String description) throws Exception; | 54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/c3234416ca8408295e1d45c60daee2efe9c3f5db/Packager.java/buggy/src/lib/com/izforge/izpack/compiler/Packager.java |
PackInfo pack = new PackInfo(name, id, description, required); | PackInfo pack = new PackInfo(name, id, description, required, loose); | protected void addPacks(XMLElement data) throws CompilerException { notifyCompilerListener("addPacks", CompilerListener.BEGIN, data); // Initialisation XMLElement root = requireChildNamed(data, "packs"); // at least one pack is required Vector packElements = root.getChildrenNamed("pack"); if (packElements.isEmpty()) parseError(root, "<packs> requires a <pack>"); Iterator packIter = packElements.iterator(); while (packIter.hasNext()) { XMLElement el = (XMLElement) packIter.next(); // Trivial initialisations String name = requireAttribute(el, "name"); String id = el.getAttribute("id"); String description = requireChildNamed(el, "description").getContent(); boolean required = requireYesNoAttribute(el, "required"); PackInfo pack = new PackInfo(name, id, description, required); pack.setOsConstraints(OsConstraint.getOsList(el)); // TODO: unverified pack.setPreselected(validateYesNoAttribute(el, "preselected", YES)); // We get the parsables list Iterator iter = el.getChildrenNamed("parsable").iterator(); while (iter.hasNext()) { XMLElement p = (XMLElement) iter.next(); String target = requireAttribute(p, "targetfile"); String type = p.getAttribute("type", "plain"); String encoding = p.getAttribute("encoding", null); List osList = OsConstraint.getOsList(p); // TODO: unverified pack.addParsable(new ParsableFile(target, type, encoding, osList)); } // We get the executables list iter = el.getChildrenNamed("executable").iterator(); while (iter.hasNext()) { XMLElement e = (XMLElement) iter.next(); ExecutableFile executable = new ExecutableFile(); String val; // temp value executable.path = requireAttribute(e, "targetfile"); // when to execute this executable val = e.getAttribute("stage", "never"); if ("postinstall".equalsIgnoreCase(val)) executable.executionStage = ExecutableFile.POSTINSTALL; else if ("uninstall".equalsIgnoreCase(val)) executable.executionStage = ExecutableFile.UNINSTALL; // type of this executable val = e.getAttribute("type", "bin"); if ("jar".equalsIgnoreCase(val)) { executable.type = ExecutableFile.JAR; executable.mainClass = e.getAttribute("class"); // executable class } // what to do if execution fails val = e.getAttribute("failure", "ask"); if ("abort".equalsIgnoreCase(val)) executable.onFailure = ExecutableFile.ABORT; else if ("warn".equalsIgnoreCase(val)) executable.onFailure = ExecutableFile.WARN; // whether to keep the executable after executing it val = e.getAttribute("keep"); executable.keepFile = "true".equalsIgnoreCase(val); // get arguments for this executable XMLElement args = e.getFirstChildNamed("args"); if (null != args) { Iterator argIterator = args.getChildrenNamed("arg").iterator(); while (argIterator.hasNext()) { XMLElement arg = (XMLElement) argIterator.next(); executable.argList.add(requireAttribute(arg, "value")); } } executable.osList = OsConstraint.getOsList(e); // TODO: unverified pack.addExecutable(executable); } // We get the files list iter = el.getChildrenNamed("file").iterator(); while (iter.hasNext()) { XMLElement f = (XMLElement) iter.next(); String src = requireAttribute(f, "src"); String targetdir = requireAttribute(f, "targetdir"); List osList = OsConstraint.getOsList(f); // TODO: unverified int override = getOverrideValue(f); Map additionals = getAdditionals(f); File file = new File(src); if (! file.isAbsolute()) file = new File(basedir, src); try { addRecursively(file, targetdir, osList, override, pack, additionals); } catch (Exception x) { parseError(f, x.getMessage(), x); } } // We get the singlefiles list iter = el.getChildrenNamed("singlefile").iterator(); while (iter.hasNext()) { XMLElement f = (XMLElement) iter.next(); String src = requireAttribute(f, "src"); String target = requireAttribute(f, "target"); List osList = OsConstraint.getOsList(f); // TODO: unverified int override = getOverrideValue(f); Map additionals = getAdditionals(f); File file = new File(src); if (! file.isAbsolute()) file = new File(basedir, src); try { pack.addFile(file, target, osList, override, additionals); } catch (FileNotFoundException x) { parseError(f, x.getMessage(), x); } } // We get the fileset list iter = el.getChildrenNamed("fileset").iterator(); while (iter.hasNext()) { XMLElement f = (XMLElement) iter.next(); String dir_attr = requireAttribute(f, "dir"); File dir = new File(dir_attr); if (! dir.isAbsolute()) dir = new File(basedir, dir_attr); if (! dir.isDirectory()) // also tests '.exists()' parseError(f, "Invalid directory 'dir': " + dir_attr); boolean casesensitive = validateYesNoAttribute(f, "casesensitive", YES); boolean defexcludes = validateYesNoAttribute(f, "defaultexcludes", YES); String targetdir = requireAttribute(f, "targetdir"); List osList = OsConstraint.getOsList(f); // TODO: unverified int override = getOverrideValue(f); Map additionals = getAdditionals(f); // get includes and excludes Vector xcludesList = null; String[] includes = null; xcludesList = f.getChildrenNamed("include"); if (! xcludesList.isEmpty()) { includes = new String[xcludesList.size()]; for (int j = 0; j < xcludesList.size(); j++) { XMLElement xclude = (XMLElement) xcludesList.get(j); includes[j] = requireAttribute(xclude, "name"); } } String[] excludes = null; xcludesList = f.getChildrenNamed("exclude"); if (! xcludesList.isEmpty()) { excludes = new String[xcludesList.size()]; for (int j = 0; j < xcludesList.size(); j++) { XMLElement xclude = (XMLElement) xcludesList.get(j); excludes[j] = requireAttribute(xclude, "name"); } } // scan and add fileset DirectoryScanner ds = new DirectoryScanner(); ds.setIncludes(includes); ds.setExcludes(excludes); if (defexcludes) ds.addDefaultExcludes(); ds.setBasedir(dir); ds.setCaseSensitive(casesensitive); ds.scan(); String[] files = ds.getIncludedFiles(); String[] dirs = ds.getIncludedDirectories(); // Directory scanner has done recursion, add files and directories for (int i = 0; i < files.length; ++i) { try { String target = new File(targetdir, files[i]).getPath(); pack.addFile(new File(dir, files[i]), target, osList, override, additionals); } catch (FileNotFoundException x) { parseError(f, x.getMessage(), x); } } for (int i = 0; i < dirs.length; ++i) { try { String target = new File(targetdir, dirs[i]).getPath(); pack.addFile(new File(dir, dirs[i]), target, osList, override, additionals); } catch (FileNotFoundException x) { parseError(f, x.getMessage(), x); } } } // get the updatechecks list iter = el.getChildrenNamed("updatecheck").iterator(); while (iter.hasNext()) { XMLElement f = (XMLElement) iter.next(); String casesensitive = f.getAttribute("casesensitive"); // get includes and excludes ArrayList includesList = new ArrayList(); ArrayList excludesList = new ArrayList(); // get includes and excludes Iterator include_it = f.getChildrenNamed("include").iterator(); while (include_it.hasNext()) { XMLElement inc_el = (XMLElement) include_it.next(); includesList.add(requireAttribute(inc_el, "name")); } Iterator exclude_it = f.getChildrenNamed("exclude").iterator(); while (exclude_it.hasNext()) { XMLElement excl_el = (XMLElement) exclude_it.next(); excludesList.add(requireAttribute(excl_el, "name")); } pack.addUpdateCheck( new UpdateCheck(includesList, excludesList, casesensitive)); } // We add the pack packager.addPack(pack); } notifyCompilerListener("addPacks", CompilerListener.END, data); } | 54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/670d2dce35e3033459b7343ab34ed921bd2331ed/Compiler.java/buggy/src/lib/com/izforge/izpack/compiler/Compiler.java |
ann.add(Restrictions.in("details.id", annotatorIds )); | ann.add(Restrictions.in("details.owner.id", annotatorIds )); | protected void buildQuery(Session session) throws HibernateException, SQLException { PojoOptions po = new PojoOptions((Map) value(OPTIONS)); Class k = (Class) value(CLASS); if ( ! typeToAnnotationType.containsKey( k )) { throw new IllegalArgumentException( "Class "+k+" is not accepted by "+ PojosFindAnnotationsQueryDefinition.class.getName() ); } Class target = typeToAnnotationType.get((Class) value(CLASS)); String path = annotationTypeToPath.get(target); //TODO refactor into CriteriaUtils Criteria ann = session.createCriteria(target); ann.createAlias("details.owner", "ann_owner"); ann.createAlias("details.creationEvent", "ann_create"); ann.createAlias("details.updateEvent", "ann_update"); ann.setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY); ann.add(Restrictions.in(path+".id",(Collection) value(IDS))); Criteria obj = ann.createCriteria(path,LEFT_JOIN); obj.createAlias("details.owner", "obj_owner"); obj.createAlias("details.creationEvent", "obj_create"); obj.createAlias("details.updateEvent", "obj_update"); if (check("annotatorIds")) { Collection annotatorIds = (Collection) value("annotatorIds"); if (annotatorIds != null && annotatorIds.size() > 0) ann.add(Restrictions.in("details.id", annotatorIds )); } setCriteria( ann ); } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/d92a88d0d79640fb07d5559aa2c0f5d0f1dd4752/PojosFindAnnotationsQueryDefinition.java/buggy/components/server/src/ome/services/query/PojosFindAnnotationsQueryDefinition.java |
if (name.length() == pos + className.length() + 6) | if (pos != -1 && name.length() == pos + className.length() + 6) | private String getFullClassName(URL url, String className) throws Exception { JarInputStream jis = new JarInputStream(url.openStream()); ZipEntry zentry = null; while ((zentry = jis.getNextEntry()) != null) { String name = zentry.getName(); int lastPos = name.lastIndexOf(".class"); if (lastPos < 0) { continue; // No class file. } name = name.replace('/', '.'); int pos = -1; if (className != null) { pos = name.indexOf(className); } if (name.length() == pos + className.length() + 6) // "Main" class // found { jis.close(); return (name.substring(0, lastPos)); } } jis.close(); return (null); } | 54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/458df5388598b1463abaab7f3fba01a728e5d095/CompilerConfig.java/buggy/src/lib/com/izforge/izpack/compiler/CompilerConfig.java |
double k = qDef.curveCoefficient; | double k = getCurveCoefficient(); | private void buildLUT() { if (LUT == null) init(); // Comparable assumed to be Integer //domain double dStart = getWindowStart(), dEnd = getWindowEnd(); double k = qDef.curveCoefficient; //double ys = valueMapper.transform(dStart, k); //double ye = valueMapper.transform(dEnd, k); //double a0 = qDef.bitResolution/(ye-ys); double a1 = (qDef.cdEnd-qDef.cdStart)/((double) qDef.bitResolution); int x = min; //Temporary, to come: "piece-wise rendering." QuantumMap normalize = new PolynomialMap(); int extra = 10; //double decile = (max-min)/(double) 10; //double Q1 = min+decile, Q9 = max-decile; double S1 = dStart; double ysNorm = valueMapper.transform(0, k); double yeNorm = valueMapper.transform(255, k); double aNorm = qDef.bitResolution/(yeNorm-ysNorm); double v = extra; double c0;//, nom = Q9-Q1; /* if (dStart >= Q1 && dEnd > Q9) { nom = (Q9-dStart); S1 = dStart; } else if (dStart < Q1 && dEnd <= Q9) { nom = dEnd-Q1; } else if (dStart >= Q1 && dEnd <= Q9) { nom = dEnd-dStart; S1 = dStart; } */ //c0 = (255-2*extra)/nom; c0 = (255)/(dEnd-dStart); for(; x < dStart; ++x) LUT[x-min] = (byte) qDef.cdStart; for(; x < dEnd; ++x) { //if (x > Q1) { // if (x <= Q9) v = c0*(normalize.transform(x, 1)-S1)+extra; // else v = 255-extra; //} else v = extra; v = Approximation.nearestInteger( aNorm*(valueMapper.transform(v, k)-ysNorm)); v = Approximation.nearestInteger(a1*v+qDef.cdStart); LUT[x-min] = (byte) v; } for(; x <= max; ++x) LUT[x-min] = (byte) qDef.cdEnd; } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/de5b83ecccd54946c2125525e83cea40c4c4dd36/Quantization_8_16_bit.java/buggy/SRC/org/openmicroscopy/shoola/env/rnd/quantum/Quantization_8_16_bit.java |
QuantumMap normalize = new PolynomialMap(); int extra = 10; double S1 = dStart; double ysNorm = valueMapper.transform(0, k); double yeNorm = valueMapper.transform(255, k); double aNorm = qDef.bitResolution/(yeNorm-ysNorm); double v = extra; double c0; /* if (dStart >= Q1 && dEnd > Q9) { nom = (Q9-dStart); S1 = dStart; } else if (dStart < Q1 && dEnd <= Q9) { nom = dEnd-Q1; } else if (dStart >= Q1 && dEnd <= Q9) { nom = dEnd-dStart; S1 = dStart; } */ c0 = (255)/(dEnd-dStart); for(; x < dStart; ++x) LUT[x-min] = (byte) qDef.cdStart; | for(; x < dStart; ++x) LUT[x-min] = (byte) cdStart; | private void buildLUT() { if (LUT == null) init(); // Comparable assumed to be Integer //domain double dStart = getWindowStart(), dEnd = getWindowEnd(); double k = qDef.curveCoefficient; //double ys = valueMapper.transform(dStart, k); //double ye = valueMapper.transform(dEnd, k); //double a0 = qDef.bitResolution/(ye-ys); double a1 = (qDef.cdEnd-qDef.cdStart)/((double) qDef.bitResolution); int x = min; //Temporary, to come: "piece-wise rendering." QuantumMap normalize = new PolynomialMap(); int extra = 10; //double decile = (max-min)/(double) 10; //double Q1 = min+decile, Q9 = max-decile; double S1 = dStart; double ysNorm = valueMapper.transform(0, k); double yeNorm = valueMapper.transform(255, k); double aNorm = qDef.bitResolution/(yeNorm-ysNorm); double v = extra; double c0;//, nom = Q9-Q1; /* if (dStart >= Q1 && dEnd > Q9) { nom = (Q9-dStart); S1 = dStart; } else if (dStart < Q1 && dEnd <= Q9) { nom = dEnd-Q1; } else if (dStart >= Q1 && dEnd <= Q9) { nom = dEnd-dStart; S1 = dStart; } */ //c0 = (255-2*extra)/nom; c0 = (255)/(dEnd-dStart); for(; x < dStart; ++x) LUT[x-min] = (byte) qDef.cdStart; for(; x < dEnd; ++x) { //if (x > Q1) { // if (x <= Q9) v = c0*(normalize.transform(x, 1)-S1)+extra; // else v = 255-extra; //} else v = extra; v = Approximation.nearestInteger( aNorm*(valueMapper.transform(v, k)-ysNorm)); v = Approximation.nearestInteger(a1*v+qDef.cdStart); LUT[x-min] = (byte) v; } for(; x <= max; ++x) LUT[x-min] = (byte) qDef.cdEnd; } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/de5b83ecccd54946c2125525e83cea40c4c4dd36/Quantization_8_16_bit.java/buggy/SRC/org/openmicroscopy/shoola/env/rnd/quantum/Quantization_8_16_bit.java |
v = c0*(normalize.transform(x, 1)-S1)+extra; v = Approximation.nearestInteger( aNorm*(valueMapper.transform(v, k)-ysNorm)); v = Approximation.nearestInteger(a1*v+qDef.cdStart); LUT[x-min] = (byte) v; | if (x > Q1) { if (x <= Q9) v = c0*(normalize.transform(x, 1)-S1)+extra; else v = cdEnd; } else v = cdStart; v = Approximation.nearestInteger( aNorm*(valueMapper.transform(v, k)-ysNorm)); v = Approximation.nearestInteger(a1*v+qDef.cdStart); LUT[x-min] = (byte) v; | private void buildLUT() { if (LUT == null) init(); // Comparable assumed to be Integer //domain double dStart = getWindowStart(), dEnd = getWindowEnd(); double k = qDef.curveCoefficient; //double ys = valueMapper.transform(dStart, k); //double ye = valueMapper.transform(dEnd, k); //double a0 = qDef.bitResolution/(ye-ys); double a1 = (qDef.cdEnd-qDef.cdStart)/((double) qDef.bitResolution); int x = min; //Temporary, to come: "piece-wise rendering." QuantumMap normalize = new PolynomialMap(); int extra = 10; //double decile = (max-min)/(double) 10; //double Q1 = min+decile, Q9 = max-decile; double S1 = dStart; double ysNorm = valueMapper.transform(0, k); double yeNorm = valueMapper.transform(255, k); double aNorm = qDef.bitResolution/(yeNorm-ysNorm); double v = extra; double c0;//, nom = Q9-Q1; /* if (dStart >= Q1 && dEnd > Q9) { nom = (Q9-dStart); S1 = dStart; } else if (dStart < Q1 && dEnd <= Q9) { nom = dEnd-Q1; } else if (dStart >= Q1 && dEnd <= Q9) { nom = dEnd-dStart; S1 = dStart; } */ //c0 = (255-2*extra)/nom; c0 = (255)/(dEnd-dStart); for(; x < dStart; ++x) LUT[x-min] = (byte) qDef.cdStart; for(; x < dEnd; ++x) { //if (x > Q1) { // if (x <= Q9) v = c0*(normalize.transform(x, 1)-S1)+extra; // else v = 255-extra; //} else v = extra; v = Approximation.nearestInteger( aNorm*(valueMapper.transform(v, k)-ysNorm)); v = Approximation.nearestInteger(a1*v+qDef.cdStart); LUT[x-min] = (byte) v; } for(; x <= max; ++x) LUT[x-min] = (byte) qDef.cdEnd; } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/de5b83ecccd54946c2125525e83cea40c4c4dd36/Quantization_8_16_bit.java/buggy/SRC/org/openmicroscopy/shoola/env/rnd/quantum/Quantization_8_16_bit.java |
for(; x <= max; ++x) LUT[x-min] = (byte) qDef.cdEnd; | for(; x <= max; ++x) LUT[x-min] = (byte) cdEnd; | private void buildLUT() { if (LUT == null) init(); // Comparable assumed to be Integer //domain double dStart = getWindowStart(), dEnd = getWindowEnd(); double k = qDef.curveCoefficient; //double ys = valueMapper.transform(dStart, k); //double ye = valueMapper.transform(dEnd, k); //double a0 = qDef.bitResolution/(ye-ys); double a1 = (qDef.cdEnd-qDef.cdStart)/((double) qDef.bitResolution); int x = min; //Temporary, to come: "piece-wise rendering." QuantumMap normalize = new PolynomialMap(); int extra = 10; //double decile = (max-min)/(double) 10; //double Q1 = min+decile, Q9 = max-decile; double S1 = dStart; double ysNorm = valueMapper.transform(0, k); double yeNorm = valueMapper.transform(255, k); double aNorm = qDef.bitResolution/(yeNorm-ysNorm); double v = extra; double c0;//, nom = Q9-Q1; /* if (dStart >= Q1 && dEnd > Q9) { nom = (Q9-dStart); S1 = dStart; } else if (dStart < Q1 && dEnd <= Q9) { nom = dEnd-Q1; } else if (dStart >= Q1 && dEnd <= Q9) { nom = dEnd-dStart; S1 = dStart; } */ //c0 = (255-2*extra)/nom; c0 = (255)/(dEnd-dStart); for(; x < dStart; ++x) LUT[x-min] = (byte) qDef.cdStart; for(; x < dEnd; ++x) { //if (x > Q1) { // if (x <= Q9) v = c0*(normalize.transform(x, 1)-S1)+extra; // else v = 255-extra; //} else v = extra; v = Approximation.nearestInteger( aNorm*(valueMapper.transform(v, k)-ysNorm)); v = Approximation.nearestInteger(a1*v+qDef.cdStart); LUT[x-min] = (byte) v; } for(; x <= max; ++x) LUT[x-min] = (byte) qDef.cdEnd; } | 54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/de5b83ecccd54946c2125525e83cea40c4c4dd36/Quantization_8_16_bit.java/buggy/SRC/org/openmicroscopy/shoola/env/rnd/quantum/Quantization_8_16_bit.java |
if (!data.getName().equalsIgnoreCase("langpack")) | if (!"langpack".equalsIgnoreCase(data.getName())) | public void add(InputStream in) throws Exception { // Initialises the parser StdXMLParser parser = new StdXMLParser(); parser.setBuilder(new StdXMLBuilder()); parser.setReader(new StdXMLReader(in)); parser.setValidator(new NonValidator()); // We get the data XMLElement data = (XMLElement) parser.parse(); // We check the data if (!data.getName().equalsIgnoreCase("langpack")) throw new Exception("this is not an IzPack XML langpack file"); // We fill the Hashtable Vector children = data.getChildren(); int size = children.size(); for (int i = 0; i < size; i++) { XMLElement e = (XMLElement) children.get(i); String text = e.getContent(); if (text != null && !text.equals("")) { put(e.getAttribute("id"), text.trim()); } else { put(e.getAttribute("id"), e.getAttribute("txt")); } } } | 54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/9619b3a25f43787dc92011111668210e06c00c71/LocaleDatabase.java/clean/src/lib/com/izforge/izpack/LocaleDatabase.java |
if (text != null && !text.equals("")) | if (text != null && !"".equals(text)) | public void add(InputStream in) throws Exception { // Initialises the parser StdXMLParser parser = new StdXMLParser(); parser.setBuilder(new StdXMLBuilder()); parser.setReader(new StdXMLReader(in)); parser.setValidator(new NonValidator()); // We get the data XMLElement data = (XMLElement) parser.parse(); // We check the data if (!data.getName().equalsIgnoreCase("langpack")) throw new Exception("this is not an IzPack XML langpack file"); // We fill the Hashtable Vector children = data.getChildren(); int size = children.size(); for (int i = 0; i < size; i++) { XMLElement e = (XMLElement) children.get(i); String text = e.getContent(); if (text != null && !text.equals("")) { put(e.getAttribute("id"), text.trim()); } else { put(e.getAttribute("id"), e.getAttribute("txt")); } } } | 54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/9619b3a25f43787dc92011111668210e06c00c71/LocaleDatabase.java/clean/src/lib/com/izforge/izpack/LocaleDatabase.java |
public SoftLenderReference(Object referent) { | SoftLenderReference(final Object referent) { | public SoftLenderReference(Object referent) { super(referent); } | 50977 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50977/c533b17f67a27066967191311fa5512bef24cbc8/SoftLender.java/clean/src/java/org/apache/commons/pool/composite/SoftLender.java |
LinkedList pool = (LinkedList) (_poolMap.get(key)); | ObjectQueue pool = (ObjectQueue) (_poolMap.get(key)); | public synchronized void addObject(Object key) throws Exception { assertOpen(); if (_factory == null) { throw new IllegalStateException("Cannot add objects without a factory."); } Object obj = _factory.makeObject(key); // if we need to validate this object, do so boolean success = true; // whether or not this object passed validation if(_testOnReturn && !_factory.validateObject(key, obj)) { success = false; _factory.destroyObject(key, obj); } else { _factory.passivateObject(key, obj); } boolean shouldDestroy = false; // grab the pool (list) of objects associated with the given key LinkedList pool = (LinkedList) (_poolMap.get(key)); // if it doesn't exist, create it if(null == pool) { pool = new LinkedList(); _poolMap.put(key, pool); } // if there's no space in the pool, flag the object for destruction // else if we passivated succesfully, return it to the pool if(_maxIdle >= 0 && (pool.size() >= _maxIdle)) { shouldDestroy = true; } else if(success) { pool.addLast(new ObjectTimestampPair(obj)); _totalIdle++; } notifyAll(); if(shouldDestroy) { _factory.destroyObject(key, obj); } } | 50977 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50977/dca25ff99b1206e30015dfa1823600ce9b50b958/GenericKeyedObjectPool.java/buggy/src/java/org/apache/commons/pool/impl/GenericKeyedObjectPool.java |
pool = new LinkedList(); | pool = new ObjectQueue(); | public synchronized void addObject(Object key) throws Exception { assertOpen(); if (_factory == null) { throw new IllegalStateException("Cannot add objects without a factory."); } Object obj = _factory.makeObject(key); // if we need to validate this object, do so boolean success = true; // whether or not this object passed validation if(_testOnReturn && !_factory.validateObject(key, obj)) { success = false; _factory.destroyObject(key, obj); } else { _factory.passivateObject(key, obj); } boolean shouldDestroy = false; // grab the pool (list) of objects associated with the given key LinkedList pool = (LinkedList) (_poolMap.get(key)); // if it doesn't exist, create it if(null == pool) { pool = new LinkedList(); _poolMap.put(key, pool); } // if there's no space in the pool, flag the object for destruction // else if we passivated succesfully, return it to the pool if(_maxIdle >= 0 && (pool.size() >= _maxIdle)) { shouldDestroy = true; } else if(success) { pool.addLast(new ObjectTimestampPair(obj)); _totalIdle++; } notifyAll(); if(shouldDestroy) { _factory.destroyObject(key, obj); } } | 50977 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50977/dca25ff99b1206e30015dfa1823600ce9b50b958/GenericKeyedObjectPool.java/buggy/src/java/org/apache/commons/pool/impl/GenericKeyedObjectPool.java |
if(_maxIdle >= 0 && (pool.size() >= _maxIdle)) { | if(_maxIdle >= 0 && (pool.queue.size() >= _maxIdle)) { | public synchronized void addObject(Object key) throws Exception { assertOpen(); if (_factory == null) { throw new IllegalStateException("Cannot add objects without a factory."); } Object obj = _factory.makeObject(key); // if we need to validate this object, do so boolean success = true; // whether or not this object passed validation if(_testOnReturn && !_factory.validateObject(key, obj)) { success = false; _factory.destroyObject(key, obj); } else { _factory.passivateObject(key, obj); } boolean shouldDestroy = false; // grab the pool (list) of objects associated with the given key LinkedList pool = (LinkedList) (_poolMap.get(key)); // if it doesn't exist, create it if(null == pool) { pool = new LinkedList(); _poolMap.put(key, pool); } // if there's no space in the pool, flag the object for destruction // else if we passivated succesfully, return it to the pool if(_maxIdle >= 0 && (pool.size() >= _maxIdle)) { shouldDestroy = true; } else if(success) { pool.addLast(new ObjectTimestampPair(obj)); _totalIdle++; } notifyAll(); if(shouldDestroy) { _factory.destroyObject(key, obj); } } | 50977 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50977/dca25ff99b1206e30015dfa1823600ce9b50b958/GenericKeyedObjectPool.java/buggy/src/java/org/apache/commons/pool/impl/GenericKeyedObjectPool.java |
pool.addLast(new ObjectTimestampPair(obj)); | pool.queue.addLast(new ObjectTimestampPair(obj)); | public synchronized void addObject(Object key) throws Exception { assertOpen(); if (_factory == null) { throw new IllegalStateException("Cannot add objects without a factory."); } Object obj = _factory.makeObject(key); // if we need to validate this object, do so boolean success = true; // whether or not this object passed validation if(_testOnReturn && !_factory.validateObject(key, obj)) { success = false; _factory.destroyObject(key, obj); } else { _factory.passivateObject(key, obj); } boolean shouldDestroy = false; // grab the pool (list) of objects associated with the given key LinkedList pool = (LinkedList) (_poolMap.get(key)); // if it doesn't exist, create it if(null == pool) { pool = new LinkedList(); _poolMap.put(key, pool); } // if there's no space in the pool, flag the object for destruction // else if we passivated succesfully, return it to the pool if(_maxIdle >= 0 && (pool.size() >= _maxIdle)) { shouldDestroy = true; } else if(success) { pool.addLast(new ObjectTimestampPair(obj)); _totalIdle++; } notifyAll(); if(shouldDestroy) { _factory.destroyObject(key, obj); } } | 50977 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50977/dca25ff99b1206e30015dfa1823600ce9b50b958/GenericKeyedObjectPool.java/buggy/src/java/org/apache/commons/pool/impl/GenericKeyedObjectPool.java |
LinkedList pool = (LinkedList)(_poolMap.get(key)); | ObjectQueue pool = (ObjectQueue)(_poolMap.get(key)); | public synchronized Object borrowObject(Object key) throws Exception { assertOpen(); long starttime = System.currentTimeMillis(); boolean newlyCreated = false; for(;;) { LinkedList pool = (LinkedList)(_poolMap.get(key)); if(null == pool) { pool = new LinkedList(); _poolMap.put(key,pool); } 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 { // this code may be executed again after a notify then continue cycle // so, need to calculate the amount of time to wait final long elapsed = (System.currentTimeMillis() - starttime); final long waitTime = _maxWait - elapsed; if (waitTime > 0) { wait(waitTime); } } } 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."); } } } if (newlyCreated) { incrementActiveCount(key); return pair.value; } else { try { _factory.activateObject(key, pair.value); } catch (Exception e) { try { _factory.destroyObject(key,pair.value); } catch (Exception e2) { // swallowed } continue; } boolean invalid = true; try { invalid = _testOnBorrow && !_factory.validateObject(key, pair.value); } catch (Exception e) { // swallowed } if (invalid) { try { _factory.destroyObject(key,pair.value); } catch (Exception e) { // swallowed } 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/dca25ff99b1206e30015dfa1823600ce9b50b958/GenericKeyedObjectPool.java/buggy/src/java/org/apache/commons/pool/impl/GenericKeyedObjectPool.java |
pool = new LinkedList(); | pool = new ObjectQueue(); | public synchronized Object borrowObject(Object key) throws Exception { assertOpen(); long starttime = System.currentTimeMillis(); boolean newlyCreated = false; for(;;) { LinkedList pool = (LinkedList)(_poolMap.get(key)); if(null == pool) { pool = new LinkedList(); _poolMap.put(key,pool); } 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 { // this code may be executed again after a notify then continue cycle // so, need to calculate the amount of time to wait final long elapsed = (System.currentTimeMillis() - starttime); final long waitTime = _maxWait - elapsed; if (waitTime > 0) { wait(waitTime); } } } 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."); } } } if (newlyCreated) { incrementActiveCount(key); return pair.value; } else { try { _factory.activateObject(key, pair.value); } catch (Exception e) { try { _factory.destroyObject(key,pair.value); } catch (Exception e2) { // swallowed } continue; } boolean invalid = true; try { invalid = _testOnBorrow && !_factory.validateObject(key, pair.value); } catch (Exception e) { // swallowed } if (invalid) { try { _factory.destroyObject(key,pair.value); } catch (Exception e) { // swallowed } 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/dca25ff99b1206e30015dfa1823600ce9b50b958/GenericKeyedObjectPool.java/buggy/src/java/org/apache/commons/pool/impl/GenericKeyedObjectPool.java |
pair = (ObjectTimestampPair)(pool.removeFirst()); | pair = (ObjectTimestampPair)(pool.queue.removeFirst()); | public synchronized Object borrowObject(Object key) throws Exception { assertOpen(); long starttime = System.currentTimeMillis(); boolean newlyCreated = false; for(;;) { LinkedList pool = (LinkedList)(_poolMap.get(key)); if(null == pool) { pool = new LinkedList(); _poolMap.put(key,pool); } 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 { // this code may be executed again after a notify then continue cycle // so, need to calculate the amount of time to wait final long elapsed = (System.currentTimeMillis() - starttime); final long waitTime = _maxWait - elapsed; if (waitTime > 0) { wait(waitTime); } } } 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."); } } } if (newlyCreated) { incrementActiveCount(key); return pair.value; } else { try { _factory.activateObject(key, pair.value); } catch (Exception e) { try { _factory.destroyObject(key,pair.value); } catch (Exception e2) { // swallowed } continue; } boolean invalid = true; try { invalid = _testOnBorrow && !_factory.validateObject(key, pair.value); } catch (Exception e) { // swallowed } if (invalid) { try { _factory.destroyObject(key,pair.value); } catch (Exception e) { // swallowed } 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/dca25ff99b1206e30015dfa1823600ce9b50b958/GenericKeyedObjectPool.java/buggy/src/java/org/apache/commons/pool/impl/GenericKeyedObjectPool.java |
int active = getActiveCount(key); if ((_maxActive < 0 || active < _maxActive) && | if ((_maxActive < 0 || pool.activeCount < _maxActive) && | public synchronized Object borrowObject(Object key) throws Exception { assertOpen(); long starttime = System.currentTimeMillis(); boolean newlyCreated = false; for(;;) { LinkedList pool = (LinkedList)(_poolMap.get(key)); if(null == pool) { pool = new LinkedList(); _poolMap.put(key,pool); } 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 { // this code may be executed again after a notify then continue cycle // so, need to calculate the amount of time to wait final long elapsed = (System.currentTimeMillis() - starttime); final long waitTime = _maxWait - elapsed; if (waitTime > 0) { wait(waitTime); } } } 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."); } } } if (newlyCreated) { incrementActiveCount(key); return pair.value; } else { try { _factory.activateObject(key, pair.value); } catch (Exception e) { try { _factory.destroyObject(key,pair.value); } catch (Exception e2) { // swallowed } continue; } boolean invalid = true; try { invalid = _testOnBorrow && !_factory.validateObject(key, pair.value); } catch (Exception e) { // swallowed } if (invalid) { try { _factory.destroyObject(key,pair.value); } catch (Exception e) { // swallowed } 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/dca25ff99b1206e30015dfa1823600ce9b50b958/GenericKeyedObjectPool.java/buggy/src/java/org/apache/commons/pool/impl/GenericKeyedObjectPool.java |
incrementActiveCount(key); | pool.incrementActiveCount(); | public synchronized Object borrowObject(Object key) throws Exception { assertOpen(); long starttime = System.currentTimeMillis(); boolean newlyCreated = false; for(;;) { LinkedList pool = (LinkedList)(_poolMap.get(key)); if(null == pool) { pool = new LinkedList(); _poolMap.put(key,pool); } 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 { // this code may be executed again after a notify then continue cycle // so, need to calculate the amount of time to wait final long elapsed = (System.currentTimeMillis() - starttime); final long waitTime = _maxWait - elapsed; if (waitTime > 0) { wait(waitTime); } } } 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."); } } } if (newlyCreated) { incrementActiveCount(key); return pair.value; } else { try { _factory.activateObject(key, pair.value); } catch (Exception e) { try { _factory.destroyObject(key,pair.value); } catch (Exception e2) { // swallowed } continue; } boolean invalid = true; try { invalid = _testOnBorrow && !_factory.validateObject(key, pair.value); } catch (Exception e) { // swallowed } if (invalid) { try { _factory.destroyObject(key,pair.value); } catch (Exception e) { // swallowed } 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/dca25ff99b1206e30015dfa1823600ce9b50b958/GenericKeyedObjectPool.java/buggy/src/java/org/apache/commons/pool/impl/GenericKeyedObjectPool.java |
incrementActiveCount(key); | pool.incrementActiveCount(); | public synchronized Object borrowObject(Object key) throws Exception { assertOpen(); long starttime = System.currentTimeMillis(); boolean newlyCreated = false; for(;;) { LinkedList pool = (LinkedList)(_poolMap.get(key)); if(null == pool) { pool = new LinkedList(); _poolMap.put(key,pool); } 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 { // this code may be executed again after a notify then continue cycle // so, need to calculate the amount of time to wait final long elapsed = (System.currentTimeMillis() - starttime); final long waitTime = _maxWait - elapsed; if (waitTime > 0) { wait(waitTime); } } } 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."); } } } if (newlyCreated) { incrementActiveCount(key); return pair.value; } else { try { _factory.activateObject(key, pair.value); } catch (Exception e) { try { _factory.destroyObject(key,pair.value); } catch (Exception e2) { // swallowed } continue; } boolean invalid = true; try { invalid = _testOnBorrow && !_factory.validateObject(key, pair.value); } catch (Exception e) { // swallowed } if (invalid) { try { _factory.destroyObject(key,pair.value); } catch (Exception e) { // swallowed } 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/dca25ff99b1206e30015dfa1823600ce9b50b958/GenericKeyedObjectPool.java/buggy/src/java/org/apache/commons/pool/impl/GenericKeyedObjectPool.java |
for(Iterator keyiter = _poolMap.keySet().iterator(); keyiter.hasNext(); ) { Object key = keyiter.next(); final LinkedList list = (LinkedList)(_poolMap.get(key)); | for(Iterator entries = _poolMap.entrySet().iterator(); entries.hasNext(); ) { final Map.Entry entry = (Map.Entry)entries.next(); final Object key = entry.getKey(); final LinkedList list = ((ObjectQueue)(entry.getValue())).queue; | public synchronized void clear() { for(Iterator keyiter = _poolMap.keySet().iterator(); keyiter.hasNext(); ) { Object key = keyiter.next(); final LinkedList list = (LinkedList)(_poolMap.get(key)); for(Iterator it = list.iterator(); it.hasNext(); ) { try { _factory.destroyObject(key,((ObjectTimestampPair)(it.next())).value); } catch(Exception e) { // ignore error, keep destroying the rest } it.remove(); } } _poolMap.clear(); if (_recentlyEvictedKeys != null) { _recentlyEvictedKeys.clear(); } _totalIdle = 0; notifyAll(); } | 50977 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50977/dca25ff99b1206e30015dfa1823600ce9b50b958/GenericKeyedObjectPool.java/buggy/src/java/org/apache/commons/pool/impl/GenericKeyedObjectPool.java |