rem
stringlengths
0
477k
add
stringlengths
0
313k
context
stringlengths
6
599k
meta
stringlengths
141
403
add(buildPane());
JPanel p = new JPanel(); p.setLayout(new BoxLayout(p,BoxLayout.X_AXIS)); p.add(buildPane()); p.add(Box.createHorizontalStrut(300)); add(p);
private void buildGUI() { setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); add(buildChannelGraphicsPanel()); add(new JSeparator()); add(buildControlsPane()); add(new JSeparator()); add(buildPane()); }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/92bd844fee03c4496453b9b6e7ea9a6ca15d6b80/DomainPane.java/buggy/SRC/org/openmicroscopy/shoola/agents/imviewer/rnd/DomainPane.java
p.setLayout(new BoxLayout(p,BoxLayout.Y_AXIS)); p.add(noiseReduction); p.add(histogramButton);
p.setLayout(new GridBagLayout()); GridBagConstraints c = new GridBagConstraints(); c.anchor = GridBagConstraints.WEST; c.gridy = 0; p.add(noiseReduction,c); c.gridy = 1; p.add(histogramButton,c);
private JPanel buildPane() { JPanel p = new JPanel(); p.setLayout(new BoxLayout(p,BoxLayout.Y_AXIS)); p.add(noiseReduction); p.add(histogramButton); return p; }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/92bd844fee03c4496453b9b6e7ea9a6ca15d6b80/DomainPane.java/buggy/SRC/org/openmicroscopy/shoola/agents/imviewer/rnd/DomainPane.java
loader = new CGCILoader(this, hiViewer, images); break; case HiViewerCtrl.VIEW_IN_CGCI:
void viewHierarchy(Set images, int index) { HiViewerUIF presentation = HiViewerUIF.getInstance(control); HiViewer hiViewer = presentation.createHiViewer(); HiLoader loader = null; switch (index) { case HiViewerCtrl.VIEW_IN_PDI: loader = new CGCILoader(this, hiViewer, images); break; case HiViewerCtrl.VIEW_IN_CGCI: loader = new PDILoader(this, hiViewer, images); } if (loader != null) loader.load(); }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/2125d7fe444a1cd9d825bd04cbd56510a5a7838b/HiViewerAgent.java/clean/SRC/org/openmicroscopy/shoola/agents/hiviewer/HiViewerAgent.java
generateThirdBodyReactionList(p_reactionModel, p_beginStatus, p_temperature, p_pressure);
public SystemSnapshot solve(boolean p_initialization, ReactionModel p_reactionModel, boolean p_reactionChanged, SystemSnapshot p_beginStatus, ReactionTime p_beginTime, ReactionTime p_endTime, Temperature p_temperature, Pressure p_pressure, boolean p_conditionChanged) { //#[ operation solve(boolean,ReactionModel,boolean,SystemSnapshot,ReactionTime,ReactionTime,Temperature,Pressure,boolean) ReactionTime rt = p_beginStatus.getTime(); if (!rt.equals(p_beginTime)) throw new InvalidBeginStatusException(); // set time double tBegin = p_beginTime.getStandardTime(); double tEnd = p_endTime.getStandardTime(); // set reaction set //if (p_initialization || p_reactionChanged || p_conditionChanged) { generateThirdBodyReactionList(p_reactionModel, p_beginStatus, p_temperature, p_pressure); LinkedList rList = generatePDepODEReactionList(p_reactionModel, p_beginStatus, p_temperature, p_pressure); //generateAllODEReactionList(p_reactionModel, p_beginStatus, p_temperature, p_pressure); //p_reactionChanged = true; //} // set numbers System.out.println("Total number of reactions to Daspk is "+rList.size()); int nState = p_reactionModel.getSpeciesNumber(); int nParameter = 0; LinkedList initialSpecies = new LinkedList();// if (parameterInfor!=null) nParameter = parameterInfor.length; if (parameterInfor != 0) { nParameter = rList.size(); //svp if (initialStatus == null) System.out.println("initialStatus = null"); Iterator spe_iter = initialStatus.getSpeciesStatus(); while (spe_iter.hasNext()) { SpeciesStatus ss = (SpeciesStatus) spe_iter.next(); String name = ss.getSpecies().getName(); initialSpecies.add(name); nParameter++; } } int neq = nState*(nParameter+1); // set temperature and pressure double T = p_temperature.getK(); double P = p_pressure.getAtm(); // set initial value of y and yprime; double [] y = new double[neq]; double [] yprime = new double[neq]; //double numberOfReactedSpecies=0; // get the present status at t_begin, and set y and y' accordingly System.out.println("Before ODE: " + String.valueOf(tBegin) + "SEC"); System.out.println("End at : " + String.valueOf(tEnd) + "SEC"); for (Iterator iter = p_beginStatus.getSpeciesStatus(); iter.hasNext(); ) { SpeciesStatus ss = (SpeciesStatus)iter.next(); double conc = ss.getConcentration(); double flux = ss.getFlux(); if (ss.isReactedSpecies()) { Species spe = ss.getSpecies(); int id = getRealID(spe); System.out.println(String.valueOf(spe.getID()) + '\t' + spe.getName() + '\t' + String.valueOf(conc) + '\t' + String.valueOf(flux)); y[id-1] = conc; yprime[id-1] = flux; } } if (nParameter != 0){//svp parameterInforArray = new ParameterInfor[nParameter]; for (int i = 1; i <= rList.size(); i++){ parameterInforArray[i-1] = new ParameterInfor("k",i,0.00); } for (int i=rList.size()+1; i<=nParameter;i++){ parameterInforArray[i - 1] = new ParameterInfor("CO", nParameter, 0.00); } if (p_beginTime.getTime() == 0 || p_beginTime.getTime() == 0.00) { LinkedList sensitivityStatus = new LinkedList(); int reactionNumber = rList.size(); int speciesNumber = p_reactionModel.getSpeciesNumber();// for (int i=0;i<reactionNumber*speciesNumber;i++){ for (int i=0; i<nParameter*speciesNumber;i++){ sensitivityStatus.add(i,null); } p_beginStatus.addSensitivity(sensitivityStatus); double sflux = 1; Iterator species_iter = p_reactionModel.getSpecies(); while (species_iter.hasNext()) { Species spe = (Species) species_iter.next(); int m = getRealID(spe); for (int p=0;p<nParameter;p++){ int k = m + (p+1) * speciesNumber - 1; if (p >= rList.size()){ int speciesNum = p-rList.size(); String name = (String)initialSpecies.get(speciesNum); sflux = 0; SensitivityStatus senStatus; if (name.equalsIgnoreCase(spe.getName())){ senStatus = new SensitivityStatus(1, sflux, m, p + 1); y[k] = 1; } else{ senStatus = new SensitivityStatus(0,sflux,m,p+1); y[k]=0; } sensitivityStatus.add(k - p_reactionModel.getSpeciesNumber(), senStatus); p_beginStatus.putSensitivityStatus(k - speciesNumber, senStatus); yprime[k] = sflux; } else{ Reaction rxn = (Reaction)rList.get(p); if (rxn.containsAsProduct(spe)) { sflux = 1; Iterator new_iter = rxn.getReactants(); while (new_iter.hasNext()) { ChemGraph cg = (ChemGraph) new_iter.next(); Species reactant = cg.getSpecies(); SpeciesStatus ss = p_beginStatus.getSpeciesStatus(reactant); if (ss != null) { sflux *= ss.getConcentration(); } else { sflux = 0; } } } if (rxn.containsAsReactant(spe)) { sflux = -1; Iterator new_iter = rxn.getReactants(); while (new_iter.hasNext()) { ChemGraph cg = (ChemGraph) new_iter.next(); Species reactant = cg.getSpecies(); SpeciesStatus ss = p_beginStatus.getSpeciesStatus(reactant); if (ss != null) { sflux *= ss.getConcentration(); } else { sflux = 0; } } } else { sflux = 0; } SensitivityStatus senStatus = new SensitivityStatus(0, sflux, m, p+1); sensitivityStatus.add(k-p_reactionModel.getSpeciesNumber(),senStatus); p_beginStatus.putSensitivityStatus(k-speciesNumber,senStatus); y[k] = 0; yprime[k] = sflux; } } } } else { for (int i = p_reactionModel.getSpeciesNumber(); i < y.length; i++) { SensitivityStatus ss = (SensitivityStatus) p_beginStatus. getSensitivityStatus(i-p_reactionModel.getSpeciesNumber()); double sens = ss.getSensitivity(); double sflux = ss.getSFlux(); int reactionNumber = rList.size(); int speciesNumber = p_reactionModel.getSpeciesNumber(); Iterator species_iter = p_reactionModel.getSpecies(); y[i] = sens; yprime[i] = sflux; } } } //System.out.println("Number of Reacted Species is " + numberOfReactedSpecies); int idid; HashMap speStatus = new HashMap(); LinkedList senStatus = new LinkedList(); double[] tPresent = {tBegin}; int temp = 1; if (nParameter==0) { idid = solveDAE(p_initialization, reactionList, true, thirdBodyReactionList, nState, y, yprime, tBegin, tEnd, this.rtol, this.atol, T, P); if (idid !=1 && idid != 2 && idid != 3) { System.out.println("The idid from DASPK was "+idid + " at time "+tPresent[0]); throw new DynamicSimulatorException("DASPK: SA off."); } System.out.println("After ODE: from " + String.valueOf(tBegin) + " SEC to " + String.valueOf(tEnd) + "SEC"); speStatus = generateSpeciesStatus(p_reactionModel, y, yprime, 0); } else { idid = solveSEN(p_initialization, reactionList, p_reactionChanged, thirdBodyReactionList, nState, nParameter, this.parameterInforArray, y, yprime, tBegin, tEnd, this.rtol, this.atol, T, P); if (idid != 2 && idid != 3) throw new DynamicSimulatorException("DASPK: SA on."); //speStatus = generateSpeciesStatus(p_reactionModel, y, yprime, nParameter); System.out.println("After ODE: from " + String.valueOf(tBegin) + " SEC to " + String.valueOf(tEnd) + "SEC"); speStatus = generateSpeciesStatus(p_reactionModel, y, yprime, nParameter); senStatus = generateSensitivityStatus(p_reactionModel,y,yprime,nParameter); SystemSnapshot sss = new SystemSnapshot(p_endTime, speStatus, senStatus, p_beginStatus.getTemperature(), p_beginStatus.getPressure()); sss.setIDTranslator(IDTranslator); sss.setReactionList(rList); return sss; } SystemSnapshot sss = new SystemSnapshot(p_endTime, speStatus, p_beginStatus.getTemperature(), p_beginStatus.getPressure()); //ReactionSystem.outputAllPathways(SpeciesDictionary.getSpeciesFromName("CH4"), rList, sss, p_temperature); //ReactionSystem.outputAllPathways(SpeciesDictionary.getSpeciesFromName("CO"), rList, sss, p_temperature); //ReactionSystem.outputAllPathways(SpeciesDictionary.getSpeciesFromName("CO2"), rList, sss, p_temperature); return sss; //#] }
58381 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/58381/9dc104b3931f207af6b026202fbbd03d0a0acba3/JDASPK.java/buggy/jing/rxnSys/JDASPK.java
public synchronized Object borrowObject(Object key) throws Exception { 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."); } } } _factory.activateObject(key,pair.value); if(_testOnBorrow && !_factory.validateObject(key,pair.value)) { _factory.destroyObject(key,pair.value); if(newlyCreated) { throw new NoSuchElementException("Could not create a validated object"); } // else keep looping } else { incrementActiveCount(key); return pair.value; } } }
50977 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50977/516c9aa5009c37143c3c518d5296e57c866d4d29/GenericKeyedObjectPool.java/clean/src/java/org/apache/commons/pool/impl/GenericKeyedObjectPool.java
} else if(_testWhileIdle) {
} if(_testWhileIdle && removeObject == false) {
public synchronized void evict() throws Exception { Object key = null; if (_recentlyEvictedKeys == null) { _recentlyEvictedKeys = new HashSet(_poolMap.size()); } Set remainingKeys = new HashSet(_poolMap.keySet()); remainingKeys.removeAll(_recentlyEvictedKeys); Iterator keyIter = remainingKeys.iterator(); ListIterator objIter = null; for(int i=0,m=getNumTests();i<m;i++) { if(_poolMap.size() > 0) { // Find next idle object pool key to work on if (key == null) { if (!keyIter.hasNext()) { _recentlyEvictedKeys.clear(); remainingKeys = new HashSet(_poolMap.keySet()); keyIter = remainingKeys.iterator(); } if (!keyIter.hasNext()) { // done, there are no keyed pools return; } key = keyIter.next(); } // if we don't have a keyed object pool iterator if (objIter == null) { final LinkedList list = (LinkedList)_poolMap.get(key); if (_evictLastIndex < 0 || _evictLastIndex > list.size()) { _evictLastIndex = list.size(); } objIter = list.listIterator(_evictLastIndex); } // if the _evictionCursor has a previous object, then test it if(objIter.hasPrevious()) { ObjectTimestampPair pair = (ObjectTimestampPair)(objIter.previous()); boolean removeObject=false; if(_minEvictableIdleTimeMillis > 0 && System.currentTimeMillis() - pair.tstamp > _minEvictableIdleTimeMillis) { removeObject=true; } else if(_testWhileIdle) { boolean active = false; try { _factory.activateObject(key,pair.value); active = true; } catch(Exception e) { removeObject=true; } if(active) { if(!_factory.validateObject(key,pair.value)) { removeObject=true; } else { try { _factory.passivateObject(key,pair.value); } catch(Exception e) { removeObject=true; } } } } if(removeObject) { try { objIter.remove(); _totalIdle--; _factory.destroyObject(key,pair.value); // Do not remove the key from the _poolList or _poolmap, even if the list // stored in the _poolMap for this key is empty when the // {@link #getMinIdle <i>minIdle</i>} is > 0. // // Otherwise if it was the last object for that key, drop that pool if ((_minIdle == 0) && (((LinkedList)(_poolMap.get(key))).isEmpty())) { _poolMap.remove(key); } } catch(Exception e) { ; // ignored } } } else { // else done evicting keyed pool _recentlyEvictedKeys.add(key); _evictLastIndex = -1; objIter = null; } } } }
50977 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50977/516c9aa5009c37143c3c518d5296e57c866d4d29/GenericKeyedObjectPool.java/clean/src/java/org/apache/commons/pool/impl/GenericKeyedObjectPool.java
data.createForAll = new Boolean(shortcutSpec.getAttribute(CREATE_FOR_ALL, "false"));
data.createForAll = Boolean.valueOf(shortcutSpec.getAttribute(CREATE_FOR_ALL, "false"));
private void analyzeShortcutSpec() { if (!haveShortcutSpec) { shortcutsToCreate = false; return; } XMLElement skipper = spec.getFirstChildNamed(SPEC_KEY_SKIP_IFNOT_SUPPORTED); skipIfNotSupported = (skipper != null); // ---------------------------------------------------- // find out if we should simulate a not supported // scenario // ---------------------------------------------------- XMLElement support = spec.getFirstChildNamed(SPEC_KEY_NOT_SUPPORTED); if (support != null) { simulteNotSupported = true; } // ---------------------------------------------------- // find out in which program group the shortcuts should // be placed and where this program group should be // located // ---------------------------------------------------- XMLElement group = spec.getFirstChildNamed(SPEC_KEY_PROGRAM_GROUP); String location = null; hasDesktopShortcuts = false; if (group != null) { suggestedProgramGroup = group.getAttribute(SPEC_ATTRIBUTE_DEFAULT_GROUP, ""); location = group.getAttribute(SPEC_ATTRIBUTE_LOCATION, SPEC_VALUE_APPLICATIONS); } else { suggestedProgramGroup = ""; location = SPEC_VALUE_APPLICATIONS; } if (location.equals(SPEC_VALUE_APPLICATIONS)) { groupLocation = Shortcut.APPLICATIONS; } else if (location.equals(SPEC_VALUE_START_MENU)) { groupLocation = Shortcut.START_MENU; } // ---------------------------------------------------- // create a list of all shortcuts that need to be // created, containing all details about each shortcut // ---------------------------------------------------- VariableSubstitutor substitutor = new VariableSubstitutor(idata.getVariables()); String temp; Vector shortcutSpecs = spec.getChildrenNamed(SPEC_KEY_SHORTCUT); XMLElement shortcutSpec; ShortcutData data; for (int i = 0; i < shortcutSpecs.size(); i++) { shortcutSpec = (XMLElement) shortcutSpecs.elementAt(i); if (!OsConstraint.oneMatchesCurrentSystem(shortcutSpec)) continue; data = new ShortcutData(); data.name = shortcutSpec.getAttribute(SPEC_ATTRIBUTE_NAME); data.subgroup = shortcutSpec.getAttribute(SPEC_ATTRIBUTE_SUBGROUP); data.description = shortcutSpec.getAttribute(SPEC_ATTRIBUTE_DESCRIPTION, ""); //** Linux **// data.deskTopEntryLinux_Encoding = shortcutSpec .getAttribute(SPEC_ATTRIBUTE_ENCODING, ""); data.deskTopEntryLinux_MimeType = shortcutSpec .getAttribute(SPEC_ATTRIBUTE_MIMETYPE, ""); data.deskTopEntryLinux_Terminal = shortcutSpec .getAttribute(SPEC_ATTRIBUTE_TERMINAL, ""); data.deskTopEntryLinux_TerminalOptions = shortcutSpec.getAttribute( SPEC_ATTRIBUTE_TERMINAL_OPTIONS, ""); data.deskTopEntryLinux_Type = shortcutSpec.getAttribute(SPEC_ATTRIBUTE_TYPE, ""); data.deskTopEntryLinux_URL = substitutor.substitute(shortcutSpec.getAttribute( SPEC_ATTRIBUTE_URL, ""), null); data.deskTopEntryLinux_X_KDE_SubstituteUID = shortcutSpec.getAttribute( SPEC_ATTRIBUTE_KDE_SUBST_UID, ""); data.createForAll = new Boolean(shortcutSpec.getAttribute(CREATE_FOR_ALL, "false")); //** EndOf LINUX **// temp = fixSeparatorChar(shortcutSpec.getAttribute(SPEC_ATTRIBUTE_TARGET, "")); data.target = substitutor.substitute(temp, null); temp = shortcutSpec.getAttribute(SPEC_ATTRIBUTE_COMMAND, ""); data.commandLine = substitutor.substitute(temp, null); temp = fixSeparatorChar(shortcutSpec.getAttribute(SPEC_ATTRIBUTE_ICON, "")); data.iconFile = substitutor.substitute(temp, null); data.iconIndex = Integer.parseInt(shortcutSpec.getAttribute(SPEC_ATTRIBUTE_ICON_INDEX, "0")); temp = fixSeparatorChar(shortcutSpec.getAttribute(SPEC_ATTRIBUTE_WORKING_DIR, "")); data.workingDirectory = substitutor.substitute(temp, null); String initialState = shortcutSpec.getAttribute(SPEC_ATTRIBUTE_INITIAL_STATE, ""); if (initialState.equals(SPEC_VALUE_NO_SHOW)) { data.initialState = Shortcut.HIDE; } else if (initialState.equals(SPEC_VALUE_NORMAL)) { data.initialState = Shortcut.NORMAL; } else if (initialState.equals(SPEC_VALUE_MAXIMIZED)) { data.initialState = Shortcut.MAXIMIZED; } else if (initialState.equals(SPEC_VALUE_MINIMIZED)) { data.initialState = Shortcut.MINIMIZED; } else { data.initialState = Shortcut.NORMAL; } // -------------------------------------------------- // if the minimal data requirements are met to create // the shortcut, create one entry each for each of // the requested types. // Eventually this will cause the creation of one // shortcut in each of the associated locations. // -------------------------------------------------- // without a name we can not create a shortcut if (data.name == null) { continue; } //1. Elmar: "Without a target we can not create a shortcut." //2. Marc: "No, Even on Linux a Link can be an URL and has no target." if (data.target == null) { continue; } // the shortcut is not actually required for any of the selected packs Vector forPacks = shortcutSpec.getChildrenNamed(SPEC_KEY_PACKS); if (!shortcutRequiredFor(forPacks)) { continue; } // -------------------------------------------------- // This section is executed if we don't skip. // -------------------------------------------------- // For each of the categories set the type and if // the link should be placed in the program group, // then clone the data set to obtain an independent // instance and add this to the list of shortcuts // to be created. In this way, we will set up an // identical copy for each of the locations at which // a shortcut should be placed. Therefore you must // not use 'else if' statements! // -------------------------------------------------- { if (attributeIsTrue(shortcutSpec, SPEC_ATTRIBUTE_DESKTOP)) { hasDesktopShortcuts = true; data.addToGroup = false; data.type = Shortcut.DESKTOP; shortcuts.add(data.clone()); } if (attributeIsTrue(shortcutSpec, SPEC_ATTRIBUTE_APPLICATIONS)) { data.addToGroup = false; data.type = Shortcut.APPLICATIONS; shortcuts.add(data.clone()); } if (attributeIsTrue(shortcutSpec, SPEC_ATTRIBUTE_START_MENU)) { data.addToGroup = false; data.type = Shortcut.START_MENU; shortcuts.add(data.clone()); } if (attributeIsTrue(shortcutSpec, SPEC_ATTRIBUTE_STARTUP)) { data.addToGroup = false; data.type = Shortcut.START_UP; shortcuts.add(data.clone()); } if (attributeIsTrue(shortcutSpec, SPEC_ATTRIBUTE_PROGRAM_GROUP)) { data.addToGroup = true; data.type = Shortcut.APPLICATIONS; shortcuts.add(data.clone()); } } } // ---------------------------------------------------- // signal if there are any shortcuts to create // ---------------------------------------------------- if (shortcuts.size() > 0) { shortcutsToCreate = true; } }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/9619b3a25f43787dc92011111668210e06c00c71/ShortcutPanel.java/clean/src/lib/com/izforge/izpack/panels/ShortcutPanel.java
if (value.equals("YES"))
if ("YES".equals(value))
private boolean attributeIsTrue(XMLElement element, String name) { String value = element.getAttribute(name, "").toUpperCase(); if (value.equals("YES")) { return (true); } else if (value.equals("TRUE")) { return (true); } else if (value.equals("ON")) { return (true); } else if (value.equals("1")) { return (true); } return (false); }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/9619b3a25f43787dc92011111668210e06c00c71/ShortcutPanel.java/clean/src/lib/com/izforge/izpack/panels/ShortcutPanel.java
else if (value.equals("TRUE"))
else if ("TRUE".equals(value))
private boolean attributeIsTrue(XMLElement element, String name) { String value = element.getAttribute(name, "").toUpperCase(); if (value.equals("YES")) { return (true); } else if (value.equals("TRUE")) { return (true); } else if (value.equals("ON")) { return (true); } else if (value.equals("1")) { return (true); } return (false); }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/9619b3a25f43787dc92011111668210e06c00c71/ShortcutPanel.java/clean/src/lib/com/izforge/izpack/panels/ShortcutPanel.java
else if (value.equals("ON"))
else if ("ON".equals(value))
private boolean attributeIsTrue(XMLElement element, String name) { String value = element.getAttribute(name, "").toUpperCase(); if (value.equals("YES")) { return (true); } else if (value.equals("TRUE")) { return (true); } else if (value.equals("ON")) { return (true); } else if (value.equals("1")) { return (true); } return (false); }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/9619b3a25f43787dc92011111668210e06c00c71/ShortcutPanel.java/clean/src/lib/com/izforge/izpack/panels/ShortcutPanel.java
else if (value.equals("1")) { return (true); }
else if ("1".equals(value)) { return (true); }
private boolean attributeIsTrue(XMLElement element, String name) { String value = element.getAttribute(name, "").toUpperCase(); if (value.equals("YES")) { return (true); } else if (value.equals("TRUE")) { return (true); } else if (value.equals("ON")) { return (true); } else if (value.equals("1")) { return (true); } return (false); }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/9619b3a25f43787dc92011111668210e06c00c71/ShortcutPanel.java/clean/src/lib/com/izforge/izpack/panels/ShortcutPanel.java
targetList = new JList(targets);
JList targetList = new JList(targets);
private void buildAlternateUI() { layout = new GridBagLayout(); constraints = new GridBagConstraints(); setLayout(layout); // ---------------------------------------------------- // static text a the top of the panel, that apologizes // about the fact that we can not create shortcuts on // this particular target OS. // ---------------------------------------------------- MultiLineLabel apologyLabel = new MultiLineLabel(parent.langpack .getString("ShortcutPanel.alternate.apology"), 0, 0); constraints.gridx = 0; constraints.gridy = 0; constraints.gridwidth = 1; constraints.gridheight = 1; constraints.weightx = 1.0; constraints.weighty = 1.0; constraints.insets = new Insets(5, 5, 5, 5); constraints.fill = GridBagConstraints.HORIZONTAL; constraints.anchor = GridBagConstraints.WEST; layout.addLayoutComponent(apologyLabel, constraints); add(apologyLabel); // ---------------------------------------------------- // label that explains the significance ot the list box // ---------------------------------------------------- MultiLineLabel listLabel = new MultiLineLabel(parent.langpack .getString("ShortcutPanel.alternate.targetsLabel"), 0, 0); constraints.gridx = 0; constraints.gridy = 1; constraints.gridwidth = 1; constraints.gridheight = 1; constraints.weightx = 1.0; constraints.weighty = 1.0; layout.addLayoutComponent(listLabel, constraints); add(listLabel); // ---------------------------------------------------- // list box to list all of the intended shortcut targets // ---------------------------------------------------- Vector targets = new Vector(); for (int i = 0; i < shortcuts.size(); i++) { targets.add(((ShortcutData) shortcuts.elementAt(i)).target); } targetList = new JList(targets); JScrollPane scrollPane = new JScrollPane(targetList); constraints.gridx = 0; constraints.gridy = 2; constraints.fill = GridBagConstraints.BOTH; layout.addLayoutComponent(scrollPane, constraints); add(scrollPane); // ---------------------------------------------------- // static text that explains about the text file // ---------------------------------------------------- MultiLineLabel fileExplanation = new MultiLineLabel(parent.langpack .getString("ShortcutPanel.alternate.textFileExplanation"), 0, 0); constraints.gridx = 0; constraints.gridy = 3; constraints.weightx = 1.0; constraints.weighty = 1.0; constraints.fill = GridBagConstraints.HORIZONTAL; layout.addLayoutComponent(fileExplanation, constraints); add(fileExplanation); // ---------------------------------------------------- // button to save the text file // ---------------------------------------------------- saveButton = ButtonFactory.createButton(parent.langpack .getString("ShortcutPanel.alternate.saveButton"), idata.buttonsHColor); saveButton.addActionListener(this); constraints.gridx = 0; constraints.gridy = 4; constraints.gridwidth = 1; constraints.gridheight = 1; constraints.fill = GridBagConstraints.NONE; constraints.anchor = GridBagConstraints.CENTER; layout.addLayoutComponent(saveButton, constraints); add(saveButton); }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/9619b3a25f43787dc92011111668210e06c00c71/ShortcutPanel.java/clean/src/lib/com/izforge/izpack/panels/ShortcutPanel.java
itsProgramFolder = groups;
File itsProgramFolder = groups;
private void buildUI(File groups) { itsProgramFolder = groups; constraints.gridx = 0; constraints.gridy = 0; constraints.gridwidth = 3; constraints.gridheight = 1; constraints.weightx = 1.0; constraints.weighty = 1.0; constraints.fill = GridBagConstraints.HORIZONTAL; constraints.anchor = GridBagConstraints.WEST; /**/ // Add a CheckBox which enables the user to entirely supress shortcut creation. String menuKind = parent.langpack.getString("ShortcutPanel.regular.StartMenu:Start-Menu"); if( OsVersion.IS_UNIX && UnixHelper.kdeIsInstalled() ) menuKind = parent.langpack.getString("ShortcutPanel.regular.StartMenu:K-Menu"); createShortcuts = new JCheckBox( StringTool.replace( parent.langpack.getString("ShortcutPanel.regular.create"), "StartMenu", menuKind ), true); createShortcuts.addActionListener(this); constraints.gridx = 0; constraints.gridy = 1; constraints.gridwidth = 2; constraints.gridheight = 1; constraints.weighty = 0.2; layout.addLayoutComponent(createShortcuts, constraints); add(createShortcuts); // ---------------------------------------------------- // check box to allow the user to decide if a desktop // shortcut should be created. // this should only be created if needed and requested // in the definition file. // ---------------------------------------------------- if (hasDesktopShortcuts) { String initialAllowedValue = idata.getVariable( "DesktopShortcutCheckboxEnabled" ); boolean initialAllowedFlag = false; if( initialAllowedValue==null) initialAllowedFlag= false; else if( Boolean.TRUE.toString().equals(initialAllowedValue) ) initialAllowedFlag=true; allowDesktopShortcut = new JCheckBox(parent.langpack .getString("ShortcutPanel.regular.desktop"), initialAllowedFlag); constraints.gridx = 0; constraints.gridy = 2; constraints.gridwidth = 3; constraints.gridheight = 1; constraints.weighty = 0.2; layout.addLayoutComponent(allowDesktopShortcut, constraints); add(allowDesktopShortcut); } listLabel = LabelFactory.create(parent.langpack.getString("ShortcutPanel.regular.list"), JLabel.LEADING); constraints.gridx = 0; constraints.gridy = 3; constraints.gridwidth = 1; constraints.gridheight = 1; constraints.weightx = 0.2; constraints.weighty = 0.2; constraints.fill = GridBagConstraints.NONE; constraints.anchor = GridBagConstraints.WEST; layout.addLayoutComponent(listLabel, constraints); add(listLabel); // ---------------------------------------------------- // list box to list all of already existing folders as program groups // at the intended destination // ---------------------------------------------------- addSelectionList( groups, 0, 4, 2, 1, GridBagConstraints.BOTH ); // ---------------------------------------------------- // radio buttons to select current user or all users. // ---------------------------------------------------- if (shortcut.multipleUsers()) { JPanel usersPanel = new JPanel(new GridLayout(2, 1)); ButtonGroup usersGroup = new ButtonGroup(); currentUser = new JRadioButton(parent.langpack .getString("ShortcutPanel.regular.currentUser"), !isRootUser); currentUser.addActionListener(this); usersGroup.add(currentUser); usersPanel.add(currentUser); allUsers = new JRadioButton( parent.langpack.getString("ShortcutPanel.regular.allUsers"), isRootUser); if (!isRootUser) allUsers.setEnabled(false); allUsers.addActionListener(this); usersGroup.add(allUsers); usersPanel.add(allUsers); TitledBorder border = new TitledBorder(new EmptyBorder(2, 2, 2, 2), parent.langpack .getString("ShortcutPanel.regular.userIntro")); usersPanel.setBorder(border); constraints.gridx = 2; constraints.gridy = 4; constraints.gridwidth = 1; constraints.gridheight = 1; constraints.weighty = 1.0; constraints.weightx = 1.0; constraints.fill = GridBagConstraints.NONE; layout.addLayoutComponent(usersPanel, constraints); add(usersPanel); } // ---------------------------------------------------- // edit box that contains the suggested program group // name, which can be modfied or substituted from the // list by the user // ---------------------------------------------------- programGroup = new JTextField(suggestedProgramGroup, 40); // 40? constraints.gridx = 0; constraints.gridy = 5; constraints.gridwidth = 2; constraints.gridheight = 1; constraints.weighty = 1.0; constraints.weightx = 10.0; constraints.fill = GridBagConstraints.HORIZONTAL; layout.addLayoutComponent(programGroup, constraints); add(programGroup); // ---------------------------------------------------- // reset button that allows the user to revert to the // original suggestion for the program group // ---------------------------------------------------- defaultButton = ButtonFactory.createButton(parent.langpack .getString("ShortcutPanel.regular.default"), idata.buttonsHColor); defaultButton.addActionListener(this); constraints.gridx = 2; constraints.gridy = 5; constraints.gridwidth = 1; constraints.gridheight = 1; constraints.fill = GridBagConstraints.NONE; layout.addLayoutComponent(defaultButton, constraints); add(defaultButton); }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/9619b3a25f43787dc92011111668210e06c00c71/ShortcutPanel.java/clean/src/lib/com/izforge/izpack/panels/ShortcutPanel.java
listLabel = LabelFactory.create(parent.langpack.getString("ShortcutPanel.regular.list"),
JLabel listLabel = LabelFactory.create(parent.langpack.getString("ShortcutPanel.regular.list"),
private void buildUI(File groups) { itsProgramFolder = groups; constraints.gridx = 0; constraints.gridy = 0; constraints.gridwidth = 3; constraints.gridheight = 1; constraints.weightx = 1.0; constraints.weighty = 1.0; constraints.fill = GridBagConstraints.HORIZONTAL; constraints.anchor = GridBagConstraints.WEST; /**/ // Add a CheckBox which enables the user to entirely supress shortcut creation. String menuKind = parent.langpack.getString("ShortcutPanel.regular.StartMenu:Start-Menu"); if( OsVersion.IS_UNIX && UnixHelper.kdeIsInstalled() ) menuKind = parent.langpack.getString("ShortcutPanel.regular.StartMenu:K-Menu"); createShortcuts = new JCheckBox( StringTool.replace( parent.langpack.getString("ShortcutPanel.regular.create"), "StartMenu", menuKind ), true); createShortcuts.addActionListener(this); constraints.gridx = 0; constraints.gridy = 1; constraints.gridwidth = 2; constraints.gridheight = 1; constraints.weighty = 0.2; layout.addLayoutComponent(createShortcuts, constraints); add(createShortcuts); // ---------------------------------------------------- // check box to allow the user to decide if a desktop // shortcut should be created. // this should only be created if needed and requested // in the definition file. // ---------------------------------------------------- if (hasDesktopShortcuts) { String initialAllowedValue = idata.getVariable( "DesktopShortcutCheckboxEnabled" ); boolean initialAllowedFlag = false; if( initialAllowedValue==null) initialAllowedFlag= false; else if( Boolean.TRUE.toString().equals(initialAllowedValue) ) initialAllowedFlag=true; allowDesktopShortcut = new JCheckBox(parent.langpack .getString("ShortcutPanel.regular.desktop"), initialAllowedFlag); constraints.gridx = 0; constraints.gridy = 2; constraints.gridwidth = 3; constraints.gridheight = 1; constraints.weighty = 0.2; layout.addLayoutComponent(allowDesktopShortcut, constraints); add(allowDesktopShortcut); } listLabel = LabelFactory.create(parent.langpack.getString("ShortcutPanel.regular.list"), JLabel.LEADING); constraints.gridx = 0; constraints.gridy = 3; constraints.gridwidth = 1; constraints.gridheight = 1; constraints.weightx = 0.2; constraints.weighty = 0.2; constraints.fill = GridBagConstraints.NONE; constraints.anchor = GridBagConstraints.WEST; layout.addLayoutComponent(listLabel, constraints); add(listLabel); // ---------------------------------------------------- // list box to list all of already existing folders as program groups // at the intended destination // ---------------------------------------------------- addSelectionList( groups, 0, 4, 2, 1, GridBagConstraints.BOTH ); // ---------------------------------------------------- // radio buttons to select current user or all users. // ---------------------------------------------------- if (shortcut.multipleUsers()) { JPanel usersPanel = new JPanel(new GridLayout(2, 1)); ButtonGroup usersGroup = new ButtonGroup(); currentUser = new JRadioButton(parent.langpack .getString("ShortcutPanel.regular.currentUser"), !isRootUser); currentUser.addActionListener(this); usersGroup.add(currentUser); usersPanel.add(currentUser); allUsers = new JRadioButton( parent.langpack.getString("ShortcutPanel.regular.allUsers"), isRootUser); if (!isRootUser) allUsers.setEnabled(false); allUsers.addActionListener(this); usersGroup.add(allUsers); usersPanel.add(allUsers); TitledBorder border = new TitledBorder(new EmptyBorder(2, 2, 2, 2), parent.langpack .getString("ShortcutPanel.regular.userIntro")); usersPanel.setBorder(border); constraints.gridx = 2; constraints.gridy = 4; constraints.gridwidth = 1; constraints.gridheight = 1; constraints.weighty = 1.0; constraints.weightx = 1.0; constraints.fill = GridBagConstraints.NONE; layout.addLayoutComponent(usersPanel, constraints); add(usersPanel); } // ---------------------------------------------------- // edit box that contains the suggested program group // name, which can be modfied or substituted from the // list by the user // ---------------------------------------------------- programGroup = new JTextField(suggestedProgramGroup, 40); // 40? constraints.gridx = 0; constraints.gridy = 5; constraints.gridwidth = 2; constraints.gridheight = 1; constraints.weighty = 1.0; constraints.weightx = 10.0; constraints.fill = GridBagConstraints.HORIZONTAL; layout.addLayoutComponent(programGroup, constraints); add(programGroup); // ---------------------------------------------------- // reset button that allows the user to revert to the // original suggestion for the program group // ---------------------------------------------------- defaultButton = ButtonFactory.createButton(parent.langpack .getString("ShortcutPanel.regular.default"), idata.buttonsHColor); defaultButton.addActionListener(this); constraints.gridx = 2; constraints.gridy = 5; constraints.gridwidth = 1; constraints.gridheight = 1; constraints.fill = GridBagConstraints.NONE; layout.addLayoutComponent(defaultButton, constraints); add(defaultButton); }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/9619b3a25f43787dc92011111668210e06c00c71/ShortcutPanel.java/clean/src/lib/com/izforge/izpack/panels/ShortcutPanel.java
continue;
private void createShortcuts() { if (!create) return; ShortcutData data; String tmpgn; for (int i = 0; i < shortcuts.size(); i++) { data = (ShortcutData) shortcuts.elementAt(i); try { //The cloning guarantees that data.subgroup will not be null. //See ShortcutData.cloneString if (data.subgroup.length() > 0 && (data.subgroup.charAt(0) == '/' || data.subgroup.charAt(0) == '\\')) { tmpgn = groupName + data.subgroup; } else { tmpgn = groupName + File.separator + data.subgroup; } shortcut.setUserType(itsUserType); shortcut.setLinkName(data.name); shortcut.setLinkType(data.type); shortcut.setArguments(data.commandLine); shortcut.setDescription(data.description); shortcut.setIconLocation(data.iconFile, data.iconIndex); shortcut.setShowCommand(data.initialState); shortcut.setTargetPath(data.target); shortcut.setWorkingDirectory(data.workingDirectory); shortcut.setEncoding(data.deskTopEntryLinux_Encoding); shortcut.setMimetype(data.deskTopEntryLinux_MimeType); shortcut.setTerminal(data.deskTopEntryLinux_Terminal); shortcut.setTerminalOptions(data.deskTopEntryLinux_TerminalOptions); shortcut.setType(data.deskTopEntryLinux_Type); shortcut.setKdeSubstUID(data.deskTopEntryLinux_X_KDE_SubstituteUID); shortcut.setURL(data.deskTopEntryLinux_URL); shortcut.setCreateForAll(data.createForAll); if (data.addToGroup) { shortcut.setProgramGroup(tmpgn); } else { shortcut.setProgramGroup(""); } try { // ---------------------------------------------- // save the shortcut only if it is either not on // the desktop or if it is on the desktop and // the user has signalled that it is ok to place // shortcuts on the desktop. // ---------------------------------------------- if ((data.type != Shortcut.DESKTOP) || ((data.type == Shortcut.DESKTOP) && allowDesktopShortcut .isSelected())) { // save the shortcut shortcut.save(); // add the file and directory name to the file list String fileName = shortcut.getFileName(); files.add(0, fileName); File file = new File(fileName); File base = new File(shortcut.getBasePath()); Vector intermediates = new Vector(); //String directoryName = shortcut.getDirectoryCreated (); execFiles.add(new ExecutableFile(fileName, 2, ExecutableFile.WARN, new ArrayList(), false)); files.add(fileName); while ((file = file.getParentFile()) != null) { if (file.equals(base)) break; intermediates.add(file); } if (file != null) { for (Iterator iter = intermediates.iterator(); iter.hasNext();) files.add(0, iter.next().toString()); } } } catch (Exception exception) {} } catch (Throwable exception) { continue; } } // try { if (execFiles != null) { FileExecutor executor = new FileExecutor(execFiles); // // TODO: Hi Guys, // TODO The following commented-out line sometimes produces an uncatchable // nullpointer Exception! // TODO evaluate for what reason the files should exec. // TODO if there is a serious explanation, why to do that, // TODO the code must be more robust //evaluate executor.executeFiles( ExecutableFile.NEVER, null ); } } catch (NullPointerException nep) { nep.printStackTrace(); } catch (RuntimeException cannot) { cannot.printStackTrace(); } parent.unlockNextButton(); }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/9619b3a25f43787dc92011111668210e06c00c71/ShortcutPanel.java/clean/src/lib/com/izforge/izpack/panels/ShortcutPanel.java
/*if (eventSource != null) { System.out.println("Instance Of : " + eventSource.getClass().getName()); }*/
/* * if (eventSource != null) { System.out.println("Instance Of : " + * eventSource.getClass().getName()); } */
public void actionPerformed(ActionEvent event) { Object eventSource = event.getSource(); /*if (eventSource != null) { System.out.println("Instance Of : " + eventSource.getClass().getName()); }*/ // ---------------------------------------------------- // create shortcut for the current user was selected // refresh the list of program groups accordingly and // reset the program group to the default setting. // ---------------------------------------------------- if (eventSource.equals(currentUser)) { groupList.setListData(shortcut.getProgramGroups(Shortcut.CURRENT_USER)); programGroup.setText(suggestedProgramGroup); shortcut.setUserType(itsUserType = Shortcut.CURRENT_USER); return; } // ---------------------------------------------------- // create shortcut for all users was selected // refresh the list of program groups accordingly and // reset the program group to the default setting. // ---------------------------------------------------- else if (eventSource.equals(allUsers)) { groupList.setListData(shortcut.getProgramGroups(Shortcut.ALL_USERS)); programGroup.setText(suggestedProgramGroup); shortcut.setUserType(itsUserType = Shortcut.ALL_USERS); return; } // ---------------------------------------------------- // The reset button was pressed. // - clear the selection in the list box, because the // selection is no longer valid // - refill the program group edit control with the // suggested program group name // ---------------------------------------------------- else if (eventSource.equals(defaultButton)) { groupList.getSelectionModel().clearSelection(); programGroup.setText(suggestedProgramGroup); return; } // ---------------------------------------------------- // the save button was pressed. This is a request to // save shortcut information to a text file. // ---------------------------------------------------- else if (eventSource.equals(saveButton)) { saveToFile(); // add the file to the uninstaller addToUninstaller(); return; } else if (eventSource.equals(createShortcuts)) { create = createShortcuts.isSelected(); if (groupList != null) { groupList.setEnabled(create); } programGroup.setEnabled(create); currentUser.setEnabled(create); defaultButton.setEnabled(create); // ** There where no Desktop Links or not allowed, this may be null: **// if (allowDesktopShortcut != null) { allowDesktopShortcut.setEnabled(create); } if (isRootUser) { allUsers.setEnabled(create); } } }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/45095e7edcb91a0d213eacf9ed33166765b63a6b/ShortcutPanel.java/clean/src/lib/com/izforge/izpack/panels/ShortcutPanel.java
private void analyzeShortcutSpec() { if (!haveShortcutSpec) { shortcutsToCreate = false; return; } XMLElement skipper = spec.getFirstChildNamed(SPEC_KEY_SKIP_IFNOT_SUPPORTED); skipIfNotSupported = (skipper != null); // ---------------------------------------------------- // find out if we should simulate a not supported // scenario // ---------------------------------------------------- XMLElement support = spec.getFirstChildNamed(SPEC_KEY_NOT_SUPPORTED); if (support != null) { simulteNotSupported = true; } // ---------------------------------------------------- // find out in which program group the shortcuts should // be placed and where this program group should be // located // ---------------------------------------------------- XMLElement group = spec.getFirstChildNamed(SPEC_KEY_PROGRAM_GROUP); String location = null; hasDesktopShortcuts = false; if (group != null) { suggestedProgramGroup = group.getAttribute(SPEC_ATTRIBUTE_DEFAULT_GROUP, ""); location = group.getAttribute(SPEC_ATTRIBUTE_LOCATION, SPEC_VALUE_APPLICATIONS); } else { suggestedProgramGroup = ""; location = SPEC_VALUE_APPLICATIONS; } if (location.equals(SPEC_VALUE_APPLICATIONS)) { groupLocation = Shortcut.APPLICATIONS; } else if (location.equals(SPEC_VALUE_START_MENU)) { groupLocation = Shortcut.START_MENU; } // ---------------------------------------------------- // create a list of all shortcuts that need to be // created, containing all details about each shortcut // ---------------------------------------------------- // String temp; Vector shortcutSpecs = spec.getChildrenNamed(SPEC_KEY_SHORTCUT); XMLElement shortcutSpec; ShortcutData data; shortCuts = new Vector(); for (int i = 0; i < shortcutSpecs.size(); i++) { // System.out.println( "Processing shortcut: " + i ); shortcutSpec = (XMLElement) shortcutSpecs.elementAt(i); if (!OsConstraint.oneMatchesCurrentSystem(shortcutSpec)) { continue; } // TODO: write log info INFO.info( "Checking Condition for " + // shortcutSpec.getAttribute( SPEC_ATTRIBUTE_NAME ) ); if (!checkConditions(shortcutSpec)) { continue; } // TODO write log info INFO.info( "Checked Condition for " + // shortcutSpec.getAttribute( SPEC_ATTRIBUTE_NAME ) ); data = new ShortcutData(); data.name = shortcutSpec.getAttribute(SPEC_ATTRIBUTE_NAME); data.subgroup = shortcutSpec.getAttribute(SPEC_ATTRIBUTE_SUBGROUP, ""); data.description = shortcutSpec.getAttribute(SPEC_ATTRIBUTE_DESCRIPTION, ""); // ** Linux **// data.deskTopEntryLinux_Encoding = shortcutSpec .getAttribute(SPEC_ATTRIBUTE_ENCODING, ""); data.deskTopEntryLinux_MimeType = shortcutSpec .getAttribute(SPEC_ATTRIBUTE_MIMETYPE, ""); data.deskTopEntryLinux_Terminal = shortcutSpec .getAttribute(SPEC_ATTRIBUTE_TERMINAL, ""); data.deskTopEntryLinux_TerminalOptions = shortcutSpec.getAttribute( SPEC_ATTRIBUTE_TERMINAL_OPTIONS, ""); data.deskTopEntryLinux_Type = shortcutSpec.getAttribute(SPEC_ATTRIBUTE_TYPE, ""); data.deskTopEntryLinux_URL = shortcutSpec.getAttribute(SPEC_ATTRIBUTE_URL, ""); data.deskTopEntryLinux_X_KDE_SubstituteUID = shortcutSpec.getAttribute( SPEC_ATTRIBUTE_KDE_SUBST_UID, ""); data.createForAll = new Boolean(shortcutSpec.getAttribute(CREATE_FOR_ALL, "false")); // ** EndOf LINUX **// // temp = data.target = fixSeparatorChar(shortcutSpec.getAttribute(SPEC_ATTRIBUTE_TARGET, "")); // temp = data.commandLine = shortcutSpec.getAttribute(SPEC_ATTRIBUTE_COMMAND, ""); // temp = data.iconFile = fixSeparatorChar(shortcutSpec.getAttribute(SPEC_ATTRIBUTE_ICON, "")); data.iconIndex = Integer.parseInt(shortcutSpec.getAttribute(SPEC_ATTRIBUTE_ICON_INDEX, "0")); // temp = data.workingDirectory = fixSeparatorChar(shortcutSpec.getAttribute( SPEC_ATTRIBUTE_WORKING_DIR, "")); String initialState = shortcutSpec.getAttribute(SPEC_ATTRIBUTE_INITIAL_STATE, ""); if (initialState.equals(SPEC_VALUE_NO_SHOW)) { data.initialState = Shortcut.HIDE; } else if (initialState.equals(SPEC_VALUE_NORMAL)) { data.initialState = Shortcut.NORMAL; } else if (initialState.equals(SPEC_VALUE_MAXIMIZED)) { data.initialState = Shortcut.MAXIMIZED; } else if (initialState.equals(SPEC_VALUE_MINIMIZED)) { data.initialState = Shortcut.MINIMIZED; } else { data.initialState = Shortcut.NORMAL; } //LOG System.out.println("data.initialState: " + data.initialState); // -------------------------------------------------- // if the minimal data requirements are met to create // the shortcut, create one entry each for each of // the requested types. // Eventually this will cause the creation of one // shortcut in each of the associated locations. // -------------------------------------------------- // without a name we can not create a shortcut if (data.name == null) { continue; } // 1. Elmar: "Without a target we can not create a shortcut." // 2. Marc: "No, Even on Linux a Link can be an URL and has no target." if (data.target == null) { // TODO: write log info INFO.warn( "Shortcut: " + data + " has no target" ); data.target = ""; } // the shortcut is not actually required for any of the selected packs // the shortcut is not actually required for any of the selected packs // the shortcut is not actually required for any of the selected packs Vector forPacks = shortcutSpec.getChildrenNamed(SPEC_KEY_PACKS); if (!shortcutRequiredFor(forPacks)) { continue; } // -------------------------------------------------- // This section is executed if we don't skip. // -------------------------------------------------- // For each of the categories set the type and if // the link should be placed in the program group, // then clone the data set to obtain an independent // instance and add this to the list of shortcuts // to be created. In this way, we will set up an // identical copy for each of the locations at which // a shortcut should be placed. Therefore you must // not use 'else if' statements! // -------------------------------------------------- { if (XMLHelper.attributeIsTrue(shortcutSpec, SPEC_ATTRIBUTE_DESKTOP)) { hasDesktopShortcuts = true; data.addToGroup = false; data.type = Shortcut.DESKTOP; shortcuts.add(data.clone()); } if (XMLHelper.attributeIsTrue(shortcutSpec, SPEC_ATTRIBUTE_APPLICATIONS)) { data.addToGroup = false; data.type = Shortcut.APPLICATIONS; shortcuts.add(data.clone()); } if (XMLHelper.attributeIsTrue(shortcutSpec, SPEC_ATTRIBUTE_START_MENU)) { data.addToGroup = false; data.type = Shortcut.START_MENU; shortcuts.add(data.clone()); } if (XMLHelper.attributeIsTrue(shortcutSpec, SPEC_ATTRIBUTE_STARTUP)) { data.addToGroup = false; data.type = Shortcut.START_UP; shortcuts.add(data.clone()); } if (XMLHelper.attributeIsTrue(shortcutSpec, SPEC_ATTRIBUTE_PROGRAM_GROUP)) { data.addToGroup = true; data.type = Shortcut.APPLICATIONS; shortcuts.add(data.clone()); } // / TODO: write log INFO.info( "data.name: " + data.name ); shortCuts.add((data.name == null) ? "" : data.name); // + " -> " + data.target + // " Type: " + data.type ); } } // ---------------------------------------------------- // signal if there are any shortcuts to create // ---------------------------------------------------- if (shortcuts.size() > 0) { shortcutsToCreate = true; } }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/45095e7edcb91a0d213eacf9ed33166765b63a6b/ShortcutPanel.java/clean/src/lib/com/izforge/izpack/panels/ShortcutPanel.java
Vector forPacks = shortcutSpec.getChildrenNamed(SPEC_KEY_PACKS); if (!shortcutRequiredFor(forPacks)) { continue;
Vector forPacks = shortcutSpec.getChildrenNamed(SPEC_KEY_PACKS); if (!shortcutRequiredFor(forPacks)) { continue;
private void analyzeShortcutSpec() { if (!haveShortcutSpec) { shortcutsToCreate = false; return; } XMLElement skipper = spec.getFirstChildNamed(SPEC_KEY_SKIP_IFNOT_SUPPORTED); skipIfNotSupported = (skipper != null); // ---------------------------------------------------- // find out if we should simulate a not supported // scenario // ---------------------------------------------------- XMLElement support = spec.getFirstChildNamed(SPEC_KEY_NOT_SUPPORTED); if (support != null) { simulteNotSupported = true; } // ---------------------------------------------------- // find out in which program group the shortcuts should // be placed and where this program group should be // located // ---------------------------------------------------- XMLElement group = spec.getFirstChildNamed(SPEC_KEY_PROGRAM_GROUP); String location = null; hasDesktopShortcuts = false; if (group != null) { suggestedProgramGroup = group.getAttribute(SPEC_ATTRIBUTE_DEFAULT_GROUP, ""); location = group.getAttribute(SPEC_ATTRIBUTE_LOCATION, SPEC_VALUE_APPLICATIONS); } else { suggestedProgramGroup = ""; location = SPEC_VALUE_APPLICATIONS; } if (location.equals(SPEC_VALUE_APPLICATIONS)) { groupLocation = Shortcut.APPLICATIONS; } else if (location.equals(SPEC_VALUE_START_MENU)) { groupLocation = Shortcut.START_MENU; } // ---------------------------------------------------- // create a list of all shortcuts that need to be // created, containing all details about each shortcut // ---------------------------------------------------- // String temp; Vector shortcutSpecs = spec.getChildrenNamed(SPEC_KEY_SHORTCUT); XMLElement shortcutSpec; ShortcutData data; shortCuts = new Vector(); for (int i = 0; i < shortcutSpecs.size(); i++) { // System.out.println( "Processing shortcut: " + i ); shortcutSpec = (XMLElement) shortcutSpecs.elementAt(i); if (!OsConstraint.oneMatchesCurrentSystem(shortcutSpec)) { continue; } // TODO: write log info INFO.info( "Checking Condition for " + // shortcutSpec.getAttribute( SPEC_ATTRIBUTE_NAME ) ); if (!checkConditions(shortcutSpec)) { continue; } // TODO write log info INFO.info( "Checked Condition for " + // shortcutSpec.getAttribute( SPEC_ATTRIBUTE_NAME ) ); data = new ShortcutData(); data.name = shortcutSpec.getAttribute(SPEC_ATTRIBUTE_NAME); data.subgroup = shortcutSpec.getAttribute(SPEC_ATTRIBUTE_SUBGROUP, ""); data.description = shortcutSpec.getAttribute(SPEC_ATTRIBUTE_DESCRIPTION, ""); // ** Linux **// data.deskTopEntryLinux_Encoding = shortcutSpec .getAttribute(SPEC_ATTRIBUTE_ENCODING, ""); data.deskTopEntryLinux_MimeType = shortcutSpec .getAttribute(SPEC_ATTRIBUTE_MIMETYPE, ""); data.deskTopEntryLinux_Terminal = shortcutSpec .getAttribute(SPEC_ATTRIBUTE_TERMINAL, ""); data.deskTopEntryLinux_TerminalOptions = shortcutSpec.getAttribute( SPEC_ATTRIBUTE_TERMINAL_OPTIONS, ""); data.deskTopEntryLinux_Type = shortcutSpec.getAttribute(SPEC_ATTRIBUTE_TYPE, ""); data.deskTopEntryLinux_URL = shortcutSpec.getAttribute(SPEC_ATTRIBUTE_URL, ""); data.deskTopEntryLinux_X_KDE_SubstituteUID = shortcutSpec.getAttribute( SPEC_ATTRIBUTE_KDE_SUBST_UID, ""); data.createForAll = new Boolean(shortcutSpec.getAttribute(CREATE_FOR_ALL, "false")); // ** EndOf LINUX **// // temp = data.target = fixSeparatorChar(shortcutSpec.getAttribute(SPEC_ATTRIBUTE_TARGET, "")); // temp = data.commandLine = shortcutSpec.getAttribute(SPEC_ATTRIBUTE_COMMAND, ""); // temp = data.iconFile = fixSeparatorChar(shortcutSpec.getAttribute(SPEC_ATTRIBUTE_ICON, "")); data.iconIndex = Integer.parseInt(shortcutSpec.getAttribute(SPEC_ATTRIBUTE_ICON_INDEX, "0")); // temp = data.workingDirectory = fixSeparatorChar(shortcutSpec.getAttribute( SPEC_ATTRIBUTE_WORKING_DIR, "")); String initialState = shortcutSpec.getAttribute(SPEC_ATTRIBUTE_INITIAL_STATE, ""); if (initialState.equals(SPEC_VALUE_NO_SHOW)) { data.initialState = Shortcut.HIDE; } else if (initialState.equals(SPEC_VALUE_NORMAL)) { data.initialState = Shortcut.NORMAL; } else if (initialState.equals(SPEC_VALUE_MAXIMIZED)) { data.initialState = Shortcut.MAXIMIZED; } else if (initialState.equals(SPEC_VALUE_MINIMIZED)) { data.initialState = Shortcut.MINIMIZED; } else { data.initialState = Shortcut.NORMAL; } //LOG System.out.println("data.initialState: " + data.initialState); // -------------------------------------------------- // if the minimal data requirements are met to create // the shortcut, create one entry each for each of // the requested types. // Eventually this will cause the creation of one // shortcut in each of the associated locations. // -------------------------------------------------- // without a name we can not create a shortcut if (data.name == null) { continue; } // 1. Elmar: "Without a target we can not create a shortcut." // 2. Marc: "No, Even on Linux a Link can be an URL and has no target." if (data.target == null) { // TODO: write log info INFO.warn( "Shortcut: " + data + " has no target" ); data.target = ""; } // the shortcut is not actually required for any of the selected packs // the shortcut is not actually required for any of the selected packs // the shortcut is not actually required for any of the selected packs Vector forPacks = shortcutSpec.getChildrenNamed(SPEC_KEY_PACKS); if (!shortcutRequiredFor(forPacks)) { continue; } // -------------------------------------------------- // This section is executed if we don't skip. // -------------------------------------------------- // For each of the categories set the type and if // the link should be placed in the program group, // then clone the data set to obtain an independent // instance and add this to the list of shortcuts // to be created. In this way, we will set up an // identical copy for each of the locations at which // a shortcut should be placed. Therefore you must // not use 'else if' statements! // -------------------------------------------------- { if (XMLHelper.attributeIsTrue(shortcutSpec, SPEC_ATTRIBUTE_DESKTOP)) { hasDesktopShortcuts = true; data.addToGroup = false; data.type = Shortcut.DESKTOP; shortcuts.add(data.clone()); } if (XMLHelper.attributeIsTrue(shortcutSpec, SPEC_ATTRIBUTE_APPLICATIONS)) { data.addToGroup = false; data.type = Shortcut.APPLICATIONS; shortcuts.add(data.clone()); } if (XMLHelper.attributeIsTrue(shortcutSpec, SPEC_ATTRIBUTE_START_MENU)) { data.addToGroup = false; data.type = Shortcut.START_MENU; shortcuts.add(data.clone()); } if (XMLHelper.attributeIsTrue(shortcutSpec, SPEC_ATTRIBUTE_STARTUP)) { data.addToGroup = false; data.type = Shortcut.START_UP; shortcuts.add(data.clone()); } if (XMLHelper.attributeIsTrue(shortcutSpec, SPEC_ATTRIBUTE_PROGRAM_GROUP)) { data.addToGroup = true; data.type = Shortcut.APPLICATIONS; shortcuts.add(data.clone()); } // / TODO: write log INFO.info( "data.name: " + data.name ); shortCuts.add((data.name == null) ? "" : data.name); // + " -> " + data.target + // " Type: " + data.type ); } } // ---------------------------------------------------- // signal if there are any shortcuts to create // ---------------------------------------------------- if (shortcuts.size() > 0) { shortcutsToCreate = true; } }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/45095e7edcb91a0d213eacf9ed33166765b63a6b/ShortcutPanel.java/clean/src/lib/com/izforge/izpack/panels/ShortcutPanel.java
itsProgramFolder = groups;
private void buildUI(File groups) { itsProgramFolder = groups; // constraints.gridx = 1; // constraints.gridy = line+1; // constraints.gridwidth = 3; // constraints.gridheight = 1; constraints.insets = new Insets(10, 10, 0, 0); // Add a CheckBox which enables the user to entirely supress shortcut creation. String menuKind = parent.langpack.getString("ShortcutPanel.regular.StartMenu:Start-Menu"); if (OsVersion.IS_UNIX && UnixHelper.kdeIsInstalled()) { menuKind = parent.langpack.getString("ShortcutPanel.regular.StartMenu:K-Menu"); } createShortcuts = new JCheckBox(StringTool.replace(parent.langpack .getString("ShortcutPanel.regular.create"), "StartMenu", menuKind), true); createShortcuts.addActionListener(this); constraints.gridx = col; constraints.gridy = line + 1; constraints.gridwidth = 1; constraints.gridheight = 1; // constraints.weightx = 0.1; // constraints.weighty = 0.2; constraints.fill = GridBagConstraints.HORIZONTAL; constraints.anchor = GridBagConstraints.NORTHWEST; layout.addLayoutComponent(createShortcuts, constraints); add(createShortcuts); constraints.insets = new Insets(0, 10, 0, 0); // ---------------------------------------------------- // check box to allow the user to decide if a desktop // shortcut should be created. // this should only be created if needed and requested // in the definition file. // ---------------------------------------------------- if (hasDesktopShortcuts) { String initialAllowedValue = idata.getVariable("DesktopShortcutCheckboxEnabled"); boolean initialAllowedFlag = false; if (initialAllowedValue == null) { initialAllowedFlag = false; } else if (Boolean.TRUE.toString().equals(initialAllowedValue)) { initialAllowedFlag = true; } allowDesktopShortcut = new JCheckBox(parent.langpack .getString("ShortcutPanel.regular.desktop"), initialAllowedFlag); constraints.gridx = col; constraints.gridy = line + 2; constraints.gridwidth = 1; constraints.gridheight = 1; // constraints.weighty = 0.2; // constraints.weighty = 1.0; // constraints.weighty = 0.5; layout.addLayoutComponent(allowDesktopShortcut, constraints); add(allowDesktopShortcut); } listLabel = LabelFactory.create(parent.langpack.getString("ShortcutPanel.regular.list"), JLabel.LEADING); constraints.gridx = col; constraints.gridy = line + 3; constraints.gridwidth = 1; constraints.gridheight = 1; constraints.insets = new Insets(10, 10, 0, 0); constraints.fill = GridBagConstraints.HORIZONTAL; constraints.anchor = GridBagConstraints.NORTHWEST; layout.addLayoutComponent(listLabel, constraints); add(listLabel); // ---------------------------------------------------- // list box to list all of already existing folders as program groups // at the intended destination // ---------------------------------------------------- Vector dirEntries = new Vector(); File[] entries = groups.listFiles(); // Quickfix prevent NullPointer on non default compliant Linux - KDEs // i.e Mandrake 2005 LE stores from now also in "applnk" instead in prior "applnk-mdk": if (entries != null) { for (int idx = 0; idx < entries.length; idx++) { if (entries[idx].isDirectory()) { dirEntries.add(entries[idx].getName()); } } } if (groupList == null) { groupList = new JList(); } groupList = addList(dirEntries, ListSelectionModel.SINGLE_SELECTION, groupList, col, line + 4, 1, 1, GridBagConstraints.BOTH); // ---------------------------------------------------- // radio buttons to select current user or all users. // ---------------------------------------------------- if (shortcut.multipleUsers()) { JPanel usersPanel = new JPanel(new GridLayout(2, 1)); ButtonGroup usersGroup = new ButtonGroup(); currentUser = new JRadioButton(parent.langpack .getString("ShortcutPanel.regular.currentUser"), !isRootUser); currentUser.addActionListener(this); usersGroup.add(currentUser); usersPanel.add(currentUser); allUsers = new JRadioButton( parent.langpack.getString("ShortcutPanel.regular.allUsers"), isRootUser); if (!isRootUser) { allUsers.setEnabled(false); } allUsers.addActionListener(this); usersGroup.add(allUsers); usersPanel.add(allUsers); TitledBorder border = new TitledBorder(new EmptyBorder(2, 2, 2, 2), parent.langpack .getString("ShortcutPanel.regular.userIntro")); usersPanel.setBorder(border); constraints.gridx = col + 1; constraints.gridy = line + 4; constraints.gridwidth = 1; constraints.gridheight = 1; // constraints.weighty = 1.0; // constraints.weightx = 1.0; constraints.fill = GridBagConstraints.HORIZONTAL; layout.addLayoutComponent(usersPanel, constraints); add(usersPanel); } // ---------------------------------------------------- // edit box that contains the suggested program group // name, which can be modfied or substituted from the // list by the user // ---------------------------------------------------- programGroup = new JTextField(suggestedProgramGroup, 40); // 40? constraints.gridx = col; constraints.gridy = line + 5; constraints.gridwidth = 1; constraints.gridheight = 1; // constraints.weighty = 1.0; // constraints.weightx = 1.0; constraints.fill = GridBagConstraints.HORIZONTAL; layout.addLayoutComponent(programGroup, constraints); add(programGroup); // ---------------------------------------------------- // reset button that allows the user to revert to the // original suggestion for the program group // ---------------------------------------------------- defaultButton = ButtonFactory.createButton(parent.langpack .getString("ShortcutPanel.regular.default"), idata.buttonsHColor); defaultButton.addActionListener(this); constraints.gridx = col + 1; constraints.gridy = line + 5; constraints.gridwidth = 1; constraints.gridheight = 1; constraints.fill = GridBagConstraints.HORIZONTAL; layout.addLayoutComponent(defaultButton, constraints); add(defaultButton); }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/45095e7edcb91a0d213eacf9ed33166765b63a6b/ShortcutPanel.java/clean/src/lib/com/izforge/izpack/panels/ShortcutPanel.java
if (!isRootUser) { allUsers.setEnabled(false); }
Debug.log("allUsers.setEnabled(), I'm Root: " + isRootUser); allUsers.setEnabled(isRootUser);
private void buildUI(File groups) { itsProgramFolder = groups; // constraints.gridx = 1; // constraints.gridy = line+1; // constraints.gridwidth = 3; // constraints.gridheight = 1; constraints.insets = new Insets(10, 10, 0, 0); // Add a CheckBox which enables the user to entirely supress shortcut creation. String menuKind = parent.langpack.getString("ShortcutPanel.regular.StartMenu:Start-Menu"); if (OsVersion.IS_UNIX && UnixHelper.kdeIsInstalled()) { menuKind = parent.langpack.getString("ShortcutPanel.regular.StartMenu:K-Menu"); } createShortcuts = new JCheckBox(StringTool.replace(parent.langpack .getString("ShortcutPanel.regular.create"), "StartMenu", menuKind), true); createShortcuts.addActionListener(this); constraints.gridx = col; constraints.gridy = line + 1; constraints.gridwidth = 1; constraints.gridheight = 1; // constraints.weightx = 0.1; // constraints.weighty = 0.2; constraints.fill = GridBagConstraints.HORIZONTAL; constraints.anchor = GridBagConstraints.NORTHWEST; layout.addLayoutComponent(createShortcuts, constraints); add(createShortcuts); constraints.insets = new Insets(0, 10, 0, 0); // ---------------------------------------------------- // check box to allow the user to decide if a desktop // shortcut should be created. // this should only be created if needed and requested // in the definition file. // ---------------------------------------------------- if (hasDesktopShortcuts) { String initialAllowedValue = idata.getVariable("DesktopShortcutCheckboxEnabled"); boolean initialAllowedFlag = false; if (initialAllowedValue == null) { initialAllowedFlag = false; } else if (Boolean.TRUE.toString().equals(initialAllowedValue)) { initialAllowedFlag = true; } allowDesktopShortcut = new JCheckBox(parent.langpack .getString("ShortcutPanel.regular.desktop"), initialAllowedFlag); constraints.gridx = col; constraints.gridy = line + 2; constraints.gridwidth = 1; constraints.gridheight = 1; // constraints.weighty = 0.2; // constraints.weighty = 1.0; // constraints.weighty = 0.5; layout.addLayoutComponent(allowDesktopShortcut, constraints); add(allowDesktopShortcut); } listLabel = LabelFactory.create(parent.langpack.getString("ShortcutPanel.regular.list"), JLabel.LEADING); constraints.gridx = col; constraints.gridy = line + 3; constraints.gridwidth = 1; constraints.gridheight = 1; constraints.insets = new Insets(10, 10, 0, 0); constraints.fill = GridBagConstraints.HORIZONTAL; constraints.anchor = GridBagConstraints.NORTHWEST; layout.addLayoutComponent(listLabel, constraints); add(listLabel); // ---------------------------------------------------- // list box to list all of already existing folders as program groups // at the intended destination // ---------------------------------------------------- Vector dirEntries = new Vector(); File[] entries = groups.listFiles(); // Quickfix prevent NullPointer on non default compliant Linux - KDEs // i.e Mandrake 2005 LE stores from now also in "applnk" instead in prior "applnk-mdk": if (entries != null) { for (int idx = 0; idx < entries.length; idx++) { if (entries[idx].isDirectory()) { dirEntries.add(entries[idx].getName()); } } } if (groupList == null) { groupList = new JList(); } groupList = addList(dirEntries, ListSelectionModel.SINGLE_SELECTION, groupList, col, line + 4, 1, 1, GridBagConstraints.BOTH); // ---------------------------------------------------- // radio buttons to select current user or all users. // ---------------------------------------------------- if (shortcut.multipleUsers()) { JPanel usersPanel = new JPanel(new GridLayout(2, 1)); ButtonGroup usersGroup = new ButtonGroup(); currentUser = new JRadioButton(parent.langpack .getString("ShortcutPanel.regular.currentUser"), !isRootUser); currentUser.addActionListener(this); usersGroup.add(currentUser); usersPanel.add(currentUser); allUsers = new JRadioButton( parent.langpack.getString("ShortcutPanel.regular.allUsers"), isRootUser); if (!isRootUser) { allUsers.setEnabled(false); } allUsers.addActionListener(this); usersGroup.add(allUsers); usersPanel.add(allUsers); TitledBorder border = new TitledBorder(new EmptyBorder(2, 2, 2, 2), parent.langpack .getString("ShortcutPanel.regular.userIntro")); usersPanel.setBorder(border); constraints.gridx = col + 1; constraints.gridy = line + 4; constraints.gridwidth = 1; constraints.gridheight = 1; // constraints.weighty = 1.0; // constraints.weightx = 1.0; constraints.fill = GridBagConstraints.HORIZONTAL; layout.addLayoutComponent(usersPanel, constraints); add(usersPanel); } // ---------------------------------------------------- // edit box that contains the suggested program group // name, which can be modfied or substituted from the // list by the user // ---------------------------------------------------- programGroup = new JTextField(suggestedProgramGroup, 40); // 40? constraints.gridx = col; constraints.gridy = line + 5; constraints.gridwidth = 1; constraints.gridheight = 1; // constraints.weighty = 1.0; // constraints.weightx = 1.0; constraints.fill = GridBagConstraints.HORIZONTAL; layout.addLayoutComponent(programGroup, constraints); add(programGroup); // ---------------------------------------------------- // reset button that allows the user to revert to the // original suggestion for the program group // ---------------------------------------------------- defaultButton = ButtonFactory.createButton(parent.langpack .getString("ShortcutPanel.regular.default"), idata.buttonsHColor); defaultButton.addActionListener(this); constraints.gridx = col + 1; constraints.gridy = line + 5; constraints.gridwidth = 1; constraints.gridheight = 1; constraints.fill = GridBagConstraints.HORIZONTAL; layout.addLayoutComponent(defaultButton, constraints); add(defaultButton); }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/45095e7edcb91a0d213eacf9ed33166765b63a6b/ShortcutPanel.java/clean/src/lib/com/izforge/izpack/panels/ShortcutPanel.java
isRootUser = allUsersProgramsFolder.canWrite();
Debug.log("All UsersProgramsFolder: '" + allUsersProgramsFolder + "'"); File forceTest = new File(allUsersProgramsFolder + File.separator + System.getProperty("user.name") + System.currentTimeMillis()); try { isRootUser = forceTest.createNewFile(); } catch (Exception e) { isRootUser = false; Debug.log("IOException: " + "'" + e.getLocalizedMessage() + "'"); Debug.log("You cannot create '" + forceTest + "'"); } if (forceTest.exists()) { Debug.log("Delete temporary File: '" + forceTest + "'"); forceTest.delete(); } String perm = isRootUser ? "can" : "cannot"; Debug.log("You " + perm + " write into '" + allUsersProgramsFolder + "'");
public void panelActivate() { try { readShortcutSpec(); } catch (Throwable exception) { System.out.println("could not read shortcut spec!"); exception.printStackTrace(); } // Create the UI elements try { shortcut = (Shortcut) (TargetFactory.getInstance() .makeObject("com.izforge.izpack.util.os.Shortcut")); shortcut.initialize(Shortcut.APPLICATIONS, "-"); } catch (Throwable exception) { System.out.println("could not create shortcut instance"); exception.printStackTrace(); } analyzeShortcutSpec(); if (shortcutsToCreate && !OsVersion.IS_OSX) { if (shortcut.supported() && !simulteNotSupported) { File allUsersProgramsFolder = getProgramsFolder(Shortcut.ALL_USERS); isRootUser = allUsersProgramsFolder.canWrite(); if (isRootUser) { itsUserType = Shortcut.ALL_USERS; } else { itsUserType = Shortcut.CURRENT_USER; } buildUI(getProgramsFolder(isRootUser ? Shortcut.ALL_USERS : Shortcut.CURRENT_USER)); // addSelectionList(); // add( shortCutsArea ); // JList shortCutList = null; // addList( shortCuts, ListSelectionModel.SINGLE_SELECTION, shortCutList, col, // line+6, 1, 1, GridBagConstraints.BOTH ); } else { // TODO MEP: Test buildAlternateUI(); // parent.unlockNextButton(); // parent.lockPrevButton(); } } else { ; // parent.skipPanel (); } }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/45095e7edcb91a0d213eacf9ed33166765b63a6b/ShortcutPanel.java/clean/src/lib/com/izforge/izpack/panels/ShortcutPanel.java
System.out.println(getProgramsFolder(Shortcut.CURRENT_USER));
public void panelActivate() { try { readShortcutSpec(); } catch (Throwable exception) { System.out.println("could not read shortcut spec!"); exception.printStackTrace(); } // Create the UI elements try { shortcut = (Shortcut) (TargetFactory.getInstance() .makeObject("com.izforge.izpack.util.os.Shortcut")); shortcut.initialize(Shortcut.APPLICATIONS, "-"); } catch (Throwable exception) { System.out.println("could not create shortcut instance"); exception.printStackTrace(); } analyzeShortcutSpec(); if (shortcutsToCreate && !OsVersion.IS_OSX) { if (shortcut.supported() && !simulteNotSupported) { File allUsersProgramsFolder = getProgramsFolder(Shortcut.ALL_USERS); isRootUser = allUsersProgramsFolder.canWrite(); if (isRootUser) { itsUserType = Shortcut.ALL_USERS; } else { itsUserType = Shortcut.CURRENT_USER; } buildUI(getProgramsFolder(isRootUser ? Shortcut.ALL_USERS : Shortcut.CURRENT_USER)); // addSelectionList(); // add( shortCutsArea ); // JList shortCutList = null; // addList( shortCuts, ListSelectionModel.SINGLE_SELECTION, shortCutList, col, // line+6, 1, 1, GridBagConstraints.BOTH ); } else { // TODO MEP: Test buildAlternateUI(); // parent.unlockNextButton(); // parent.lockPrevButton(); } } else { ; // parent.skipPanel (); } }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/45095e7edcb91a0d213eacf9ed33166765b63a6b/ShortcutPanel.java/clean/src/lib/com/izforge/izpack/panels/ShortcutPanel.java
dataElement.setAttribute (AUTO_ATTRIBUTE_GROUP, new Boolean (data.addToGroup).toString ());
dataElement.setAttribute (AUTO_ATTRIBUTE_GROUP, Boolean.valueOf(data.addToGroup).toString ());
public void makeXMLData (XMLElement panelRoot) { // ---------------------------------------------------- // if there are no shortcuts to create, shortcuts are // not supported, or we should simulate that they are // not supported, then we have nothing to add. Just // return // ---------------------------------------------------- if (!shortcutsToCreate || !shortcut.supported () || simulteNotSupported ) { return; } ShortcutData data; XMLElement dataElement; // ---------------------------------------------------- // add the item that defines the name of the program group // ---------------------------------------------------- dataElement = new XMLElement (AUTO_KEY_PROGRAM_GROUP); dataElement.setAttribute (AUTO_ATTRIBUTE_NAME, groupName); panelRoot.addChild (dataElement); // ---------------------------------------------------- // add the details for each of the shortcuts // ---------------------------------------------------- for (int i = 0; i < shortcuts.size (); i++) { data = (ShortcutData)shortcuts.elementAt (i); dataElement = new XMLElement (AUTO_KEY_SHORTCUT); dataElement.setAttribute (AUTO_ATTRIBUTE_NAME, data.name); dataElement.setAttribute (AUTO_ATTRIBUTE_GROUP, new Boolean (data.addToGroup).toString ()); dataElement.setAttribute (AUTO_ATTRIBUTE_TYPE, Integer.toString (data.type)); dataElement.setAttribute (AUTO_ATTRIBUTE_COMMAND, data.commandLine); dataElement.setAttribute (AUTO_ATTRIBUTE_DESCRIPTION, data.description); dataElement.setAttribute (AUTO_ATTRIBUTE_ICON, data.iconFile); dataElement.setAttribute (AUTO_ATTRIBUTE_ICON_INDEX, Integer.toString (data.iconIndex)); dataElement.setAttribute (AUTO_ATTRIBUTE_INITIAL_STATE, Integer.toString (data.initialState)); dataElement.setAttribute (AUTO_ATTRIBUTE_TARGET, data.target); dataElement.setAttribute (AUTO_ATTRIBUTE_WORKING_DIR, data.workingDirectory); // ---------------------------------------------- // add the shortcut only if it is either not on // the desktop or if it is on the desktop and // the user has signalled that it is ok to place // shortcuts on the desktop. // ---------------------------------------------- if ( (data.type != Shortcut.DESKTOP) || ((data.type == Shortcut.DESKTOP) && allowDesktopShortcut.isSelected ()) ) { panelRoot.addChild (dataElement); } } }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/08ecc635ba8049aeb419722893f373a4a7f99a77/ShortcutPanel.java/clean/src/lib/com/izforge/izpack/panels/ShortcutPanel.java
VariableSubstitutor vs = new VariableSubstitutor(idata.getVariableValueMap());
VariableSubstitutor vs = new VariableSubstitutor(idata.getVariables());
private void parseText() { try { // Initialize the variable substitutor VariableSubstitutor vs = new VariableSubstitutor(idata.getVariableValueMap()); // Parses the info text info = vs.substitute(info, null); } catch (Exception err) { err.printStackTrace(); } }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/6822c9086a6716a2c03b2ad638f19542678f38a5/XInfoPanel.java/buggy/src/lib/com/izforge/izpack/panels/XInfoPanel.java
public Frontend() throws Exception { super(); // Sets the Kunststoff L&F as the right one KunststoffLookAndFeel klnf = new KunststoffLookAndFeel(); UIManager.setLookAndFeel(klnf); klnf.setCurrentTheme(new IzPackKMetalTheme()); // Shows the splash window splashWindow = new FrontendSplashWindow(); // We load the configuration Frontend.splashWindow.update(1, "Loading the configuration ..."); loadConfig(); // We load the localisation Frontend.splashWindow.update(2, "Loading the localisation ..."); loadLocalisation(); String title = langpack.getString("frontend.title"); // We launch the GUI FrontendFrame fef = new FrontendFrame(title, langpack); }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/91994653572a3171781f1edfa5a2651f3a9a49fb/Frontend.java/buggy/src/lib/com/izforge/izpack/frontend/Frontend.java
public Frontend() throws Exception { super(); // Sets the Kunststoff L&F as the right one KunststoffLookAndFeel klnf = new KunststoffLookAndFeel(); UIManager.setLookAndFeel(klnf); klnf.setCurrentTheme(new IzPackKMetalTheme()); // Shows the splash window splashWindow = new FrontendSplashWindow(); // We load the configuration Frontend.splashWindow.update(1, "Loading the configuration ..."); loadConfig(); // We load the localisation Frontend.splashWindow.update(2, "Loading the localisation ..."); loadLocalisation(); String title = langpack.getString("frontend.title"); // We launch the GUI FrontendFrame fef = new FrontendFrame(title, langpack); }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/91994653572a3171781f1edfa5a2651f3a9a49fb/Frontend.java/buggy/src/lib/com/izforge/izpack/frontend/Frontend.java
wait(_maxWait);
final long elapsed = (System.currentTimeMillis() - starttime); final long waitTime = _maxWait - elapsed; if (waitTime > 0) { wait(waitTime); }
public synchronized Object borrowObject(Object key) throws Exception { long starttime = System.currentTimeMillis(); boolean newlyCreated = false; for(;;) { CursorableLinkedList pool = (CursorableLinkedList)(_poolMap.get(key)); if(null == pool) { pool = new CursorableLinkedList(); _poolMap.put(key,pool); _poolList.add(key); } ObjectTimestampPair pair = null; // if there are any sleeping, just grab one of those try { pair = (ObjectTimestampPair)(pool.removeFirst()); if(null != pair) { _totalIdle--; } } catch(NoSuchElementException e) { /* ignored */ } // otherwise if(null == pair) { // if there is a totalMaxActive and we are at the limit then // we have to make room if ((_maxTotal > 0) && (_totalActive + _totalIdle >= _maxTotal)) { clearOldest(); } // check if we can create one // (note we know that the num sleeping is 0, else we wouldn't be here) int active = getActiveCount(key); if ((_maxActive < 0 || active < _maxActive) && (_maxTotal < 0 || _totalActive + _totalIdle < _maxTotal)) { Object obj = _factory.makeObject(key); pair = new ObjectTimestampPair(obj); newlyCreated = true; } else { // the pool is exhausted switch(_whenExhaustedAction) { case WHEN_EXHAUSTED_GROW: Object obj = _factory.makeObject(key); pair = new ObjectTimestampPair(obj); break; case WHEN_EXHAUSTED_FAIL: throw new NoSuchElementException(); case WHEN_EXHAUSTED_BLOCK: try { if(_maxWait <= 0) { wait(); } else { wait(_maxWait); } } catch(InterruptedException e) { // ignored } if(_maxWait > 0 && ((System.currentTimeMillis() - starttime) >= _maxWait)) { throw new NoSuchElementException("Timeout waiting for idle object"); } else { continue; // keep looping } default: throw new IllegalArgumentException("whenExhaustedAction " + _whenExhaustedAction + " not recognized."); } } } _factory.activateObject(key,pair.value); if(_testOnBorrow && !_factory.validateObject(key,pair.value)) { _factory.destroyObject(key,pair.value); if(newlyCreated) { throw new NoSuchElementException("Could not create a validated object"); } // else keep looping } else { incrementActiveCount(key); return pair.value; } } }
50977 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50977/afe8ded20e5e0c03af85d3a451353ef19c9a9ac3/GenericKeyedObjectPool.java/clean/src/java/org/apache/commons/pool/impl/GenericKeyedObjectPool.java
img.getHeight()-10, size, ""+v);
img.getHeight()-10, size, value);
public void paintComponent(Graphics g) { super.paintComponent(g); Graphics2D g2D = (Graphics2D) g; g2D.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g2D.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY); g2D.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR); BufferedImage img = model.getDisplayedImage(); if (img == null) return; //paintXYFrame(g2D); g2D.drawImage(img, null, 0, 0); double v = model.getPixelsSizeX()/model.getZoomFactor(); v *= model.getUnitBarSize(); int size = (int) model.getUnitBarSize(); if (v > 0 && model.isUnitBar()) { paintScaleBar(g2D, img.getWidth()-size-5, img.getHeight()-10, size, ""+v); } }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/4acfb48964ff7be41d59dcef4596afe428857754/BrowserCanvas.java/buggy/SRC/org/openmicroscopy/shoola/agents/imviewer/browser/BrowserCanvas.java
int size = s.length()*charWidth;
private void paintScaleBar(Graphics2D g2D, int x, int y, int l, String s) { FontMetrics fontMetrics = g2D.getFontMetrics(); int hFont = fontMetrics.getHeight()/3; int size = s.length()*charWidth; g2D.setColor(UNIT_BAR_COLOR); g2D.drawString(s, x+l/2-size/2+1, y-hFont); g2D.setStroke(UNIT_BAR_STROKE); g2D.drawLine(x, y, x+l, y); }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/4acfb48964ff7be41d59dcef4596afe428857754/BrowserCanvas.java/buggy/SRC/org/openmicroscopy/shoola/agents/imviewer/browser/BrowserCanvas.java
g2D.drawString(s, x+l/2-size/2+1, y-hFont);
g2D.drawString(s, x+(l-fontMetrics.stringWidth(s))/2+1, y-hFont);
private void paintScaleBar(Graphics2D g2D, int x, int y, int l, String s) { FontMetrics fontMetrics = g2D.getFontMetrics(); int hFont = fontMetrics.getHeight()/3; int size = s.length()*charWidth; g2D.setColor(UNIT_BAR_COLOR); g2D.drawString(s, x+l/2-size/2+1, y-hFont); g2D.setStroke(UNIT_BAR_STROKE); g2D.drawLine(x, y, x+l, y); }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/4acfb48964ff7be41d59dcef4596afe428857754/BrowserCanvas.java/buggy/SRC/org/openmicroscopy/shoola/agents/imviewer/browser/BrowserCanvas.java
assertNotNull(pool);
public void testInvalidWhenExhaustedAction() throws Exception { try { pool.setWhenExhaustedAction(Byte.MAX_VALUE); fail("Expected IllegalArgumentException"); } catch(IllegalArgumentException e) { // expected } try { ObjectPool pool = new GenericObjectPool( new SimpleFactory(), GenericObjectPool.DEFAULT_MAX_ACTIVE, Byte.MAX_VALUE, GenericObjectPool.DEFAULT_MAX_WAIT, GenericObjectPool.DEFAULT_MAX_IDLE, false, false, GenericObjectPool.DEFAULT_TIME_BETWEEN_EVICTION_RUNS_MILLIS, GenericObjectPool.DEFAULT_NUM_TESTS_PER_EVICTION_RUN, GenericObjectPool.DEFAULT_MIN_EVICTABLE_IDLE_TIME_MILLIS, false ); fail("Expected IllegalArgumentException"); } catch(IllegalArgumentException e) { // expected } }
50977 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50977/3af8cd1f6c73a88cdbc7976a676b4169778823d9/TestGenericObjectPool.java/clean/src/test/org/apache/commons/pool/impl/TestGenericObjectPool.java
_evictor = new Evictor(delay); Thread t = new Thread(_evictor); t.setDaemon(true); t.start();
_evictor = new Evictor(); EVICTION_TIMER.schedule(_evictor, delay, delay);
protected synchronized void startEvictor(long delay) { if(null != _evictor) { _evictor.cancel(); _evictor = null; } if(delay > 0) { _evictor = new Evictor(delay); Thread t = new Thread(_evictor); t.setDaemon(true); t.start(); } }
50977 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50977/040416e9a1f3dc7bd49171b76ed6a766164e6fed/GenericObjectPool.java/buggy/src/java/org/apache/commons/pool/impl/GenericObjectPool.java
else if (src == destroyButton)
else if (src == destroyButton)
public void actionPerformed(ActionEvent e) { Object src = e.getSource(); if (src == quitButton) System.exit(0); else if (src == destroyButton) { Destroyer destroyer = new Destroyer(installPath, targetDestroyCheckbox.isSelected(), new DestroyerHandler()); destroyer.start(); } }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/6e8ab3930a21f787bcd0f3cf0b9937f9d50c80c0/UninstallerFrame.java/buggy/src/lib/com/izforge/izpack/uninstaller/UninstallerFrame.java
Destroyer destroyer = new Destroyer(installPath, targetDestroyCheckbox.isSelected(), new DestroyerHandler());
Destroyer destroyer = new Destroyer( installPath, targetDestroyCheckbox.isSelected(), new DestroyerHandler());
public void actionPerformed(ActionEvent e) { Object src = e.getSource(); if (src == quitButton) System.exit(0); else if (src == destroyButton) { Destroyer destroyer = new Destroyer(installPath, targetDestroyCheckbox.isSelected(), new DestroyerHandler()); destroyer.start(); } }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/6e8ab3930a21f787bcd0f3cf0b9937f9d50c80c0/UninstallerFrame.java/buggy/src/lib/com/izforge/izpack/uninstaller/UninstallerFrame.java
public int askQuestion (String title, String question, int choices) { return askQuestion (title, question, choices, -1); }
public int askQuestion(String title, String question, int choices) { return askQuestion(title, question, choices, -1); }
public int askQuestion (String title, String question, int choices) { return askQuestion (title, question, choices, -1); }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/6e8ab3930a21f787bcd0f3cf0b9937f9d50c80c0/UninstallerFrame.java/buggy/src/lib/com/izforge/izpack/uninstaller/UninstallerFrame.java
JOptionPane.showMessageDialog(null, error, title, JOptionPane.OK_CANCEL_OPTION);
JOptionPane.showMessageDialog( null, error, title, JOptionPane.OK_CANCEL_OPTION);
public void emitError(String title, String error) { progressBar.setString(error); JOptionPane.showMessageDialog(null, error, title, JOptionPane.OK_CANCEL_OPTION); }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/6e8ab3930a21f787bcd0f3cf0b9937f9d50c80c0/UninstallerFrame.java/buggy/src/lib/com/izforge/izpack/uninstaller/UninstallerFrame.java
public void emitNotification (String text)
public void emitNotification(String text)
public void emitNotification (String text) { }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/6e8ab3930a21f787bcd0f3cf0b9937f9d50c80c0/UninstallerFrame.java/buggy/src/lib/com/izforge/izpack/uninstaller/UninstallerFrame.java
public boolean emitWarning (String title, String text)
public boolean emitWarning(String title, String text)
public boolean emitWarning (String title, String text) { return (JOptionPane.showConfirmDialog(null, text, title, JOptionPane.OK_CANCEL_OPTION, JOptionPane.WARNING_MESSAGE) == JOptionPane.OK_OPTION); }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/6e8ab3930a21f787bcd0f3cf0b9937f9d50c80c0/UninstallerFrame.java/buggy/src/lib/com/izforge/izpack/uninstaller/UninstallerFrame.java
return (JOptionPane.showConfirmDialog(null, text, title, JOptionPane.OK_CANCEL_OPTION, JOptionPane.WARNING_MESSAGE) == JOptionPane.OK_OPTION);
return ( JOptionPane.showConfirmDialog( null, text, title, JOptionPane.OK_CANCEL_OPTION, JOptionPane.WARNING_MESSAGE) == JOptionPane.OK_OPTION);
public boolean emitWarning (String title, String text) { return (JOptionPane.showConfirmDialog(null, text, title, JOptionPane.OK_CANCEL_OPTION, JOptionPane.WARNING_MESSAGE) == JOptionPane.OK_OPTION); }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/6e8ab3930a21f787bcd0f3cf0b9937f9d50c80c0/UninstallerFrame.java/buggy/src/lib/com/izforge/izpack/uninstaller/UninstallerFrame.java
public void nextStep (String step_name, int step_no, int no_of_substeps)
public void nextStep(String step_name, int step_no, int no_of_substeps)
public void nextStep (String step_name, int step_no, int no_of_substeps) { }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/6e8ab3930a21f787bcd0f3cf0b9937f9d50c80c0/UninstallerFrame.java/buggy/src/lib/com/izforge/izpack/uninstaller/UninstallerFrame.java
public void startAction (String name, int max)
public void startAction(String name, int max)
public void startAction (String name, int max) { progressBar.setMinimum(0); progressBar.setMaximum(max); blockGUI(); }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/6e8ab3930a21f787bcd0f3cf0b9937f9d50c80c0/UninstallerFrame.java/buggy/src/lib/com/izforge/izpack/uninstaller/UninstallerFrame.java
public void stopAction ()
public void stopAction()
public void stopAction () { progressBar.setString(langpack.getString("InstallPanel.finished")); targetDestroyCheckbox.setEnabled(false); destroyButton.setEnabled(false); releaseGUI(); }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/6e8ab3930a21f787bcd0f3cf0b9937f9d50c80c0/UninstallerFrame.java/buggy/src/lib/com/izforge/izpack/uninstaller/UninstallerFrame.java
langpack = new LocaleDatabase(getClass().getResourceAsStream("/langpack.xml"));
langpack = new LocaleDatabase(getClass().getResourceAsStream("/langpack.xml"));
public UninstallerFrame() throws Exception { super("IzPack - Uninstaller"); // Initializations langpack = new LocaleDatabase(getClass().getResourceAsStream("/langpack.xml")); getInstallPath(); icons = new IconsDatabase(); loadIcons(); UIManager.put("OptionPane.yesButtonText", langpack.getString("installer.yes")); UIManager.put("OptionPane.noButtonText", langpack.getString("installer.no")); UIManager.put("OptionPane.cancelButtonText", langpack.getString("installer.cancel")); // Sets the frame icon setIconImage(icons.getImageIcon("JFrameIcon").getImage()); // We build the GUI & show it buildGUI(); addWindowListener(new WindowHandler()); pack(); centerFrame(this); setResizable(false); setVisible(true); }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/6e8ab3930a21f787bcd0f3cf0b9937f9d50c80c0/UninstallerFrame.java/buggy/src/lib/com/izforge/izpack/uninstaller/UninstallerFrame.java
UIManager.put("OptionPane.yesButtonText", langpack.getString("installer.yes")); UIManager.put("OptionPane.noButtonText", langpack.getString("installer.no")); UIManager.put("OptionPane.cancelButtonText", langpack.getString("installer.cancel"));
UIManager.put( "OptionPane.yesButtonText", langpack.getString("installer.yes")); UIManager.put( "OptionPane.noButtonText", langpack.getString("installer.no")); UIManager.put( "OptionPane.cancelButtonText", langpack.getString("installer.cancel"));
public UninstallerFrame() throws Exception { super("IzPack - Uninstaller"); // Initializations langpack = new LocaleDatabase(getClass().getResourceAsStream("/langpack.xml")); getInstallPath(); icons = new IconsDatabase(); loadIcons(); UIManager.put("OptionPane.yesButtonText", langpack.getString("installer.yes")); UIManager.put("OptionPane.noButtonText", langpack.getString("installer.no")); UIManager.put("OptionPane.cancelButtonText", langpack.getString("installer.cancel")); // Sets the frame icon setIconImage(icons.getImageIcon("JFrameIcon").getImage()); // We build the GUI & show it buildGUI(); addWindowListener(new WindowHandler()); pack(); centerFrame(this); setResizable(false); setVisible(true); }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/6e8ab3930a21f787bcd0f3cf0b9937f9d50c80c0/UninstallerFrame.java/buggy/src/lib/com/izforge/izpack/uninstaller/UninstallerFrame.java
private void buildConstraints(GridBagConstraints gbc, int gx, int gy, int gw, int gh, double wx, double wy)
private void buildConstraints( GridBagConstraints gbc, int gx, int gy, int gw, int gh, double wx, double wy)
private void buildConstraints(GridBagConstraints gbc, int gx, int gy, int gw, int gh, double wx, double wy) { gbc.gridx = gx; gbc.gridy = gy; gbc.gridwidth = gw; gbc.gridheight = gh; gbc.weightx = wx; gbc.weighty = wy; }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/6e8ab3930a21f787bcd0f3cf0b9937f9d50c80c0/UninstallerFrame.java/buggy/src/lib/com/izforge/izpack/uninstaller/UninstallerFrame.java
glassPane.addMouseListener( new MouseAdapter() { }); glassPane.addMouseMotionListener( new MouseMotionAdapter() { }); glassPane.addKeyListener( new KeyAdapter() { });
glassPane.addMouseListener(new MouseAdapter() { }); glassPane.addMouseMotionListener(new MouseMotionAdapter() { }); glassPane.addKeyListener(new KeyAdapter() { });
private void buildGUI() { // We initialize our layout JPanel contentPane = (JPanel) getContentPane(); layout = new GridBagLayout(); contentPane.setLayout(layout); gbConstraints = new GridBagConstraints(); gbConstraints.insets = new Insets(5, 5, 5, 5); // We prepare our action handler ActionsHandler handler = new ActionsHandler(); // Prepares the glass pane to block gui interaction when needed JPanel glassPane = (JPanel) getGlassPane(); glassPane.addMouseListener( new MouseAdapter() { }); glassPane.addMouseMotionListener( new MouseMotionAdapter() { }); glassPane.addKeyListener( new KeyAdapter() { }); // We set-up the buttons factory ButtonFactory.useButtonIcons(); ButtonFactory.useHighlightButtons(); // We put our components warningLabel = new JLabel(langpack.getString("uninstaller.warning"), icons.getImageIcon("warning"), JLabel.TRAILING); buildConstraints(gbConstraints, 0, 0, 2, 1, 1.0, 0.0); gbConstraints.anchor = GridBagConstraints.WEST; gbConstraints.fill = GridBagConstraints.NONE; layout.addLayoutComponent(warningLabel, gbConstraints); contentPane.add(warningLabel); targetDestroyCheckbox = new JCheckBox(langpack.getString("uninstaller.destroytarget") + installPath, false); buildConstraints(gbConstraints, 0, 1, 2, 1, 1.0, 0.0); layout.addLayoutComponent(targetDestroyCheckbox, gbConstraints); contentPane.add(targetDestroyCheckbox); gbConstraints.fill = GridBagConstraints.HORIZONTAL; progressBar = new JProgressBar(); progressBar.setStringPainted(true); progressBar.setString(langpack.getString("InstallPanel.begin")); buildConstraints(gbConstraints, 0, 2, 2, 1, 1.0, 0.0); layout.addLayoutComponent(progressBar, gbConstraints); contentPane.add(progressBar); destroyButton = ButtonFactory.createButton(langpack.getString("uninstaller.uninstall"), icons.getImageIcon("delete"), buttonsHColor); destroyButton.addActionListener(handler); buildConstraints(gbConstraints, 0, 3, 1, 1, 0.5, 0.0); gbConstraints.fill = GridBagConstraints.NONE; gbConstraints.anchor = GridBagConstraints.WEST; layout.addLayoutComponent(destroyButton, gbConstraints); contentPane.add(destroyButton); quitButton = ButtonFactory.createButton(langpack.getString("installer.quit"), icons.getImageIcon("stop"), buttonsHColor); quitButton.addActionListener(handler); buildConstraints(gbConstraints, 1, 3, 1, 1, 0.5, 0.0); gbConstraints.anchor = GridBagConstraints.EAST; layout.addLayoutComponent(quitButton, gbConstraints); contentPane.add(quitButton); }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/6e8ab3930a21f787bcd0f3cf0b9937f9d50c80c0/UninstallerFrame.java/buggy/src/lib/com/izforge/izpack/uninstaller/UninstallerFrame.java
warningLabel = new JLabel(langpack.getString("uninstaller.warning"), icons.getImageIcon("warning"), JLabel.TRAILING);
warningLabel = new JLabel( langpack.getString("uninstaller.warning"), icons.getImageIcon("warning"), JLabel.TRAILING);
private void buildGUI() { // We initialize our layout JPanel contentPane = (JPanel) getContentPane(); layout = new GridBagLayout(); contentPane.setLayout(layout); gbConstraints = new GridBagConstraints(); gbConstraints.insets = new Insets(5, 5, 5, 5); // We prepare our action handler ActionsHandler handler = new ActionsHandler(); // Prepares the glass pane to block gui interaction when needed JPanel glassPane = (JPanel) getGlassPane(); glassPane.addMouseListener( new MouseAdapter() { }); glassPane.addMouseMotionListener( new MouseMotionAdapter() { }); glassPane.addKeyListener( new KeyAdapter() { }); // We set-up the buttons factory ButtonFactory.useButtonIcons(); ButtonFactory.useHighlightButtons(); // We put our components warningLabel = new JLabel(langpack.getString("uninstaller.warning"), icons.getImageIcon("warning"), JLabel.TRAILING); buildConstraints(gbConstraints, 0, 0, 2, 1, 1.0, 0.0); gbConstraints.anchor = GridBagConstraints.WEST; gbConstraints.fill = GridBagConstraints.NONE; layout.addLayoutComponent(warningLabel, gbConstraints); contentPane.add(warningLabel); targetDestroyCheckbox = new JCheckBox(langpack.getString("uninstaller.destroytarget") + installPath, false); buildConstraints(gbConstraints, 0, 1, 2, 1, 1.0, 0.0); layout.addLayoutComponent(targetDestroyCheckbox, gbConstraints); contentPane.add(targetDestroyCheckbox); gbConstraints.fill = GridBagConstraints.HORIZONTAL; progressBar = new JProgressBar(); progressBar.setStringPainted(true); progressBar.setString(langpack.getString("InstallPanel.begin")); buildConstraints(gbConstraints, 0, 2, 2, 1, 1.0, 0.0); layout.addLayoutComponent(progressBar, gbConstraints); contentPane.add(progressBar); destroyButton = ButtonFactory.createButton(langpack.getString("uninstaller.uninstall"), icons.getImageIcon("delete"), buttonsHColor); destroyButton.addActionListener(handler); buildConstraints(gbConstraints, 0, 3, 1, 1, 0.5, 0.0); gbConstraints.fill = GridBagConstraints.NONE; gbConstraints.anchor = GridBagConstraints.WEST; layout.addLayoutComponent(destroyButton, gbConstraints); contentPane.add(destroyButton); quitButton = ButtonFactory.createButton(langpack.getString("installer.quit"), icons.getImageIcon("stop"), buttonsHColor); quitButton.addActionListener(handler); buildConstraints(gbConstraints, 1, 3, 1, 1, 0.5, 0.0); gbConstraints.anchor = GridBagConstraints.EAST; layout.addLayoutComponent(quitButton, gbConstraints); contentPane.add(quitButton); }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/6e8ab3930a21f787bcd0f3cf0b9937f9d50c80c0/UninstallerFrame.java/buggy/src/lib/com/izforge/izpack/uninstaller/UninstallerFrame.java
targetDestroyCheckbox = new JCheckBox(langpack.getString("uninstaller.destroytarget") + installPath, false);
targetDestroyCheckbox = new JCheckBox( langpack.getString("uninstaller.destroytarget") + installPath, false);
private void buildGUI() { // We initialize our layout JPanel contentPane = (JPanel) getContentPane(); layout = new GridBagLayout(); contentPane.setLayout(layout); gbConstraints = new GridBagConstraints(); gbConstraints.insets = new Insets(5, 5, 5, 5); // We prepare our action handler ActionsHandler handler = new ActionsHandler(); // Prepares the glass pane to block gui interaction when needed JPanel glassPane = (JPanel) getGlassPane(); glassPane.addMouseListener( new MouseAdapter() { }); glassPane.addMouseMotionListener( new MouseMotionAdapter() { }); glassPane.addKeyListener( new KeyAdapter() { }); // We set-up the buttons factory ButtonFactory.useButtonIcons(); ButtonFactory.useHighlightButtons(); // We put our components warningLabel = new JLabel(langpack.getString("uninstaller.warning"), icons.getImageIcon("warning"), JLabel.TRAILING); buildConstraints(gbConstraints, 0, 0, 2, 1, 1.0, 0.0); gbConstraints.anchor = GridBagConstraints.WEST; gbConstraints.fill = GridBagConstraints.NONE; layout.addLayoutComponent(warningLabel, gbConstraints); contentPane.add(warningLabel); targetDestroyCheckbox = new JCheckBox(langpack.getString("uninstaller.destroytarget") + installPath, false); buildConstraints(gbConstraints, 0, 1, 2, 1, 1.0, 0.0); layout.addLayoutComponent(targetDestroyCheckbox, gbConstraints); contentPane.add(targetDestroyCheckbox); gbConstraints.fill = GridBagConstraints.HORIZONTAL; progressBar = new JProgressBar(); progressBar.setStringPainted(true); progressBar.setString(langpack.getString("InstallPanel.begin")); buildConstraints(gbConstraints, 0, 2, 2, 1, 1.0, 0.0); layout.addLayoutComponent(progressBar, gbConstraints); contentPane.add(progressBar); destroyButton = ButtonFactory.createButton(langpack.getString("uninstaller.uninstall"), icons.getImageIcon("delete"), buttonsHColor); destroyButton.addActionListener(handler); buildConstraints(gbConstraints, 0, 3, 1, 1, 0.5, 0.0); gbConstraints.fill = GridBagConstraints.NONE; gbConstraints.anchor = GridBagConstraints.WEST; layout.addLayoutComponent(destroyButton, gbConstraints); contentPane.add(destroyButton); quitButton = ButtonFactory.createButton(langpack.getString("installer.quit"), icons.getImageIcon("stop"), buttonsHColor); quitButton.addActionListener(handler); buildConstraints(gbConstraints, 1, 3, 1, 1, 0.5, 0.0); gbConstraints.anchor = GridBagConstraints.EAST; layout.addLayoutComponent(quitButton, gbConstraints); contentPane.add(quitButton); }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/6e8ab3930a21f787bcd0f3cf0b9937f9d50c80c0/UninstallerFrame.java/buggy/src/lib/com/izforge/izpack/uninstaller/UninstallerFrame.java
destroyButton = ButtonFactory.createButton(langpack.getString("uninstaller.uninstall"), icons.getImageIcon("delete"), buttonsHColor);
destroyButton = ButtonFactory.createButton( langpack.getString("uninstaller.uninstall"), icons.getImageIcon("delete"), buttonsHColor);
private void buildGUI() { // We initialize our layout JPanel contentPane = (JPanel) getContentPane(); layout = new GridBagLayout(); contentPane.setLayout(layout); gbConstraints = new GridBagConstraints(); gbConstraints.insets = new Insets(5, 5, 5, 5); // We prepare our action handler ActionsHandler handler = new ActionsHandler(); // Prepares the glass pane to block gui interaction when needed JPanel glassPane = (JPanel) getGlassPane(); glassPane.addMouseListener( new MouseAdapter() { }); glassPane.addMouseMotionListener( new MouseMotionAdapter() { }); glassPane.addKeyListener( new KeyAdapter() { }); // We set-up the buttons factory ButtonFactory.useButtonIcons(); ButtonFactory.useHighlightButtons(); // We put our components warningLabel = new JLabel(langpack.getString("uninstaller.warning"), icons.getImageIcon("warning"), JLabel.TRAILING); buildConstraints(gbConstraints, 0, 0, 2, 1, 1.0, 0.0); gbConstraints.anchor = GridBagConstraints.WEST; gbConstraints.fill = GridBagConstraints.NONE; layout.addLayoutComponent(warningLabel, gbConstraints); contentPane.add(warningLabel); targetDestroyCheckbox = new JCheckBox(langpack.getString("uninstaller.destroytarget") + installPath, false); buildConstraints(gbConstraints, 0, 1, 2, 1, 1.0, 0.0); layout.addLayoutComponent(targetDestroyCheckbox, gbConstraints); contentPane.add(targetDestroyCheckbox); gbConstraints.fill = GridBagConstraints.HORIZONTAL; progressBar = new JProgressBar(); progressBar.setStringPainted(true); progressBar.setString(langpack.getString("InstallPanel.begin")); buildConstraints(gbConstraints, 0, 2, 2, 1, 1.0, 0.0); layout.addLayoutComponent(progressBar, gbConstraints); contentPane.add(progressBar); destroyButton = ButtonFactory.createButton(langpack.getString("uninstaller.uninstall"), icons.getImageIcon("delete"), buttonsHColor); destroyButton.addActionListener(handler); buildConstraints(gbConstraints, 0, 3, 1, 1, 0.5, 0.0); gbConstraints.fill = GridBagConstraints.NONE; gbConstraints.anchor = GridBagConstraints.WEST; layout.addLayoutComponent(destroyButton, gbConstraints); contentPane.add(destroyButton); quitButton = ButtonFactory.createButton(langpack.getString("installer.quit"), icons.getImageIcon("stop"), buttonsHColor); quitButton.addActionListener(handler); buildConstraints(gbConstraints, 1, 3, 1, 1, 0.5, 0.0); gbConstraints.anchor = GridBagConstraints.EAST; layout.addLayoutComponent(quitButton, gbConstraints); contentPane.add(quitButton); }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/6e8ab3930a21f787bcd0f3cf0b9937f9d50c80c0/UninstallerFrame.java/buggy/src/lib/com/izforge/izpack/uninstaller/UninstallerFrame.java
quitButton = ButtonFactory.createButton(langpack.getString("installer.quit"), icons.getImageIcon("stop"), buttonsHColor);
quitButton = ButtonFactory.createButton( langpack.getString("installer.quit"), icons.getImageIcon("stop"), buttonsHColor);
private void buildGUI() { // We initialize our layout JPanel contentPane = (JPanel) getContentPane(); layout = new GridBagLayout(); contentPane.setLayout(layout); gbConstraints = new GridBagConstraints(); gbConstraints.insets = new Insets(5, 5, 5, 5); // We prepare our action handler ActionsHandler handler = new ActionsHandler(); // Prepares the glass pane to block gui interaction when needed JPanel glassPane = (JPanel) getGlassPane(); glassPane.addMouseListener( new MouseAdapter() { }); glassPane.addMouseMotionListener( new MouseMotionAdapter() { }); glassPane.addKeyListener( new KeyAdapter() { }); // We set-up the buttons factory ButtonFactory.useButtonIcons(); ButtonFactory.useHighlightButtons(); // We put our components warningLabel = new JLabel(langpack.getString("uninstaller.warning"), icons.getImageIcon("warning"), JLabel.TRAILING); buildConstraints(gbConstraints, 0, 0, 2, 1, 1.0, 0.0); gbConstraints.anchor = GridBagConstraints.WEST; gbConstraints.fill = GridBagConstraints.NONE; layout.addLayoutComponent(warningLabel, gbConstraints); contentPane.add(warningLabel); targetDestroyCheckbox = new JCheckBox(langpack.getString("uninstaller.destroytarget") + installPath, false); buildConstraints(gbConstraints, 0, 1, 2, 1, 1.0, 0.0); layout.addLayoutComponent(targetDestroyCheckbox, gbConstraints); contentPane.add(targetDestroyCheckbox); gbConstraints.fill = GridBagConstraints.HORIZONTAL; progressBar = new JProgressBar(); progressBar.setStringPainted(true); progressBar.setString(langpack.getString("InstallPanel.begin")); buildConstraints(gbConstraints, 0, 2, 2, 1, 1.0, 0.0); layout.addLayoutComponent(progressBar, gbConstraints); contentPane.add(progressBar); destroyButton = ButtonFactory.createButton(langpack.getString("uninstaller.uninstall"), icons.getImageIcon("delete"), buttonsHColor); destroyButton.addActionListener(handler); buildConstraints(gbConstraints, 0, 3, 1, 1, 0.5, 0.0); gbConstraints.fill = GridBagConstraints.NONE; gbConstraints.anchor = GridBagConstraints.WEST; layout.addLayoutComponent(destroyButton, gbConstraints); contentPane.add(destroyButton); quitButton = ButtonFactory.createButton(langpack.getString("installer.quit"), icons.getImageIcon("stop"), buttonsHColor); quitButton.addActionListener(handler); buildConstraints(gbConstraints, 1, 3, 1, 1, 0.5, 0.0); gbConstraints.anchor = GridBagConstraints.EAST; layout.addLayoutComponent(quitButton, gbConstraints); contentPane.add(quitButton); }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/6e8ab3930a21f787bcd0f3cf0b9937f9d50c80c0/UninstallerFrame.java/buggy/src/lib/com/izforge/izpack/uninstaller/UninstallerFrame.java
frame.setLocation((screenSize.width - frameSize.width) / 2,
frame.setLocation( (screenSize.width - frameSize.width) / 2,
private void centerFrame(Window frame) { Dimension frameSize = frame.getSize(); Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); frame.setLocation((screenSize.width - frameSize.width) / 2, (screenSize.height - frameSize.height) / 2 - 10); }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/6e8ab3930a21f787bcd0f3cf0b9937f9d50c80c0/UninstallerFrame.java/buggy/src/lib/com/izforge/izpack/uninstaller/UninstallerFrame.java
if (currentPos == endPos)
if (currentPos == endPos && width <= maxAllowed)
private void divideLabel () { int width; int startPos; int currentPos; int lastPos; int endPos; line.clear (); FontMetrics fm = this.getFontMetrics (this.getFont ()); startPos = 0; currentPos = startPos; lastPos = currentPos; endPos = (labelText.length () - 1); while (currentPos < endPos) { width = 0; // ---------------------------------------------------------------- // find the first substring that occupies more than the granted space. // Break at the end of the string or a line break // ---------------------------------------------------------------- while ( (width < maxAllowed) && (currentPos < endPos) && (labelText.charAt (currentPos) != NEW_LINE)) { lastPos = currentPos; currentPos = getPosition (labelText, currentPos, WHITE_SPACE, FOUND); width = fm.stringWidth (labelText.substring (startPos, currentPos)); } // ---------------------------------------------------------------- // if we have a line break we want to copy everything up to currentPos // ---------------------------------------------------------------- if (labelText.charAt (currentPos) == NEW_LINE) { lastPos = currentPos; } // ---------------------------------------------------------------- // if we are at the end of the string we want to copy everything up to // the last character. Since there seems to be a problem to get the last // character if the substring definition ends at the very last character // we have to call a different substring function than normal. // ---------------------------------------------------------------- if (currentPos == endPos) { lastPos = currentPos; String s = labelText.substring (startPos); line.addElement (s); } // ---------------------------------------------------------------- // in all other cases copy the substring that we have found to fit and // add it as a new line of text to the line vector. // ---------------------------------------------------------------- else { // ------------------------------------------------------------ // make sure it's not a single word. If so we must break it at the // proper location. // ------------------------------------------------------------ if (lastPos == startPos) { lastPos = startPos + breakWord (labelText.substring (startPos, currentPos), fm); } String s = labelText.substring (startPos, lastPos); line.addElement (s); } // ---------------------------------------------------------------- // seek for the end of the white space to cut out any unnecessary spaces // and tabs and set the new start condition. // ---------------------------------------------------------------- startPos = getPosition (labelText, lastPos, SPACES, NOT_FOUND); currentPos = startPos; } numLines = line.size (); lineWidth = new int [numLines]; }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/2ff9868be7c3f3a1e611ca2fc9020b853e1c7c55/MultiLineLabel.java/buggy/src/lib/com/izforge/izpack/util/MultiLineLabel.java
infoLabel = new JLabel(parent.langpack.getString("InfoPanel.info"), parent.icons.getImageIcon("edit"), JLabel.TRAILING);
infoLabel = new JLabel( parent.langpack.getString("InfoPanel.info"), parent.icons.getImageIcon("edit"), JLabel.TRAILING);
public InfoPanel(InstallerFrame parent, InstallData idata) { super(parent, idata); // We initialize our layout layout = new GridBagLayout(); gbConstraints = new GridBagConstraints(); setLayout(layout); // We load the text loadInfo(); // We add the components infoLabel = new JLabel(parent.langpack.getString("InfoPanel.info"), parent.icons.getImageIcon("edit"), JLabel.TRAILING); parent.buildConstraints(gbConstraints, 0, 0, 1, 1, 1.0, 0.1); gbConstraints.insets = new Insets(5, 5, 5, 5); gbConstraints.fill = GridBagConstraints.NONE; gbConstraints.anchor = GridBagConstraints.SOUTHWEST; layout.addLayoutComponent(infoLabel, gbConstraints); add(infoLabel); textArea = new JTextArea(info); textArea.setCaretPosition(0); textArea.setEditable(false); scroller = new JScrollPane(textArea); parent.buildConstraints(gbConstraints, 0, 1, 1, 1, 1.0, 0.9); gbConstraints.fill = GridBagConstraints.BOTH; gbConstraints.anchor = GridBagConstraints.CENTER; layout.addLayoutComponent(scroller, gbConstraints); add(scroller); }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/6e8ab3930a21f787bcd0f3cf0b9937f9d50c80c0/InfoPanel.java/clean/src/lib/com/izforge/izpack/panels/InfoPanel.java
} catch (Exception err)
} catch (Exception err)
private void loadInfo() { try { String resNamePrifix = "InfoPanel.info"; info = ResourceManager.getInstance().getTextResource(resNamePrifix); } catch (Exception err) { info = "Error : could not load the info text !"; } }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/6e8ab3930a21f787bcd0f3cf0b9937f9d50c80c0/InfoPanel.java/clean/src/lib/com/izforge/izpack/panels/InfoPanel.java
generateThirdBodyReactionList(p_reactionModel, p_beginStatus, p_temperature, p_pressure);
public SystemSnapshot solve(boolean p_initialization, ReactionModel p_reactionModel, boolean p_reactionChanged, SystemSnapshot p_beginStatus, ReactionTime p_beginTime, ReactionTime p_endTime, Temperature p_temperature, Pressure p_pressure, boolean p_conditionChanged) { //#[ operation solve(boolean,ReactionModel,boolean,SystemSnapshot,ReactionTime,ReactionTime,Temperature,Pressure,boolean) ReactionTime rt = p_beginStatus.getTime(); if (!rt.equals(p_beginTime)) throw new InvalidBeginStatusException(); // set time double tBegin = p_beginTime.getStandardTime(); double tEnd = p_endTime.getStandardTime(); // set reaction set //if (p_initialization || p_reactionChanged || p_conditionChanged) { //generateThirdBodyReactionList(p_reactionModel, p_beginStatus, p_temperature, p_pressure); LinkedList rList = generatePDepODEReactionList(p_reactionModel, p_beginStatus, p_temperature, p_pressure); //generateAllODEReactionList(p_reactionModel, p_beginStatus, p_temperature, p_pressure); //p_reactionChanged = true; //} // set numbers System.out.println("Total number of reactions to Daspk is "+rList.size()); int nState = p_reactionModel.getSpeciesNumber(); int nParameter = 0; LinkedList initialSpecies = new LinkedList();// if (parameterInfor!=null) nParameter = parameterInfor.length; if (parameterInfor != 0) { nParameter = rList.size(); //svp if (initialStatus == null) System.out.println("initialStatus = null"); Iterator spe_iter = initialStatus.getSpeciesStatus(); while (spe_iter.hasNext()) { SpeciesStatus ss = (SpeciesStatus) spe_iter.next(); String name = ss.getSpecies().getName(); initialSpecies.add(name); nParameter++; } } int neq = nState*(nParameter+1); // set temperature and pressure double T = p_temperature.getK(); double P = p_pressure.getAtm(); // set initial value of y and yprime; double [] y = new double[neq]; double [] yprime = new double[neq]; //double numberOfReactedSpecies=0; // get the present status at t_begin, and set y and y' accordingly System.out.println("Before ODE: " + String.valueOf(tBegin) + "SEC"); System.out.println("End at : " + String.valueOf(tEnd) + "SEC"); for (Iterator iter = p_beginStatus.getSpeciesStatus(); iter.hasNext(); ) { SpeciesStatus ss = (SpeciesStatus)iter.next(); double conc = ss.getConcentration(); double flux = ss.getFlux(); if (ss.isReactedSpecies()) { Species spe = ss.getSpecies(); int id = getRealID(spe); System.out.println(String.valueOf(spe.getID()) + '\t' + spe.getName() + '\t' + String.valueOf(conc) + '\t' + String.valueOf(flux)); y[id-1] = conc; yprime[id-1] = flux; } } if (nParameter != 0){//svp parameterInforArray = new ParameterInfor[nParameter]; for (int i = 1; i <= rList.size(); i++){ parameterInforArray[i-1] = new ParameterInfor("k",i,0.00); } for (int i=rList.size()+1; i<=nParameter;i++){ parameterInforArray[i - 1] = new ParameterInfor("CO", nParameter, 0.00); } if (p_beginTime.getTime() == 0 || p_beginTime.getTime() == 0.00) { LinkedList sensitivityStatus = new LinkedList(); int reactionNumber = rList.size(); int speciesNumber = p_reactionModel.getSpeciesNumber();// for (int i=0;i<reactionNumber*speciesNumber;i++){ for (int i=0; i<nParameter*speciesNumber;i++){ sensitivityStatus.add(i,null); } p_beginStatus.addSensitivity(sensitivityStatus); double sflux = 1; Iterator species_iter = p_reactionModel.getSpecies(); while (species_iter.hasNext()) { Species spe = (Species) species_iter.next(); int m = getRealID(spe); for (int p=0;p<nParameter;p++){ int k = m + (p+1) * speciesNumber - 1; if (p >= rList.size()){ int speciesNum = p-rList.size(); String name = (String)initialSpecies.get(speciesNum); sflux = 0; SensitivityStatus senStatus; if (name.equalsIgnoreCase(spe.getName())){ senStatus = new SensitivityStatus(1, sflux, m, p + 1); y[k] = 1; } else{ senStatus = new SensitivityStatus(0,sflux,m,p+1); y[k]=0; } sensitivityStatus.add(k - p_reactionModel.getSpeciesNumber(), senStatus); p_beginStatus.putSensitivityStatus(k - speciesNumber, senStatus); yprime[k] = sflux; } else{ Reaction rxn = (Reaction)rList.get(p); if (rxn.containsAsProduct(spe)) { sflux = 1; Iterator new_iter = rxn.getReactants(); while (new_iter.hasNext()) { ChemGraph cg = (ChemGraph) new_iter.next(); Species reactant = cg.getSpecies(); SpeciesStatus ss = p_beginStatus.getSpeciesStatus(reactant); if (ss != null) { sflux *= ss.getConcentration(); } else { sflux = 0; } } } if (rxn.containsAsReactant(spe)) { sflux = -1; Iterator new_iter = rxn.getReactants(); while (new_iter.hasNext()) { ChemGraph cg = (ChemGraph) new_iter.next(); Species reactant = cg.getSpecies(); SpeciesStatus ss = p_beginStatus.getSpeciesStatus(reactant); if (ss != null) { sflux *= ss.getConcentration(); } else { sflux = 0; } } } else { sflux = 0; } SensitivityStatus senStatus = new SensitivityStatus(0, sflux, m, p+1); sensitivityStatus.add(k-p_reactionModel.getSpeciesNumber(),senStatus); p_beginStatus.putSensitivityStatus(k-speciesNumber,senStatus); y[k] = 0; yprime[k] = sflux; } } } } else { for (int i = p_reactionModel.getSpeciesNumber(); i < y.length; i++) { SensitivityStatus ss = (SensitivityStatus) p_beginStatus. getSensitivityStatus(i-p_reactionModel.getSpeciesNumber()); double sens = ss.getSensitivity(); double sflux = ss.getSFlux(); int reactionNumber = rList.size(); int speciesNumber = p_reactionModel.getSpeciesNumber(); Iterator species_iter = p_reactionModel.getSpecies(); y[i] = sens; yprime[i] = sflux; } } } //System.out.println("Number of Reacted Species is " + numberOfReactedSpecies); int idid; HashMap speStatus = new HashMap(); LinkedList senStatus = new LinkedList(); double[] tPresent = {tBegin}; int temp = 1; if (nParameter==0) { idid = solveDAE(p_initialization, reactionList, true, thirdBodyReactionList, nState, y, yprime, tBegin, tEnd, this.rtol, this.atol, T, P); if (idid !=1 && idid != 2 && idid != 3) { System.out.println("The idid from DASPK was "+idid + " at time "+tPresent[0]); throw new DynamicSimulatorException("DASPK: SA off."); } System.out.println("After ODE: from " + String.valueOf(tBegin) + " SEC to " + String.valueOf(tEnd) + "SEC"); speStatus = generateSpeciesStatus(p_reactionModel, y, yprime, 0); } else { idid = solveSEN(p_initialization, reactionList, p_reactionChanged, thirdBodyReactionList, nState, nParameter, this.parameterInforArray, y, yprime, tBegin, tEnd, this.rtol, this.atol, T, P); if (idid != 2 && idid != 3) throw new DynamicSimulatorException("DASPK: SA on."); //speStatus = generateSpeciesStatus(p_reactionModel, y, yprime, nParameter); System.out.println("After ODE: from " + String.valueOf(tBegin) + " SEC to " + String.valueOf(tEnd) + "SEC"); speStatus = generateSpeciesStatus(p_reactionModel, y, yprime, nParameter); senStatus = generateSensitivityStatus(p_reactionModel,y,yprime,nParameter); SystemSnapshot sss = new SystemSnapshot(p_endTime, speStatus, senStatus, p_beginStatus.getTemperature(), p_beginStatus.getPressure()); sss.setIDTranslator(IDTranslator); sss.setReactionList(rList); return sss; } SystemSnapshot sss = new SystemSnapshot(p_endTime, speStatus, p_beginStatus.getTemperature(), p_beginStatus.getPressure()); //ReactionSystem.outputAllPathways(SpeciesDictionary.getSpeciesFromName("CH4"), rList, sss, p_temperature); //ReactionSystem.outputAllPathways(SpeciesDictionary.getSpeciesFromName("CO"), rList, sss, p_temperature); //ReactionSystem.outputAllPathways(SpeciesDictionary.getSpeciesFromName("CO2"), rList, sss, p_temperature); return sss; //#] }
58381 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/58381/a3611fafd109f1581462295f20f143bdc7ad935d/JDASPK.java/buggy/jing/rxnSys/JDASPK.java
nParameter = rList.size();
nParameter = rList.size()+thirdBodyReactionList.length;
public SystemSnapshot solve(boolean p_initialization, ReactionModel p_reactionModel, boolean p_reactionChanged, SystemSnapshot p_beginStatus, ReactionTime p_beginTime, ReactionTime p_endTime, Temperature p_temperature, Pressure p_pressure, boolean p_conditionChanged) { //#[ operation solve(boolean,ReactionModel,boolean,SystemSnapshot,ReactionTime,ReactionTime,Temperature,Pressure,boolean) ReactionTime rt = p_beginStatus.getTime(); if (!rt.equals(p_beginTime)) throw new InvalidBeginStatusException(); // set time double tBegin = p_beginTime.getStandardTime(); double tEnd = p_endTime.getStandardTime(); // set reaction set //if (p_initialization || p_reactionChanged || p_conditionChanged) { //generateThirdBodyReactionList(p_reactionModel, p_beginStatus, p_temperature, p_pressure); LinkedList rList = generatePDepODEReactionList(p_reactionModel, p_beginStatus, p_temperature, p_pressure); //generateAllODEReactionList(p_reactionModel, p_beginStatus, p_temperature, p_pressure); //p_reactionChanged = true; //} // set numbers System.out.println("Total number of reactions to Daspk is "+rList.size()); int nState = p_reactionModel.getSpeciesNumber(); int nParameter = 0; LinkedList initialSpecies = new LinkedList();// if (parameterInfor!=null) nParameter = parameterInfor.length; if (parameterInfor != 0) { nParameter = rList.size(); //svp if (initialStatus == null) System.out.println("initialStatus = null"); Iterator spe_iter = initialStatus.getSpeciesStatus(); while (spe_iter.hasNext()) { SpeciesStatus ss = (SpeciesStatus) spe_iter.next(); String name = ss.getSpecies().getName(); initialSpecies.add(name); nParameter++; } } int neq = nState*(nParameter+1); // set temperature and pressure double T = p_temperature.getK(); double P = p_pressure.getAtm(); // set initial value of y and yprime; double [] y = new double[neq]; double [] yprime = new double[neq]; //double numberOfReactedSpecies=0; // get the present status at t_begin, and set y and y' accordingly System.out.println("Before ODE: " + String.valueOf(tBegin) + "SEC"); System.out.println("End at : " + String.valueOf(tEnd) + "SEC"); for (Iterator iter = p_beginStatus.getSpeciesStatus(); iter.hasNext(); ) { SpeciesStatus ss = (SpeciesStatus)iter.next(); double conc = ss.getConcentration(); double flux = ss.getFlux(); if (ss.isReactedSpecies()) { Species spe = ss.getSpecies(); int id = getRealID(spe); System.out.println(String.valueOf(spe.getID()) + '\t' + spe.getName() + '\t' + String.valueOf(conc) + '\t' + String.valueOf(flux)); y[id-1] = conc; yprime[id-1] = flux; } } if (nParameter != 0){//svp parameterInforArray = new ParameterInfor[nParameter]; for (int i = 1; i <= rList.size(); i++){ parameterInforArray[i-1] = new ParameterInfor("k",i,0.00); } for (int i=rList.size()+1; i<=nParameter;i++){ parameterInforArray[i - 1] = new ParameterInfor("CO", nParameter, 0.00); } if (p_beginTime.getTime() == 0 || p_beginTime.getTime() == 0.00) { LinkedList sensitivityStatus = new LinkedList(); int reactionNumber = rList.size(); int speciesNumber = p_reactionModel.getSpeciesNumber();// for (int i=0;i<reactionNumber*speciesNumber;i++){ for (int i=0; i<nParameter*speciesNumber;i++){ sensitivityStatus.add(i,null); } p_beginStatus.addSensitivity(sensitivityStatus); double sflux = 1; Iterator species_iter = p_reactionModel.getSpecies(); while (species_iter.hasNext()) { Species spe = (Species) species_iter.next(); int m = getRealID(spe); for (int p=0;p<nParameter;p++){ int k = m + (p+1) * speciesNumber - 1; if (p >= rList.size()){ int speciesNum = p-rList.size(); String name = (String)initialSpecies.get(speciesNum); sflux = 0; SensitivityStatus senStatus; if (name.equalsIgnoreCase(spe.getName())){ senStatus = new SensitivityStatus(1, sflux, m, p + 1); y[k] = 1; } else{ senStatus = new SensitivityStatus(0,sflux,m,p+1); y[k]=0; } sensitivityStatus.add(k - p_reactionModel.getSpeciesNumber(), senStatus); p_beginStatus.putSensitivityStatus(k - speciesNumber, senStatus); yprime[k] = sflux; } else{ Reaction rxn = (Reaction)rList.get(p); if (rxn.containsAsProduct(spe)) { sflux = 1; Iterator new_iter = rxn.getReactants(); while (new_iter.hasNext()) { ChemGraph cg = (ChemGraph) new_iter.next(); Species reactant = cg.getSpecies(); SpeciesStatus ss = p_beginStatus.getSpeciesStatus(reactant); if (ss != null) { sflux *= ss.getConcentration(); } else { sflux = 0; } } } if (rxn.containsAsReactant(spe)) { sflux = -1; Iterator new_iter = rxn.getReactants(); while (new_iter.hasNext()) { ChemGraph cg = (ChemGraph) new_iter.next(); Species reactant = cg.getSpecies(); SpeciesStatus ss = p_beginStatus.getSpeciesStatus(reactant); if (ss != null) { sflux *= ss.getConcentration(); } else { sflux = 0; } } } else { sflux = 0; } SensitivityStatus senStatus = new SensitivityStatus(0, sflux, m, p+1); sensitivityStatus.add(k-p_reactionModel.getSpeciesNumber(),senStatus); p_beginStatus.putSensitivityStatus(k-speciesNumber,senStatus); y[k] = 0; yprime[k] = sflux; } } } } else { for (int i = p_reactionModel.getSpeciesNumber(); i < y.length; i++) { SensitivityStatus ss = (SensitivityStatus) p_beginStatus. getSensitivityStatus(i-p_reactionModel.getSpeciesNumber()); double sens = ss.getSensitivity(); double sflux = ss.getSFlux(); int reactionNumber = rList.size(); int speciesNumber = p_reactionModel.getSpeciesNumber(); Iterator species_iter = p_reactionModel.getSpecies(); y[i] = sens; yprime[i] = sflux; } } } //System.out.println("Number of Reacted Species is " + numberOfReactedSpecies); int idid; HashMap speStatus = new HashMap(); LinkedList senStatus = new LinkedList(); double[] tPresent = {tBegin}; int temp = 1; if (nParameter==0) { idid = solveDAE(p_initialization, reactionList, true, thirdBodyReactionList, nState, y, yprime, tBegin, tEnd, this.rtol, this.atol, T, P); if (idid !=1 && idid != 2 && idid != 3) { System.out.println("The idid from DASPK was "+idid + " at time "+tPresent[0]); throw new DynamicSimulatorException("DASPK: SA off."); } System.out.println("After ODE: from " + String.valueOf(tBegin) + " SEC to " + String.valueOf(tEnd) + "SEC"); speStatus = generateSpeciesStatus(p_reactionModel, y, yprime, 0); } else { idid = solveSEN(p_initialization, reactionList, p_reactionChanged, thirdBodyReactionList, nState, nParameter, this.parameterInforArray, y, yprime, tBegin, tEnd, this.rtol, this.atol, T, P); if (idid != 2 && idid != 3) throw new DynamicSimulatorException("DASPK: SA on."); //speStatus = generateSpeciesStatus(p_reactionModel, y, yprime, nParameter); System.out.println("After ODE: from " + String.valueOf(tBegin) + " SEC to " + String.valueOf(tEnd) + "SEC"); speStatus = generateSpeciesStatus(p_reactionModel, y, yprime, nParameter); senStatus = generateSensitivityStatus(p_reactionModel,y,yprime,nParameter); SystemSnapshot sss = new SystemSnapshot(p_endTime, speStatus, senStatus, p_beginStatus.getTemperature(), p_beginStatus.getPressure()); sss.setIDTranslator(IDTranslator); sss.setReactionList(rList); return sss; } SystemSnapshot sss = new SystemSnapshot(p_endTime, speStatus, p_beginStatus.getTemperature(), p_beginStatus.getPressure()); //ReactionSystem.outputAllPathways(SpeciesDictionary.getSpeciesFromName("CH4"), rList, sss, p_temperature); //ReactionSystem.outputAllPathways(SpeciesDictionary.getSpeciesFromName("CO"), rList, sss, p_temperature); //ReactionSystem.outputAllPathways(SpeciesDictionary.getSpeciesFromName("CO2"), rList, sss, p_temperature); return sss; //#] }
58381 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/58381/a3611fafd109f1581462295f20f143bdc7ad935d/JDASPK.java/buggy/jing/rxnSys/JDASPK.java
for (int i = 1; i <= rList.size(); i++){
for (int i = 1; i <= rList.size()+thirdBodyReactionList.length; i++){
public SystemSnapshot solve(boolean p_initialization, ReactionModel p_reactionModel, boolean p_reactionChanged, SystemSnapshot p_beginStatus, ReactionTime p_beginTime, ReactionTime p_endTime, Temperature p_temperature, Pressure p_pressure, boolean p_conditionChanged) { //#[ operation solve(boolean,ReactionModel,boolean,SystemSnapshot,ReactionTime,ReactionTime,Temperature,Pressure,boolean) ReactionTime rt = p_beginStatus.getTime(); if (!rt.equals(p_beginTime)) throw new InvalidBeginStatusException(); // set time double tBegin = p_beginTime.getStandardTime(); double tEnd = p_endTime.getStandardTime(); // set reaction set //if (p_initialization || p_reactionChanged || p_conditionChanged) { //generateThirdBodyReactionList(p_reactionModel, p_beginStatus, p_temperature, p_pressure); LinkedList rList = generatePDepODEReactionList(p_reactionModel, p_beginStatus, p_temperature, p_pressure); //generateAllODEReactionList(p_reactionModel, p_beginStatus, p_temperature, p_pressure); //p_reactionChanged = true; //} // set numbers System.out.println("Total number of reactions to Daspk is "+rList.size()); int nState = p_reactionModel.getSpeciesNumber(); int nParameter = 0; LinkedList initialSpecies = new LinkedList();// if (parameterInfor!=null) nParameter = parameterInfor.length; if (parameterInfor != 0) { nParameter = rList.size(); //svp if (initialStatus == null) System.out.println("initialStatus = null"); Iterator spe_iter = initialStatus.getSpeciesStatus(); while (spe_iter.hasNext()) { SpeciesStatus ss = (SpeciesStatus) spe_iter.next(); String name = ss.getSpecies().getName(); initialSpecies.add(name); nParameter++; } } int neq = nState*(nParameter+1); // set temperature and pressure double T = p_temperature.getK(); double P = p_pressure.getAtm(); // set initial value of y and yprime; double [] y = new double[neq]; double [] yprime = new double[neq]; //double numberOfReactedSpecies=0; // get the present status at t_begin, and set y and y' accordingly System.out.println("Before ODE: " + String.valueOf(tBegin) + "SEC"); System.out.println("End at : " + String.valueOf(tEnd) + "SEC"); for (Iterator iter = p_beginStatus.getSpeciesStatus(); iter.hasNext(); ) { SpeciesStatus ss = (SpeciesStatus)iter.next(); double conc = ss.getConcentration(); double flux = ss.getFlux(); if (ss.isReactedSpecies()) { Species spe = ss.getSpecies(); int id = getRealID(spe); System.out.println(String.valueOf(spe.getID()) + '\t' + spe.getName() + '\t' + String.valueOf(conc) + '\t' + String.valueOf(flux)); y[id-1] = conc; yprime[id-1] = flux; } } if (nParameter != 0){//svp parameterInforArray = new ParameterInfor[nParameter]; for (int i = 1; i <= rList.size(); i++){ parameterInforArray[i-1] = new ParameterInfor("k",i,0.00); } for (int i=rList.size()+1; i<=nParameter;i++){ parameterInforArray[i - 1] = new ParameterInfor("CO", nParameter, 0.00); } if (p_beginTime.getTime() == 0 || p_beginTime.getTime() == 0.00) { LinkedList sensitivityStatus = new LinkedList(); int reactionNumber = rList.size(); int speciesNumber = p_reactionModel.getSpeciesNumber();// for (int i=0;i<reactionNumber*speciesNumber;i++){ for (int i=0; i<nParameter*speciesNumber;i++){ sensitivityStatus.add(i,null); } p_beginStatus.addSensitivity(sensitivityStatus); double sflux = 1; Iterator species_iter = p_reactionModel.getSpecies(); while (species_iter.hasNext()) { Species spe = (Species) species_iter.next(); int m = getRealID(spe); for (int p=0;p<nParameter;p++){ int k = m + (p+1) * speciesNumber - 1; if (p >= rList.size()){ int speciesNum = p-rList.size(); String name = (String)initialSpecies.get(speciesNum); sflux = 0; SensitivityStatus senStatus; if (name.equalsIgnoreCase(spe.getName())){ senStatus = new SensitivityStatus(1, sflux, m, p + 1); y[k] = 1; } else{ senStatus = new SensitivityStatus(0,sflux,m,p+1); y[k]=0; } sensitivityStatus.add(k - p_reactionModel.getSpeciesNumber(), senStatus); p_beginStatus.putSensitivityStatus(k - speciesNumber, senStatus); yprime[k] = sflux; } else{ Reaction rxn = (Reaction)rList.get(p); if (rxn.containsAsProduct(spe)) { sflux = 1; Iterator new_iter = rxn.getReactants(); while (new_iter.hasNext()) { ChemGraph cg = (ChemGraph) new_iter.next(); Species reactant = cg.getSpecies(); SpeciesStatus ss = p_beginStatus.getSpeciesStatus(reactant); if (ss != null) { sflux *= ss.getConcentration(); } else { sflux = 0; } } } if (rxn.containsAsReactant(spe)) { sflux = -1; Iterator new_iter = rxn.getReactants(); while (new_iter.hasNext()) { ChemGraph cg = (ChemGraph) new_iter.next(); Species reactant = cg.getSpecies(); SpeciesStatus ss = p_beginStatus.getSpeciesStatus(reactant); if (ss != null) { sflux *= ss.getConcentration(); } else { sflux = 0; } } } else { sflux = 0; } SensitivityStatus senStatus = new SensitivityStatus(0, sflux, m, p+1); sensitivityStatus.add(k-p_reactionModel.getSpeciesNumber(),senStatus); p_beginStatus.putSensitivityStatus(k-speciesNumber,senStatus); y[k] = 0; yprime[k] = sflux; } } } } else { for (int i = p_reactionModel.getSpeciesNumber(); i < y.length; i++) { SensitivityStatus ss = (SensitivityStatus) p_beginStatus. getSensitivityStatus(i-p_reactionModel.getSpeciesNumber()); double sens = ss.getSensitivity(); double sflux = ss.getSFlux(); int reactionNumber = rList.size(); int speciesNumber = p_reactionModel.getSpeciesNumber(); Iterator species_iter = p_reactionModel.getSpecies(); y[i] = sens; yprime[i] = sflux; } } } //System.out.println("Number of Reacted Species is " + numberOfReactedSpecies); int idid; HashMap speStatus = new HashMap(); LinkedList senStatus = new LinkedList(); double[] tPresent = {tBegin}; int temp = 1; if (nParameter==0) { idid = solveDAE(p_initialization, reactionList, true, thirdBodyReactionList, nState, y, yprime, tBegin, tEnd, this.rtol, this.atol, T, P); if (idid !=1 && idid != 2 && idid != 3) { System.out.println("The idid from DASPK was "+idid + " at time "+tPresent[0]); throw new DynamicSimulatorException("DASPK: SA off."); } System.out.println("After ODE: from " + String.valueOf(tBegin) + " SEC to " + String.valueOf(tEnd) + "SEC"); speStatus = generateSpeciesStatus(p_reactionModel, y, yprime, 0); } else { idid = solveSEN(p_initialization, reactionList, p_reactionChanged, thirdBodyReactionList, nState, nParameter, this.parameterInforArray, y, yprime, tBegin, tEnd, this.rtol, this.atol, T, P); if (idid != 2 && idid != 3) throw new DynamicSimulatorException("DASPK: SA on."); //speStatus = generateSpeciesStatus(p_reactionModel, y, yprime, nParameter); System.out.println("After ODE: from " + String.valueOf(tBegin) + " SEC to " + String.valueOf(tEnd) + "SEC"); speStatus = generateSpeciesStatus(p_reactionModel, y, yprime, nParameter); senStatus = generateSensitivityStatus(p_reactionModel,y,yprime,nParameter); SystemSnapshot sss = new SystemSnapshot(p_endTime, speStatus, senStatus, p_beginStatus.getTemperature(), p_beginStatus.getPressure()); sss.setIDTranslator(IDTranslator); sss.setReactionList(rList); return sss; } SystemSnapshot sss = new SystemSnapshot(p_endTime, speStatus, p_beginStatus.getTemperature(), p_beginStatus.getPressure()); //ReactionSystem.outputAllPathways(SpeciesDictionary.getSpeciesFromName("CH4"), rList, sss, p_temperature); //ReactionSystem.outputAllPathways(SpeciesDictionary.getSpeciesFromName("CO"), rList, sss, p_temperature); //ReactionSystem.outputAllPathways(SpeciesDictionary.getSpeciesFromName("CO2"), rList, sss, p_temperature); return sss; //#] }
58381 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/58381/a3611fafd109f1581462295f20f143bdc7ad935d/JDASPK.java/buggy/jing/rxnSys/JDASPK.java
for (int i=rList.size()+1; i<=nParameter;i++){
for (int i=rList.size()+1+thirdBodyReactionList.length; i<=nParameter;i++){
public SystemSnapshot solve(boolean p_initialization, ReactionModel p_reactionModel, boolean p_reactionChanged, SystemSnapshot p_beginStatus, ReactionTime p_beginTime, ReactionTime p_endTime, Temperature p_temperature, Pressure p_pressure, boolean p_conditionChanged) { //#[ operation solve(boolean,ReactionModel,boolean,SystemSnapshot,ReactionTime,ReactionTime,Temperature,Pressure,boolean) ReactionTime rt = p_beginStatus.getTime(); if (!rt.equals(p_beginTime)) throw new InvalidBeginStatusException(); // set time double tBegin = p_beginTime.getStandardTime(); double tEnd = p_endTime.getStandardTime(); // set reaction set //if (p_initialization || p_reactionChanged || p_conditionChanged) { //generateThirdBodyReactionList(p_reactionModel, p_beginStatus, p_temperature, p_pressure); LinkedList rList = generatePDepODEReactionList(p_reactionModel, p_beginStatus, p_temperature, p_pressure); //generateAllODEReactionList(p_reactionModel, p_beginStatus, p_temperature, p_pressure); //p_reactionChanged = true; //} // set numbers System.out.println("Total number of reactions to Daspk is "+rList.size()); int nState = p_reactionModel.getSpeciesNumber(); int nParameter = 0; LinkedList initialSpecies = new LinkedList();// if (parameterInfor!=null) nParameter = parameterInfor.length; if (parameterInfor != 0) { nParameter = rList.size(); //svp if (initialStatus == null) System.out.println("initialStatus = null"); Iterator spe_iter = initialStatus.getSpeciesStatus(); while (spe_iter.hasNext()) { SpeciesStatus ss = (SpeciesStatus) spe_iter.next(); String name = ss.getSpecies().getName(); initialSpecies.add(name); nParameter++; } } int neq = nState*(nParameter+1); // set temperature and pressure double T = p_temperature.getK(); double P = p_pressure.getAtm(); // set initial value of y and yprime; double [] y = new double[neq]; double [] yprime = new double[neq]; //double numberOfReactedSpecies=0; // get the present status at t_begin, and set y and y' accordingly System.out.println("Before ODE: " + String.valueOf(tBegin) + "SEC"); System.out.println("End at : " + String.valueOf(tEnd) + "SEC"); for (Iterator iter = p_beginStatus.getSpeciesStatus(); iter.hasNext(); ) { SpeciesStatus ss = (SpeciesStatus)iter.next(); double conc = ss.getConcentration(); double flux = ss.getFlux(); if (ss.isReactedSpecies()) { Species spe = ss.getSpecies(); int id = getRealID(spe); System.out.println(String.valueOf(spe.getID()) + '\t' + spe.getName() + '\t' + String.valueOf(conc) + '\t' + String.valueOf(flux)); y[id-1] = conc; yprime[id-1] = flux; } } if (nParameter != 0){//svp parameterInforArray = new ParameterInfor[nParameter]; for (int i = 1; i <= rList.size(); i++){ parameterInforArray[i-1] = new ParameterInfor("k",i,0.00); } for (int i=rList.size()+1; i<=nParameter;i++){ parameterInforArray[i - 1] = new ParameterInfor("CO", nParameter, 0.00); } if (p_beginTime.getTime() == 0 || p_beginTime.getTime() == 0.00) { LinkedList sensitivityStatus = new LinkedList(); int reactionNumber = rList.size(); int speciesNumber = p_reactionModel.getSpeciesNumber();// for (int i=0;i<reactionNumber*speciesNumber;i++){ for (int i=0; i<nParameter*speciesNumber;i++){ sensitivityStatus.add(i,null); } p_beginStatus.addSensitivity(sensitivityStatus); double sflux = 1; Iterator species_iter = p_reactionModel.getSpecies(); while (species_iter.hasNext()) { Species spe = (Species) species_iter.next(); int m = getRealID(spe); for (int p=0;p<nParameter;p++){ int k = m + (p+1) * speciesNumber - 1; if (p >= rList.size()){ int speciesNum = p-rList.size(); String name = (String)initialSpecies.get(speciesNum); sflux = 0; SensitivityStatus senStatus; if (name.equalsIgnoreCase(spe.getName())){ senStatus = new SensitivityStatus(1, sflux, m, p + 1); y[k] = 1; } else{ senStatus = new SensitivityStatus(0,sflux,m,p+1); y[k]=0; } sensitivityStatus.add(k - p_reactionModel.getSpeciesNumber(), senStatus); p_beginStatus.putSensitivityStatus(k - speciesNumber, senStatus); yprime[k] = sflux; } else{ Reaction rxn = (Reaction)rList.get(p); if (rxn.containsAsProduct(spe)) { sflux = 1; Iterator new_iter = rxn.getReactants(); while (new_iter.hasNext()) { ChemGraph cg = (ChemGraph) new_iter.next(); Species reactant = cg.getSpecies(); SpeciesStatus ss = p_beginStatus.getSpeciesStatus(reactant); if (ss != null) { sflux *= ss.getConcentration(); } else { sflux = 0; } } } if (rxn.containsAsReactant(spe)) { sflux = -1; Iterator new_iter = rxn.getReactants(); while (new_iter.hasNext()) { ChemGraph cg = (ChemGraph) new_iter.next(); Species reactant = cg.getSpecies(); SpeciesStatus ss = p_beginStatus.getSpeciesStatus(reactant); if (ss != null) { sflux *= ss.getConcentration(); } else { sflux = 0; } } } else { sflux = 0; } SensitivityStatus senStatus = new SensitivityStatus(0, sflux, m, p+1); sensitivityStatus.add(k-p_reactionModel.getSpeciesNumber(),senStatus); p_beginStatus.putSensitivityStatus(k-speciesNumber,senStatus); y[k] = 0; yprime[k] = sflux; } } } } else { for (int i = p_reactionModel.getSpeciesNumber(); i < y.length; i++) { SensitivityStatus ss = (SensitivityStatus) p_beginStatus. getSensitivityStatus(i-p_reactionModel.getSpeciesNumber()); double sens = ss.getSensitivity(); double sflux = ss.getSFlux(); int reactionNumber = rList.size(); int speciesNumber = p_reactionModel.getSpeciesNumber(); Iterator species_iter = p_reactionModel.getSpecies(); y[i] = sens; yprime[i] = sflux; } } } //System.out.println("Number of Reacted Species is " + numberOfReactedSpecies); int idid; HashMap speStatus = new HashMap(); LinkedList senStatus = new LinkedList(); double[] tPresent = {tBegin}; int temp = 1; if (nParameter==0) { idid = solveDAE(p_initialization, reactionList, true, thirdBodyReactionList, nState, y, yprime, tBegin, tEnd, this.rtol, this.atol, T, P); if (idid !=1 && idid != 2 && idid != 3) { System.out.println("The idid from DASPK was "+idid + " at time "+tPresent[0]); throw new DynamicSimulatorException("DASPK: SA off."); } System.out.println("After ODE: from " + String.valueOf(tBegin) + " SEC to " + String.valueOf(tEnd) + "SEC"); speStatus = generateSpeciesStatus(p_reactionModel, y, yprime, 0); } else { idid = solveSEN(p_initialization, reactionList, p_reactionChanged, thirdBodyReactionList, nState, nParameter, this.parameterInforArray, y, yprime, tBegin, tEnd, this.rtol, this.atol, T, P); if (idid != 2 && idid != 3) throw new DynamicSimulatorException("DASPK: SA on."); //speStatus = generateSpeciesStatus(p_reactionModel, y, yprime, nParameter); System.out.println("After ODE: from " + String.valueOf(tBegin) + " SEC to " + String.valueOf(tEnd) + "SEC"); speStatus = generateSpeciesStatus(p_reactionModel, y, yprime, nParameter); senStatus = generateSensitivityStatus(p_reactionModel,y,yprime,nParameter); SystemSnapshot sss = new SystemSnapshot(p_endTime, speStatus, senStatus, p_beginStatus.getTemperature(), p_beginStatus.getPressure()); sss.setIDTranslator(IDTranslator); sss.setReactionList(rList); return sss; } SystemSnapshot sss = new SystemSnapshot(p_endTime, speStatus, p_beginStatus.getTemperature(), p_beginStatus.getPressure()); //ReactionSystem.outputAllPathways(SpeciesDictionary.getSpeciesFromName("CH4"), rList, sss, p_temperature); //ReactionSystem.outputAllPathways(SpeciesDictionary.getSpeciesFromName("CO"), rList, sss, p_temperature); //ReactionSystem.outputAllPathways(SpeciesDictionary.getSpeciesFromName("CO2"), rList, sss, p_temperature); return sss; //#] }
58381 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/58381/a3611fafd109f1581462295f20f143bdc7ad935d/JDASPK.java/buggy/jing/rxnSys/JDASPK.java
int reactionNumber = rList.size();
int reactionNumber = rList.size()+thirdBodyReactionList.length;
public SystemSnapshot solve(boolean p_initialization, ReactionModel p_reactionModel, boolean p_reactionChanged, SystemSnapshot p_beginStatus, ReactionTime p_beginTime, ReactionTime p_endTime, Temperature p_temperature, Pressure p_pressure, boolean p_conditionChanged) { //#[ operation solve(boolean,ReactionModel,boolean,SystemSnapshot,ReactionTime,ReactionTime,Temperature,Pressure,boolean) ReactionTime rt = p_beginStatus.getTime(); if (!rt.equals(p_beginTime)) throw new InvalidBeginStatusException(); // set time double tBegin = p_beginTime.getStandardTime(); double tEnd = p_endTime.getStandardTime(); // set reaction set //if (p_initialization || p_reactionChanged || p_conditionChanged) { //generateThirdBodyReactionList(p_reactionModel, p_beginStatus, p_temperature, p_pressure); LinkedList rList = generatePDepODEReactionList(p_reactionModel, p_beginStatus, p_temperature, p_pressure); //generateAllODEReactionList(p_reactionModel, p_beginStatus, p_temperature, p_pressure); //p_reactionChanged = true; //} // set numbers System.out.println("Total number of reactions to Daspk is "+rList.size()); int nState = p_reactionModel.getSpeciesNumber(); int nParameter = 0; LinkedList initialSpecies = new LinkedList();// if (parameterInfor!=null) nParameter = parameterInfor.length; if (parameterInfor != 0) { nParameter = rList.size(); //svp if (initialStatus == null) System.out.println("initialStatus = null"); Iterator spe_iter = initialStatus.getSpeciesStatus(); while (spe_iter.hasNext()) { SpeciesStatus ss = (SpeciesStatus) spe_iter.next(); String name = ss.getSpecies().getName(); initialSpecies.add(name); nParameter++; } } int neq = nState*(nParameter+1); // set temperature and pressure double T = p_temperature.getK(); double P = p_pressure.getAtm(); // set initial value of y and yprime; double [] y = new double[neq]; double [] yprime = new double[neq]; //double numberOfReactedSpecies=0; // get the present status at t_begin, and set y and y' accordingly System.out.println("Before ODE: " + String.valueOf(tBegin) + "SEC"); System.out.println("End at : " + String.valueOf(tEnd) + "SEC"); for (Iterator iter = p_beginStatus.getSpeciesStatus(); iter.hasNext(); ) { SpeciesStatus ss = (SpeciesStatus)iter.next(); double conc = ss.getConcentration(); double flux = ss.getFlux(); if (ss.isReactedSpecies()) { Species spe = ss.getSpecies(); int id = getRealID(spe); System.out.println(String.valueOf(spe.getID()) + '\t' + spe.getName() + '\t' + String.valueOf(conc) + '\t' + String.valueOf(flux)); y[id-1] = conc; yprime[id-1] = flux; } } if (nParameter != 0){//svp parameterInforArray = new ParameterInfor[nParameter]; for (int i = 1; i <= rList.size(); i++){ parameterInforArray[i-1] = new ParameterInfor("k",i,0.00); } for (int i=rList.size()+1; i<=nParameter;i++){ parameterInforArray[i - 1] = new ParameterInfor("CO", nParameter, 0.00); } if (p_beginTime.getTime() == 0 || p_beginTime.getTime() == 0.00) { LinkedList sensitivityStatus = new LinkedList(); int reactionNumber = rList.size(); int speciesNumber = p_reactionModel.getSpeciesNumber();// for (int i=0;i<reactionNumber*speciesNumber;i++){ for (int i=0; i<nParameter*speciesNumber;i++){ sensitivityStatus.add(i,null); } p_beginStatus.addSensitivity(sensitivityStatus); double sflux = 1; Iterator species_iter = p_reactionModel.getSpecies(); while (species_iter.hasNext()) { Species spe = (Species) species_iter.next(); int m = getRealID(spe); for (int p=0;p<nParameter;p++){ int k = m + (p+1) * speciesNumber - 1; if (p >= rList.size()){ int speciesNum = p-rList.size(); String name = (String)initialSpecies.get(speciesNum); sflux = 0; SensitivityStatus senStatus; if (name.equalsIgnoreCase(spe.getName())){ senStatus = new SensitivityStatus(1, sflux, m, p + 1); y[k] = 1; } else{ senStatus = new SensitivityStatus(0,sflux,m,p+1); y[k]=0; } sensitivityStatus.add(k - p_reactionModel.getSpeciesNumber(), senStatus); p_beginStatus.putSensitivityStatus(k - speciesNumber, senStatus); yprime[k] = sflux; } else{ Reaction rxn = (Reaction)rList.get(p); if (rxn.containsAsProduct(spe)) { sflux = 1; Iterator new_iter = rxn.getReactants(); while (new_iter.hasNext()) { ChemGraph cg = (ChemGraph) new_iter.next(); Species reactant = cg.getSpecies(); SpeciesStatus ss = p_beginStatus.getSpeciesStatus(reactant); if (ss != null) { sflux *= ss.getConcentration(); } else { sflux = 0; } } } if (rxn.containsAsReactant(spe)) { sflux = -1; Iterator new_iter = rxn.getReactants(); while (new_iter.hasNext()) { ChemGraph cg = (ChemGraph) new_iter.next(); Species reactant = cg.getSpecies(); SpeciesStatus ss = p_beginStatus.getSpeciesStatus(reactant); if (ss != null) { sflux *= ss.getConcentration(); } else { sflux = 0; } } } else { sflux = 0; } SensitivityStatus senStatus = new SensitivityStatus(0, sflux, m, p+1); sensitivityStatus.add(k-p_reactionModel.getSpeciesNumber(),senStatus); p_beginStatus.putSensitivityStatus(k-speciesNumber,senStatus); y[k] = 0; yprime[k] = sflux; } } } } else { for (int i = p_reactionModel.getSpeciesNumber(); i < y.length; i++) { SensitivityStatus ss = (SensitivityStatus) p_beginStatus. getSensitivityStatus(i-p_reactionModel.getSpeciesNumber()); double sens = ss.getSensitivity(); double sflux = ss.getSFlux(); int reactionNumber = rList.size(); int speciesNumber = p_reactionModel.getSpeciesNumber(); Iterator species_iter = p_reactionModel.getSpecies(); y[i] = sens; yprime[i] = sflux; } } } //System.out.println("Number of Reacted Species is " + numberOfReactedSpecies); int idid; HashMap speStatus = new HashMap(); LinkedList senStatus = new LinkedList(); double[] tPresent = {tBegin}; int temp = 1; if (nParameter==0) { idid = solveDAE(p_initialization, reactionList, true, thirdBodyReactionList, nState, y, yprime, tBegin, tEnd, this.rtol, this.atol, T, P); if (idid !=1 && idid != 2 && idid != 3) { System.out.println("The idid from DASPK was "+idid + " at time "+tPresent[0]); throw new DynamicSimulatorException("DASPK: SA off."); } System.out.println("After ODE: from " + String.valueOf(tBegin) + " SEC to " + String.valueOf(tEnd) + "SEC"); speStatus = generateSpeciesStatus(p_reactionModel, y, yprime, 0); } else { idid = solveSEN(p_initialization, reactionList, p_reactionChanged, thirdBodyReactionList, nState, nParameter, this.parameterInforArray, y, yprime, tBegin, tEnd, this.rtol, this.atol, T, P); if (idid != 2 && idid != 3) throw new DynamicSimulatorException("DASPK: SA on."); //speStatus = generateSpeciesStatus(p_reactionModel, y, yprime, nParameter); System.out.println("After ODE: from " + String.valueOf(tBegin) + " SEC to " + String.valueOf(tEnd) + "SEC"); speStatus = generateSpeciesStatus(p_reactionModel, y, yprime, nParameter); senStatus = generateSensitivityStatus(p_reactionModel,y,yprime,nParameter); SystemSnapshot sss = new SystemSnapshot(p_endTime, speStatus, senStatus, p_beginStatus.getTemperature(), p_beginStatus.getPressure()); sss.setIDTranslator(IDTranslator); sss.setReactionList(rList); return sss; } SystemSnapshot sss = new SystemSnapshot(p_endTime, speStatus, p_beginStatus.getTemperature(), p_beginStatus.getPressure()); //ReactionSystem.outputAllPathways(SpeciesDictionary.getSpeciesFromName("CH4"), rList, sss, p_temperature); //ReactionSystem.outputAllPathways(SpeciesDictionary.getSpeciesFromName("CO"), rList, sss, p_temperature); //ReactionSystem.outputAllPathways(SpeciesDictionary.getSpeciesFromName("CO2"), rList, sss, p_temperature); return sss; //#] }
58381 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/58381/a3611fafd109f1581462295f20f143bdc7ad935d/JDASPK.java/buggy/jing/rxnSys/JDASPK.java
if (p >= rList.size()){ int speciesNum = p-rList.size();
if (p >= reactionNumber){ int speciesNum = p-rList.size()-thirdBodyReactionList.length;
public SystemSnapshot solve(boolean p_initialization, ReactionModel p_reactionModel, boolean p_reactionChanged, SystemSnapshot p_beginStatus, ReactionTime p_beginTime, ReactionTime p_endTime, Temperature p_temperature, Pressure p_pressure, boolean p_conditionChanged) { //#[ operation solve(boolean,ReactionModel,boolean,SystemSnapshot,ReactionTime,ReactionTime,Temperature,Pressure,boolean) ReactionTime rt = p_beginStatus.getTime(); if (!rt.equals(p_beginTime)) throw new InvalidBeginStatusException(); // set time double tBegin = p_beginTime.getStandardTime(); double tEnd = p_endTime.getStandardTime(); // set reaction set //if (p_initialization || p_reactionChanged || p_conditionChanged) { //generateThirdBodyReactionList(p_reactionModel, p_beginStatus, p_temperature, p_pressure); LinkedList rList = generatePDepODEReactionList(p_reactionModel, p_beginStatus, p_temperature, p_pressure); //generateAllODEReactionList(p_reactionModel, p_beginStatus, p_temperature, p_pressure); //p_reactionChanged = true; //} // set numbers System.out.println("Total number of reactions to Daspk is "+rList.size()); int nState = p_reactionModel.getSpeciesNumber(); int nParameter = 0; LinkedList initialSpecies = new LinkedList();// if (parameterInfor!=null) nParameter = parameterInfor.length; if (parameterInfor != 0) { nParameter = rList.size(); //svp if (initialStatus == null) System.out.println("initialStatus = null"); Iterator spe_iter = initialStatus.getSpeciesStatus(); while (spe_iter.hasNext()) { SpeciesStatus ss = (SpeciesStatus) spe_iter.next(); String name = ss.getSpecies().getName(); initialSpecies.add(name); nParameter++; } } int neq = nState*(nParameter+1); // set temperature and pressure double T = p_temperature.getK(); double P = p_pressure.getAtm(); // set initial value of y and yprime; double [] y = new double[neq]; double [] yprime = new double[neq]; //double numberOfReactedSpecies=0; // get the present status at t_begin, and set y and y' accordingly System.out.println("Before ODE: " + String.valueOf(tBegin) + "SEC"); System.out.println("End at : " + String.valueOf(tEnd) + "SEC"); for (Iterator iter = p_beginStatus.getSpeciesStatus(); iter.hasNext(); ) { SpeciesStatus ss = (SpeciesStatus)iter.next(); double conc = ss.getConcentration(); double flux = ss.getFlux(); if (ss.isReactedSpecies()) { Species spe = ss.getSpecies(); int id = getRealID(spe); System.out.println(String.valueOf(spe.getID()) + '\t' + spe.getName() + '\t' + String.valueOf(conc) + '\t' + String.valueOf(flux)); y[id-1] = conc; yprime[id-1] = flux; } } if (nParameter != 0){//svp parameterInforArray = new ParameterInfor[nParameter]; for (int i = 1; i <= rList.size(); i++){ parameterInforArray[i-1] = new ParameterInfor("k",i,0.00); } for (int i=rList.size()+1; i<=nParameter;i++){ parameterInforArray[i - 1] = new ParameterInfor("CO", nParameter, 0.00); } if (p_beginTime.getTime() == 0 || p_beginTime.getTime() == 0.00) { LinkedList sensitivityStatus = new LinkedList(); int reactionNumber = rList.size(); int speciesNumber = p_reactionModel.getSpeciesNumber();// for (int i=0;i<reactionNumber*speciesNumber;i++){ for (int i=0; i<nParameter*speciesNumber;i++){ sensitivityStatus.add(i,null); } p_beginStatus.addSensitivity(sensitivityStatus); double sflux = 1; Iterator species_iter = p_reactionModel.getSpecies(); while (species_iter.hasNext()) { Species spe = (Species) species_iter.next(); int m = getRealID(spe); for (int p=0;p<nParameter;p++){ int k = m + (p+1) * speciesNumber - 1; if (p >= rList.size()){ int speciesNum = p-rList.size(); String name = (String)initialSpecies.get(speciesNum); sflux = 0; SensitivityStatus senStatus; if (name.equalsIgnoreCase(spe.getName())){ senStatus = new SensitivityStatus(1, sflux, m, p + 1); y[k] = 1; } else{ senStatus = new SensitivityStatus(0,sflux,m,p+1); y[k]=0; } sensitivityStatus.add(k - p_reactionModel.getSpeciesNumber(), senStatus); p_beginStatus.putSensitivityStatus(k - speciesNumber, senStatus); yprime[k] = sflux; } else{ Reaction rxn = (Reaction)rList.get(p); if (rxn.containsAsProduct(spe)) { sflux = 1; Iterator new_iter = rxn.getReactants(); while (new_iter.hasNext()) { ChemGraph cg = (ChemGraph) new_iter.next(); Species reactant = cg.getSpecies(); SpeciesStatus ss = p_beginStatus.getSpeciesStatus(reactant); if (ss != null) { sflux *= ss.getConcentration(); } else { sflux = 0; } } } if (rxn.containsAsReactant(spe)) { sflux = -1; Iterator new_iter = rxn.getReactants(); while (new_iter.hasNext()) { ChemGraph cg = (ChemGraph) new_iter.next(); Species reactant = cg.getSpecies(); SpeciesStatus ss = p_beginStatus.getSpeciesStatus(reactant); if (ss != null) { sflux *= ss.getConcentration(); } else { sflux = 0; } } } else { sflux = 0; } SensitivityStatus senStatus = new SensitivityStatus(0, sflux, m, p+1); sensitivityStatus.add(k-p_reactionModel.getSpeciesNumber(),senStatus); p_beginStatus.putSensitivityStatus(k-speciesNumber,senStatus); y[k] = 0; yprime[k] = sflux; } } } } else { for (int i = p_reactionModel.getSpeciesNumber(); i < y.length; i++) { SensitivityStatus ss = (SensitivityStatus) p_beginStatus. getSensitivityStatus(i-p_reactionModel.getSpeciesNumber()); double sens = ss.getSensitivity(); double sflux = ss.getSFlux(); int reactionNumber = rList.size(); int speciesNumber = p_reactionModel.getSpeciesNumber(); Iterator species_iter = p_reactionModel.getSpecies(); y[i] = sens; yprime[i] = sflux; } } } //System.out.println("Number of Reacted Species is " + numberOfReactedSpecies); int idid; HashMap speStatus = new HashMap(); LinkedList senStatus = new LinkedList(); double[] tPresent = {tBegin}; int temp = 1; if (nParameter==0) { idid = solveDAE(p_initialization, reactionList, true, thirdBodyReactionList, nState, y, yprime, tBegin, tEnd, this.rtol, this.atol, T, P); if (idid !=1 && idid != 2 && idid != 3) { System.out.println("The idid from DASPK was "+idid + " at time "+tPresent[0]); throw new DynamicSimulatorException("DASPK: SA off."); } System.out.println("After ODE: from " + String.valueOf(tBegin) + " SEC to " + String.valueOf(tEnd) + "SEC"); speStatus = generateSpeciesStatus(p_reactionModel, y, yprime, 0); } else { idid = solveSEN(p_initialization, reactionList, p_reactionChanged, thirdBodyReactionList, nState, nParameter, this.parameterInforArray, y, yprime, tBegin, tEnd, this.rtol, this.atol, T, P); if (idid != 2 && idid != 3) throw new DynamicSimulatorException("DASPK: SA on."); //speStatus = generateSpeciesStatus(p_reactionModel, y, yprime, nParameter); System.out.println("After ODE: from " + String.valueOf(tBegin) + " SEC to " + String.valueOf(tEnd) + "SEC"); speStatus = generateSpeciesStatus(p_reactionModel, y, yprime, nParameter); senStatus = generateSensitivityStatus(p_reactionModel,y,yprime,nParameter); SystemSnapshot sss = new SystemSnapshot(p_endTime, speStatus, senStatus, p_beginStatus.getTemperature(), p_beginStatus.getPressure()); sss.setIDTranslator(IDTranslator); sss.setReactionList(rList); return sss; } SystemSnapshot sss = new SystemSnapshot(p_endTime, speStatus, p_beginStatus.getTemperature(), p_beginStatus.getPressure()); //ReactionSystem.outputAllPathways(SpeciesDictionary.getSpeciesFromName("CH4"), rList, sss, p_temperature); //ReactionSystem.outputAllPathways(SpeciesDictionary.getSpeciesFromName("CO"), rList, sss, p_temperature); //ReactionSystem.outputAllPathways(SpeciesDictionary.getSpeciesFromName("CO2"), rList, sss, p_temperature); return sss; //#] }
58381 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/58381/a3611fafd109f1581462295f20f143bdc7ad935d/JDASPK.java/buggy/jing/rxnSys/JDASPK.java
} else { sflux = 0; SensitivityStatus senStatus = new SensitivityStatus(0, sflux, m, p+1); sensitivityStatus.add(k-p_reactionModel.getSpeciesNumber(),senStatus); p_beginStatus.putSensitivityStatus(k-speciesNumber,senStatus); y[k] = 0; yprime[k] = sflux; }
public SystemSnapshot solve(boolean p_initialization, ReactionModel p_reactionModel, boolean p_reactionChanged, SystemSnapshot p_beginStatus, ReactionTime p_beginTime, ReactionTime p_endTime, Temperature p_temperature, Pressure p_pressure, boolean p_conditionChanged) { //#[ operation solve(boolean,ReactionModel,boolean,SystemSnapshot,ReactionTime,ReactionTime,Temperature,Pressure,boolean) ReactionTime rt = p_beginStatus.getTime(); if (!rt.equals(p_beginTime)) throw new InvalidBeginStatusException(); // set time double tBegin = p_beginTime.getStandardTime(); double tEnd = p_endTime.getStandardTime(); // set reaction set //if (p_initialization || p_reactionChanged || p_conditionChanged) { //generateThirdBodyReactionList(p_reactionModel, p_beginStatus, p_temperature, p_pressure); LinkedList rList = generatePDepODEReactionList(p_reactionModel, p_beginStatus, p_temperature, p_pressure); //generateAllODEReactionList(p_reactionModel, p_beginStatus, p_temperature, p_pressure); //p_reactionChanged = true; //} // set numbers System.out.println("Total number of reactions to Daspk is "+rList.size()); int nState = p_reactionModel.getSpeciesNumber(); int nParameter = 0; LinkedList initialSpecies = new LinkedList();// if (parameterInfor!=null) nParameter = parameterInfor.length; if (parameterInfor != 0) { nParameter = rList.size(); //svp if (initialStatus == null) System.out.println("initialStatus = null"); Iterator spe_iter = initialStatus.getSpeciesStatus(); while (spe_iter.hasNext()) { SpeciesStatus ss = (SpeciesStatus) spe_iter.next(); String name = ss.getSpecies().getName(); initialSpecies.add(name); nParameter++; } } int neq = nState*(nParameter+1); // set temperature and pressure double T = p_temperature.getK(); double P = p_pressure.getAtm(); // set initial value of y and yprime; double [] y = new double[neq]; double [] yprime = new double[neq]; //double numberOfReactedSpecies=0; // get the present status at t_begin, and set y and y' accordingly System.out.println("Before ODE: " + String.valueOf(tBegin) + "SEC"); System.out.println("End at : " + String.valueOf(tEnd) + "SEC"); for (Iterator iter = p_beginStatus.getSpeciesStatus(); iter.hasNext(); ) { SpeciesStatus ss = (SpeciesStatus)iter.next(); double conc = ss.getConcentration(); double flux = ss.getFlux(); if (ss.isReactedSpecies()) { Species spe = ss.getSpecies(); int id = getRealID(spe); System.out.println(String.valueOf(spe.getID()) + '\t' + spe.getName() + '\t' + String.valueOf(conc) + '\t' + String.valueOf(flux)); y[id-1] = conc; yprime[id-1] = flux; } } if (nParameter != 0){//svp parameterInforArray = new ParameterInfor[nParameter]; for (int i = 1; i <= rList.size(); i++){ parameterInforArray[i-1] = new ParameterInfor("k",i,0.00); } for (int i=rList.size()+1; i<=nParameter;i++){ parameterInforArray[i - 1] = new ParameterInfor("CO", nParameter, 0.00); } if (p_beginTime.getTime() == 0 || p_beginTime.getTime() == 0.00) { LinkedList sensitivityStatus = new LinkedList(); int reactionNumber = rList.size(); int speciesNumber = p_reactionModel.getSpeciesNumber();// for (int i=0;i<reactionNumber*speciesNumber;i++){ for (int i=0; i<nParameter*speciesNumber;i++){ sensitivityStatus.add(i,null); } p_beginStatus.addSensitivity(sensitivityStatus); double sflux = 1; Iterator species_iter = p_reactionModel.getSpecies(); while (species_iter.hasNext()) { Species spe = (Species) species_iter.next(); int m = getRealID(spe); for (int p=0;p<nParameter;p++){ int k = m + (p+1) * speciesNumber - 1; if (p >= rList.size()){ int speciesNum = p-rList.size(); String name = (String)initialSpecies.get(speciesNum); sflux = 0; SensitivityStatus senStatus; if (name.equalsIgnoreCase(spe.getName())){ senStatus = new SensitivityStatus(1, sflux, m, p + 1); y[k] = 1; } else{ senStatus = new SensitivityStatus(0,sflux,m,p+1); y[k]=0; } sensitivityStatus.add(k - p_reactionModel.getSpeciesNumber(), senStatus); p_beginStatus.putSensitivityStatus(k - speciesNumber, senStatus); yprime[k] = sflux; } else{ Reaction rxn = (Reaction)rList.get(p); if (rxn.containsAsProduct(spe)) { sflux = 1; Iterator new_iter = rxn.getReactants(); while (new_iter.hasNext()) { ChemGraph cg = (ChemGraph) new_iter.next(); Species reactant = cg.getSpecies(); SpeciesStatus ss = p_beginStatus.getSpeciesStatus(reactant); if (ss != null) { sflux *= ss.getConcentration(); } else { sflux = 0; } } } if (rxn.containsAsReactant(spe)) { sflux = -1; Iterator new_iter = rxn.getReactants(); while (new_iter.hasNext()) { ChemGraph cg = (ChemGraph) new_iter.next(); Species reactant = cg.getSpecies(); SpeciesStatus ss = p_beginStatus.getSpeciesStatus(reactant); if (ss != null) { sflux *= ss.getConcentration(); } else { sflux = 0; } } } else { sflux = 0; } SensitivityStatus senStatus = new SensitivityStatus(0, sflux, m, p+1); sensitivityStatus.add(k-p_reactionModel.getSpeciesNumber(),senStatus); p_beginStatus.putSensitivityStatus(k-speciesNumber,senStatus); y[k] = 0; yprime[k] = sflux; } } } } else { for (int i = p_reactionModel.getSpeciesNumber(); i < y.length; i++) { SensitivityStatus ss = (SensitivityStatus) p_beginStatus. getSensitivityStatus(i-p_reactionModel.getSpeciesNumber()); double sens = ss.getSensitivity(); double sflux = ss.getSFlux(); int reactionNumber = rList.size(); int speciesNumber = p_reactionModel.getSpeciesNumber(); Iterator species_iter = p_reactionModel.getSpecies(); y[i] = sens; yprime[i] = sflux; } } } //System.out.println("Number of Reacted Species is " + numberOfReactedSpecies); int idid; HashMap speStatus = new HashMap(); LinkedList senStatus = new LinkedList(); double[] tPresent = {tBegin}; int temp = 1; if (nParameter==0) { idid = solveDAE(p_initialization, reactionList, true, thirdBodyReactionList, nState, y, yprime, tBegin, tEnd, this.rtol, this.atol, T, P); if (idid !=1 && idid != 2 && idid != 3) { System.out.println("The idid from DASPK was "+idid + " at time "+tPresent[0]); throw new DynamicSimulatorException("DASPK: SA off."); } System.out.println("After ODE: from " + String.valueOf(tBegin) + " SEC to " + String.valueOf(tEnd) + "SEC"); speStatus = generateSpeciesStatus(p_reactionModel, y, yprime, 0); } else { idid = solveSEN(p_initialization, reactionList, p_reactionChanged, thirdBodyReactionList, nState, nParameter, this.parameterInforArray, y, yprime, tBegin, tEnd, this.rtol, this.atol, T, P); if (idid != 2 && idid != 3) throw new DynamicSimulatorException("DASPK: SA on."); //speStatus = generateSpeciesStatus(p_reactionModel, y, yprime, nParameter); System.out.println("After ODE: from " + String.valueOf(tBegin) + " SEC to " + String.valueOf(tEnd) + "SEC"); speStatus = generateSpeciesStatus(p_reactionModel, y, yprime, nParameter); senStatus = generateSensitivityStatus(p_reactionModel,y,yprime,nParameter); SystemSnapshot sss = new SystemSnapshot(p_endTime, speStatus, senStatus, p_beginStatus.getTemperature(), p_beginStatus.getPressure()); sss.setIDTranslator(IDTranslator); sss.setReactionList(rList); return sss; } SystemSnapshot sss = new SystemSnapshot(p_endTime, speStatus, p_beginStatus.getTemperature(), p_beginStatus.getPressure()); //ReactionSystem.outputAllPathways(SpeciesDictionary.getSpeciesFromName("CH4"), rList, sss, p_temperature); //ReactionSystem.outputAllPathways(SpeciesDictionary.getSpeciesFromName("CO"), rList, sss, p_temperature); //ReactionSystem.outputAllPathways(SpeciesDictionary.getSpeciesFromName("CO2"), rList, sss, p_temperature); return sss; //#] }
58381 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/58381/a3611fafd109f1581462295f20f143bdc7ad935d/JDASPK.java/buggy/jing/rxnSys/JDASPK.java
if ((this.filename == null) && (this.searchType == TYPE_DIRECTORY))
if ((this.filename == null) || (this.searchType == TYPE_DIRECTORY))
private boolean pathMatches (String path) { //System.out.println ("checking path " + path); File file = null; if ((this.filename == null) && (this.searchType == TYPE_DIRECTORY)) { file = new File (path); } else { file = new File (path, this.filename); } if (file.exists ()) { if ((this.searchType == TYPE_DIRECTORY) && (file.isDirectory())) return true; if ((this.searchType == TYPE_FILE) && (file.isFile ())) return true; } //System.out.println (path + " did not match"); return false; }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/e451b10df95ff997b9b498372eeadddaed66187c/UserInputPanel.java/clean/src/lib/com/izforge/izpack/panels/UserInputPanel.java
{
{
private boolean pathMatches (String path) { //System.out.println ("checking path " + path); File file = null; if ((this.filename == null) && (this.searchType == TYPE_DIRECTORY)) { file = new File (path); } else { file = new File (path, this.filename); } if (file.exists ()) { if ((this.searchType == TYPE_DIRECTORY) && (file.isDirectory())) return true; if ((this.searchType == TYPE_FILE) && (file.isFile ())) return true; } //System.out.println (path + " did not match"); return false; }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/e451b10df95ff997b9b498372eeadddaed66187c/UserInputPanel.java/clean/src/lib/com/izforge/izpack/panels/UserInputPanel.java
String value = ((XMLElement)choices.elementAt (i)).getAttribute (SEARCH_VALUE);
XMLElement choice_el = (XMLElement)choices.elementAt (i); if (! OsConstraint.oneMatchesCurrentSystem(element)) continue; String value = choice_el.getAttribute (SEARCH_VALUE);
private void addSearch (XMLElement spec) { Vector forPacks = spec.getChildrenNamed (PACKS); XMLElement element = spec.getFirstChildNamed (SPEC); String variable = spec.getAttribute (VARIABLE); String filename = null; int search_type = 0; int result_type = 0; JComboBox combobox = new JComboBox (); JLabel label = null; //System.out.println ("adding search combobox, variable "+variable); // allow the user to enter something combobox.setEditable (true); // ---------------------------------------------------- // extract the specification details // ---------------------------------------------------- if (element != null) { label = new JLabel (getText (element)); // search type is optional (default: file) search_type = SearchField.TYPE_FILE; String search_type_str = element.getAttribute (SEARCH_TYPE); if (search_type_str != null) { if (search_type_str.equals (SEARCH_FILE)) { search_type = SearchField.TYPE_FILE; } else if (search_type_str.equals (SEARCH_DIRECTORY)) { search_type = SearchField.TYPE_DIRECTORY; } } // result type is mandatory too String result_type_str = element.getAttribute (SEARCH_RESULT); if (result_type_str == null) { return; } else if (result_type_str.equals (SEARCH_FILE)) { result_type = SearchField.RESULT_FILE; } else if (result_type_str.equals (SEARCH_DIRECTORY)) { result_type = SearchField.RESULT_DIRECTORY; } else if (result_type_str.equals (SEARCH_PARENTDIR)) { result_type = SearchField.RESULT_PARENTDIR; } else { return; } // might be missing - null is okay filename = element.getAttribute (SEARCH_FILENAME); Vector choices = element.getChildrenNamed (SEARCH_CHOICE); if (choices == null) { return; } for (int i = 0; i < choices.size (); i++) { String value = ((XMLElement)choices.elementAt (i)).getAttribute (SEARCH_VALUE); combobox.addItem (value); String set = ((XMLElement)choices.elementAt (i)).getAttribute (SET); if (set != null) { if (set.equals (TRUE)) { combobox.setSelectedIndex (i); } } } } // ---------------------------------------------------- // if there is no specification element, return without // doing anything. // ---------------------------------------------------- else { return; } // ---------------------------------------------------- // get the description and add it to the list of UI // elements if it exists. // ---------------------------------------------------- element = spec.getFirstChildNamed (DESCRIPTION); addDescription (element, forPacks); TwoColumnConstraints westconstraint1 = new TwoColumnConstraints (); westconstraint1.position = TwoColumnConstraints.WEST; uiElements.add (new Object [] {null, FIELD_LABEL, null, westconstraint1, label, forPacks}); TwoColumnConstraints eastconstraint1 = new TwoColumnConstraints (); eastconstraint1.position = TwoColumnConstraints.EAST; combobox.setToolTipText (parent.langpack.getString ("UserInputPanel.search.location") + filename); uiElements.add (new Object [] {null, SEARCH_FIELD, variable, eastconstraint1, combobox, forPacks}); JPanel buttonPanel = new JPanel (); buttonPanel.setLayout (new com.izforge.izpack.gui.FlowLayout (com.izforge.izpack.gui.FlowLayout.LEADING)); JButton autodetectButton = ButtonFactory.createButton (parent.langpack.getString ("UserInputPanel.search.autodetect"), idata.buttonsHColor); autodetectButton.setToolTipText (parent.langpack.getString ("UserInputPanel.search.autodetect.tooltip")); buttonPanel.add (autodetectButton); JButton browseButton = ButtonFactory.createButton (parent.langpack.getString ("UserInputPanel.search.browse"), idata.buttonsHColor); buttonPanel.add (browseButton); TwoColumnConstraints eastonlyconstraint = new TwoColumnConstraints (); eastonlyconstraint.position = TwoColumnConstraints.EASTONLY; uiElements.add (new Object [] {null, SEARCH_BUTTON_FIELD, null, eastonlyconstraint, buttonPanel, forPacks}); searchFields.add (new SearchField (filename, parent, combobox, autodetectButton, browseButton, search_type, result_type)); }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/e451b10df95ff997b9b498372eeadddaed66187c/UserInputPanel.java/clean/src/lib/com/izforge/izpack/panels/UserInputPanel.java
String email = (a.getEmail() != null) ? (" <" + a.getEmail() + ">") : "";
String email = (a.getEmail() != null && a.getEmail().length() > 0) ? (" <" + a.getEmail() + ">") : "";
public HelloPanel(InstallerFrame parent, InstallData idata) { super(parent, idata); // The 'super' layout GridBagLayout superLayout = new GridBagLayout(); setLayout(superLayout); GridBagConstraints gbConstraints = new GridBagConstraints(); gbConstraints.insets = new Insets(0, 0, 0, 0); gbConstraints.fill = GridBagConstraints.NONE; gbConstraints.anchor = GridBagConstraints.CENTER; // We initialize our 'real' layout JPanel centerPanel = new JPanel(); layout = new BoxLayout(centerPanel, BoxLayout.Y_AXIS); centerPanel.setLayout(layout); superLayout.addLayoutComponent(centerPanel, gbConstraints); add(centerPanel); // We create and put the labels String str; centerPanel.add(Box.createVerticalStrut(10)); str = parent.langpack.getString("HelloPanel.welcome1") + idata.info.getAppName() + " " + idata.info.getAppVersion() + parent.langpack.getString("HelloPanel.welcome2"); welcomeLabel = LabelFactory.create(str, parent.icons.getImageIcon("host"), JLabel.TRAILING); centerPanel.add(welcomeLabel); centerPanel.add(Box.createVerticalStrut(20)); ArrayList authors = idata.info.getAuthors(); int size = authors.size(); if (size > 0) { str = parent.langpack.getString("HelloPanel.authors"); appAuthorsLabel = LabelFactory.create(str, parent.icons.getImageIcon("information"), JLabel.TRAILING); centerPanel.add(appAuthorsLabel); JLabel label; for (int i = 0; i < size; i++) { Info.Author a = (Info.Author) authors.get(i); String email = (a.getEmail() != null) ? (" <" + a.getEmail() + ">") : ""; label = LabelFactory.create(" - " + a.getName() + email, parent.icons .getImageIcon("empty"), JLabel.TRAILING); centerPanel.add(label); } centerPanel.add(Box.createVerticalStrut(20)); } if (idata.info.getAppURL() != null) { str = parent.langpack.getString("HelloPanel.url") + idata.info.getAppURL(); appURLLabel = LabelFactory.create(str, parent.icons.getImageIcon("bookmark"), JLabel.TRAILING); centerPanel.add(appURLLabel); } }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/a546dc0e324b44c2351bdd173cdf028e7b553772/HelloPanel.java/clean/src/lib/com/izforge/izpack/panels/HelloPanel.java
if (!line.equals("")) break;
if (!"".equals(line)) break;
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 (!line.equals("")) 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/9619b3a25f43787dc92011111668210e06c00c71/PathInputPanel.java/buggy/src/lib/com/izforge/izpack/panels/PathInputPanel.java
public boolean emitWarning (String title, String message)
public boolean emitWarning(String title, String message)
public boolean emitWarning (String title, String message) { return (JOptionPane.showConfirmDialog(this, message, title, JOptionPane.WARNING_MESSAGE, JOptionPane.OK_CANCEL_OPTION) == JOptionPane.OK_OPTION); }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/6e8ab3930a21f787bcd0f3cf0b9937f9d50c80c0/IzPanel.java/buggy/src/lib/com/izforge/izpack/installer/IzPanel.java
return (JOptionPane.showConfirmDialog(this, message, title, JOptionPane.WARNING_MESSAGE, JOptionPane.OK_CANCEL_OPTION) == JOptionPane.OK_OPTION);
return ( JOptionPane.showConfirmDialog( this, message, title, JOptionPane.WARNING_MESSAGE, JOptionPane.OK_CANCEL_OPTION) == JOptionPane.OK_OPTION);
public boolean emitWarning (String title, String message) { return (JOptionPane.showConfirmDialog(this, message, title, JOptionPane.WARNING_MESSAGE, JOptionPane.OK_CANCEL_OPTION) == JOptionPane.OK_OPTION); }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/6e8ab3930a21f787bcd0f3cf0b9937f9d50c80c0/IzPanel.java/buggy/src/lib/com/izforge/izpack/installer/IzPanel.java
if ((variable == null) || (value == null)) { }
private boolean readRadioButton (Object [] field) { String variable = null; String value = null; JRadioButton button = null; try { button = (JRadioButton)field [POS_FIELD]; if (!button.isSelected ()) { return (true); } variable = (String)field [POS_VARIABLE]; value = (String)field [POS_TRUE]; } catch (Throwable exception) { return (true); } if ((variable == null) || (value == null)) { } idata.getVariableValueMap ().setVariable (variable, value); entries.add (new TextValuePair (variable, value)); return (true); }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/6e8ab3930a21f787bcd0f3cf0b9937f9d50c80c0/UserInputPanel.java/clean/src/lib/com/izforge/izpack/panels/UserInputPanel.java
String jarPath = "bin/customActions/" + className + ".jar";
String jarPath = xmlAction.getAttribute("jar"); if( jarPath == null ) jarPath = "bin/customActions/" + className + ".jar";
private void addCustomListeners(XMLElement data) throws Exception { compilerListeners = new ArrayList(); // We get the listeners XMLElement root = data.getFirstChildNamed("listeners"); if (root == null) return; Iterator iter = root.getChildrenNamed("listener").iterator(); while (iter.hasNext()) { XMLElement xmlAction = (XMLElement) iter.next(); Object[] listener = getCompilerListenerInstance(xmlAction); if (listener != null) addCompilerListener((CompilerListener) listener[0]); String[] typeNames = new String[] { "installer", "uninstaller"}; int[] types = new int[] { CustomData.INSTALLER_LISTENER, CustomData.UNINSTALLER_LISTENER}; for (int i = 0; i < typeNames.length; ++i) { String className = xmlAction.getAttribute(typeNames[i]); if (className != null) { String jarPath = "bin/customActions/" + className + ".jar"; URL url = findIzPackResource(jarPath, "CustomAction jar file", xmlAction); CustomData ca = new CustomData(getFullClassName(url, className), getContainedFilePaths(url), OsConstraint.getOsList(xmlAction), types[i]); packager.addCustomJar(ca, url); } } } }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/5067560cae55be7ec8112093cf9e3b28b0a3f264/Compiler.java/clean/src/lib/com/izforge/izpack/compiler/Compiler.java
layout = new BoxLayout(centerPanel, BoxLayout.Y_AXIS);
BoxLayout layout = new BoxLayout(centerPanel, BoxLayout.Y_AXIS);
public FinishPanel(InstallerFrame parent, InstallData idata) { super(parent, idata); vs = new VariableSubstitutor(idata.getVariables()); // The 'super' layout GridBagLayout superLayout = new GridBagLayout(); setLayout(superLayout); GridBagConstraints gbConstraints = new GridBagConstraints(); gbConstraints.insets = new Insets(0, 0, 0, 0); gbConstraints.fill = GridBagConstraints.NONE; gbConstraints.anchor = GridBagConstraints.CENTER; // We initialize our 'real' layout centerPanel = new JPanel(); layout = new BoxLayout(centerPanel, BoxLayout.Y_AXIS); centerPanel.setLayout(layout); superLayout.addLayoutComponent(centerPanel, gbConstraints); add(centerPanel); }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/9619b3a25f43787dc92011111668210e06c00c71/FinishPanel.java/clean/src/lib/com/izforge/izpack/panels/FinishPanel.java
public InputStream getResource(String res) throws Exception { InputStream result; String basePath = ""; ResourceManager rm = null; try { rm = ResourceManager.getInstance(); basePath = rm.resourceBasePath; } catch(Exception e) { e.printStackTrace(); } result = this.getClass().getResourceAsStream( basePath+res ); if( result == null ) { throw new ResourceNotFoundException( "Warning: Resource not found: " + res ); } return result; }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/df53b17757bee3d8fd6a9cb585cb425bb91e3213/InstallerFrame.java/buggy/src/lib/com/izforge/izpack/installer/InstallerFrame.java
public InputStream getResource(String res) throws Exception { InputStream result; String basePath = ""; ResourceManager rm = null; try { rm = ResourceManager.getInstance(); basePath = rm.resourceBasePath; } catch(Exception e) { e.printStackTrace(); } result = this.getClass().getResourceAsStream( basePath+res ); if( result == null ) { throw new ResourceNotFoundException( "Warning: Resource not found: " + res ); } return result; }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/df53b17757bee3d8fd6a9cb585cb425bb91e3213/InstallerFrame.java/buggy/src/lib/com/izforge/izpack/installer/InstallerFrame.java
if (installdata.curPanelNumber<last)
try { if (installdata.curPanelNumber < last)
protected void switchPanel(int last) { if (installdata.curPanelNumber<last) { isBack = true; } panelsContainer.setVisible(false); IzPanel panel = (IzPanel) installdata.panels.get(installdata.curPanelNumber); IzPanel l_panel = (IzPanel) installdata.panels.get(last); l_panel.makeXMLData(installdata.xmlData.getChildAtIndex(last)); panelsContainer.remove(l_panel); panelsContainer.add(panel); if (installdata.curPanelNumber == 0) { prevButton.setVisible(false); lockPrevButton(); unlockNextButton(); // if we push the button back at the license panel } else if (installdata.curPanelNumber == installdata.panels.size() - 1) { prevButton.setVisible(false); nextButton.setVisible(false); lockNextButton(); // Set the default button to the only visible button. getRootPane().setDefaultButton(quitButton); } else { prevButton.setVisible(true); nextButton.setVisible(true); unlockPrevButton(); unlockNextButton(); } l_panel.panelDeactivate(); if( panel.getInitialFocus() != null ) { // Give a hint for the initial focus to the system. Component inFoc = panel.getInitialFocus(); if( JAVA_SPECIFICATION_VERSION < 1.4) inFoc.requestFocus(); else inFoc.requestFocusInWindow(); // Call the IzPanel specific method. panel.panelActivate(); // On editable text components positionite the caret to the end // of the cust existent text. if( inFoc instanceof JTextComponent ) { JTextComponent inText = (JTextComponent) inFoc; if( inText.isEditable() && inText.getDocument() != null) { inText.setCaretPosition( inText.getDocument().getLength()); } } } else panel.panelActivate(); panelsContainer.setVisible(true); loadImage(installdata.curPanelNumber); isBack = false; }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/df53b17757bee3d8fd6a9cb585cb425bb91e3213/InstallerFrame.java/buggy/src/lib/com/izforge/izpack/installer/InstallerFrame.java
isBack = true;
isBack = true;
protected void switchPanel(int last) { if (installdata.curPanelNumber<last) { isBack = true; } panelsContainer.setVisible(false); IzPanel panel = (IzPanel) installdata.panels.get(installdata.curPanelNumber); IzPanel l_panel = (IzPanel) installdata.panels.get(last); l_panel.makeXMLData(installdata.xmlData.getChildAtIndex(last)); panelsContainer.remove(l_panel); panelsContainer.add(panel); if (installdata.curPanelNumber == 0) { prevButton.setVisible(false); lockPrevButton(); unlockNextButton(); // if we push the button back at the license panel } else if (installdata.curPanelNumber == installdata.panels.size() - 1) { prevButton.setVisible(false); nextButton.setVisible(false); lockNextButton(); // Set the default button to the only visible button. getRootPane().setDefaultButton(quitButton); } else { prevButton.setVisible(true); nextButton.setVisible(true); unlockPrevButton(); unlockNextButton(); } l_panel.panelDeactivate(); if( panel.getInitialFocus() != null ) { // Give a hint for the initial focus to the system. Component inFoc = panel.getInitialFocus(); if( JAVA_SPECIFICATION_VERSION < 1.4) inFoc.requestFocus(); else inFoc.requestFocusInWindow(); // Call the IzPanel specific method. panel.panelActivate(); // On editable text components positionite the caret to the end // of the cust existent text. if( inFoc instanceof JTextComponent ) { JTextComponent inText = (JTextComponent) inFoc; if( inText.isEditable() && inText.getDocument() != null) { inText.setCaretPosition( inText.getDocument().getLength()); } } } else panel.panelActivate(); panelsContainer.setVisible(true); loadImage(installdata.curPanelNumber); isBack = false; }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/df53b17757bee3d8fd6a9cb585cb425bb91e3213/InstallerFrame.java/buggy/src/lib/com/izforge/izpack/installer/InstallerFrame.java
panelsContainer.setVisible(false); IzPanel panel = (IzPanel) installdata.panels.get(installdata.curPanelNumber); IzPanel l_panel = (IzPanel) installdata.panels.get(last); l_panel.makeXMLData(installdata.xmlData.getChildAtIndex(last)); panelsContainer.remove(l_panel); panelsContainer.add(panel); if (installdata.curPanelNumber == 0)
panelsContainer.setVisible(false); IzPanel panel = (IzPanel)installdata.panels.get(installdata.curPanelNumber); IzPanel l_panel = (IzPanel)installdata.panels.get(last); l_panel.makeXMLData(installdata.xmlData.getChildAtIndex(last)); if (installdata.curPanelNumber == 0) { prevButton.setVisible(false); lockPrevButton(); unlockNextButton(); } else if (installdata.curPanelNumber == installdata.panels.size() - 1) { prevButton.setVisible(false); nextButton.setVisible(false); lockNextButton(); getRootPane().setDefaultButton(quitButton); } else { prevButton.setVisible(true); nextButton.setVisible(true); unlockPrevButton(); unlockNextButton(); } if(panel.getInitialFocus() != null) { Component inFoc = panel.getInitialFocus(); if( JAVA_SPECIFICATION_VERSION < 1.4) { inFoc.requestFocus(); } else { inFoc.requestFocusInWindow(); } /* On editable text components position the caret to the end of the cust existent text. */ if( inFoc instanceof JTextComponent ) { JTextComponent inText = (JTextComponent) inFoc; if( inText.isEditable() && inText.getDocument() != null) { inText.setCaretPosition( inText.getDocument().getLength()); } } } panelsContainer.remove(l_panel); l_panel.panelDeactivate(); panelsContainer.add(panel); panel.panelActivate(); panelsContainer.setVisible(true); loadImage(installdata.curPanelNumber); isBack = false; } catch (Exception err)
protected void switchPanel(int last) { if (installdata.curPanelNumber<last) { isBack = true; } panelsContainer.setVisible(false); IzPanel panel = (IzPanel) installdata.panels.get(installdata.curPanelNumber); IzPanel l_panel = (IzPanel) installdata.panels.get(last); l_panel.makeXMLData(installdata.xmlData.getChildAtIndex(last)); panelsContainer.remove(l_panel); panelsContainer.add(panel); if (installdata.curPanelNumber == 0) { prevButton.setVisible(false); lockPrevButton(); unlockNextButton(); // if we push the button back at the license panel } else if (installdata.curPanelNumber == installdata.panels.size() - 1) { prevButton.setVisible(false); nextButton.setVisible(false); lockNextButton(); // Set the default button to the only visible button. getRootPane().setDefaultButton(quitButton); } else { prevButton.setVisible(true); nextButton.setVisible(true); unlockPrevButton(); unlockNextButton(); } l_panel.panelDeactivate(); if( panel.getInitialFocus() != null ) { // Give a hint for the initial focus to the system. Component inFoc = panel.getInitialFocus(); if( JAVA_SPECIFICATION_VERSION < 1.4) inFoc.requestFocus(); else inFoc.requestFocusInWindow(); // Call the IzPanel specific method. panel.panelActivate(); // On editable text components positionite the caret to the end // of the cust existent text. if( inFoc instanceof JTextComponent ) { JTextComponent inText = (JTextComponent) inFoc; if( inText.isEditable() && inText.getDocument() != null) { inText.setCaretPosition( inText.getDocument().getLength()); } } } else panel.panelActivate(); panelsContainer.setVisible(true); loadImage(installdata.curPanelNumber); isBack = false; }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/df53b17757bee3d8fd6a9cb585cb425bb91e3213/InstallerFrame.java/buggy/src/lib/com/izforge/izpack/installer/InstallerFrame.java
prevButton.setVisible(false); lockPrevButton(); unlockNextButton(); } else if (installdata.curPanelNumber == installdata.panels.size() - 1) { prevButton.setVisible(false); nextButton.setVisible(false); lockNextButton(); getRootPane().setDefaultButton(quitButton); } else { prevButton.setVisible(true); nextButton.setVisible(true); unlockPrevButton(); unlockNextButton();
err.printStackTrace();
protected void switchPanel(int last) { if (installdata.curPanelNumber<last) { isBack = true; } panelsContainer.setVisible(false); IzPanel panel = (IzPanel) installdata.panels.get(installdata.curPanelNumber); IzPanel l_panel = (IzPanel) installdata.panels.get(last); l_panel.makeXMLData(installdata.xmlData.getChildAtIndex(last)); panelsContainer.remove(l_panel); panelsContainer.add(panel); if (installdata.curPanelNumber == 0) { prevButton.setVisible(false); lockPrevButton(); unlockNextButton(); // if we push the button back at the license panel } else if (installdata.curPanelNumber == installdata.panels.size() - 1) { prevButton.setVisible(false); nextButton.setVisible(false); lockNextButton(); // Set the default button to the only visible button. getRootPane().setDefaultButton(quitButton); } else { prevButton.setVisible(true); nextButton.setVisible(true); unlockPrevButton(); unlockNextButton(); } l_panel.panelDeactivate(); if( panel.getInitialFocus() != null ) { // Give a hint for the initial focus to the system. Component inFoc = panel.getInitialFocus(); if( JAVA_SPECIFICATION_VERSION < 1.4) inFoc.requestFocus(); else inFoc.requestFocusInWindow(); // Call the IzPanel specific method. panel.panelActivate(); // On editable text components positionite the caret to the end // of the cust existent text. if( inFoc instanceof JTextComponent ) { JTextComponent inText = (JTextComponent) inFoc; if( inText.isEditable() && inText.getDocument() != null) { inText.setCaretPosition( inText.getDocument().getLength()); } } } else panel.panelActivate(); panelsContainer.setVisible(true); loadImage(installdata.curPanelNumber); isBack = false; }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/df53b17757bee3d8fd6a9cb585cb425bb91e3213/InstallerFrame.java/buggy/src/lib/com/izforge/izpack/installer/InstallerFrame.java
l_panel.panelDeactivate(); if( panel.getInitialFocus() != null ) { Component inFoc = panel.getInitialFocus(); if( JAVA_SPECIFICATION_VERSION < 1.4) inFoc.requestFocus(); else inFoc.requestFocusInWindow(); panel.panelActivate(); if( inFoc instanceof JTextComponent ) { JTextComponent inText = (JTextComponent) inFoc; if( inText.isEditable() && inText.getDocument() != null) { inText.setCaretPosition( inText.getDocument().getLength()); } } } else panel.panelActivate(); panelsContainer.setVisible(true); loadImage(installdata.curPanelNumber); isBack = false;
protected void switchPanel(int last) { if (installdata.curPanelNumber<last) { isBack = true; } panelsContainer.setVisible(false); IzPanel panel = (IzPanel) installdata.panels.get(installdata.curPanelNumber); IzPanel l_panel = (IzPanel) installdata.panels.get(last); l_panel.makeXMLData(installdata.xmlData.getChildAtIndex(last)); panelsContainer.remove(l_panel); panelsContainer.add(panel); if (installdata.curPanelNumber == 0) { prevButton.setVisible(false); lockPrevButton(); unlockNextButton(); // if we push the button back at the license panel } else if (installdata.curPanelNumber == installdata.panels.size() - 1) { prevButton.setVisible(false); nextButton.setVisible(false); lockNextButton(); // Set the default button to the only visible button. getRootPane().setDefaultButton(quitButton); } else { prevButton.setVisible(true); nextButton.setVisible(true); unlockPrevButton(); unlockNextButton(); } l_panel.panelDeactivate(); if( panel.getInitialFocus() != null ) { // Give a hint for the initial focus to the system. Component inFoc = panel.getInitialFocus(); if( JAVA_SPECIFICATION_VERSION < 1.4) inFoc.requestFocus(); else inFoc.requestFocusInWindow(); // Call the IzPanel specific method. panel.panelActivate(); // On editable text components positionite the caret to the end // of the cust existent text. if( inFoc instanceof JTextComponent ) { JTextComponent inText = (JTextComponent) inFoc; if( inText.isEditable() && inText.getDocument() != null) { inText.setCaretPosition( inText.getDocument().getLength()); } } } else panel.panelActivate(); panelsContainer.setVisible(true); loadImage(installdata.curPanelNumber); isBack = false; }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/df53b17757bee3d8fd6a9cb585cb425bb91e3213/InstallerFrame.java/buggy/src/lib/com/izforge/izpack/installer/InstallerFrame.java
{
{
private void writeUninstallData() { try { // We get the data UninstallData udata = UninstallData.getInstance(); List files = udata.getFilesList(); ZipOutputStream outJar = installdata.uninstallOutJar; if (outJar == null) return; // We write the files log outJar.putNextEntry(new ZipEntry("install.log")); BufferedWriter logWriter = new BufferedWriter(new OutputStreamWriter(outJar)); logWriter.write(installdata.getInstallPath()); logWriter.newLine(); Iterator iter = files.iterator(); while (iter.hasNext()) { logWriter.write((String) iter.next()); if (iter.hasNext()) logWriter.newLine(); } logWriter.flush(); outJar.closeEntry(); // We write the uninstaller jar file log outJar.putNextEntry(new ZipEntry("jarlocation.log")); logWriter = new BufferedWriter(new OutputStreamWriter(outJar)); logWriter.write(udata.getUninstallerJarFilename()); logWriter.newLine(); logWriter.write(udata.getUninstallerPath()); logWriter.flush(); outJar.closeEntry(); // Write out executables to execute on uninstall outJar.putNextEntry(new ZipEntry("executables")); ObjectOutputStream execStream = new ObjectOutputStream(outJar); iter = udata.getExecutablesList().iterator(); execStream.writeInt(udata.getExecutablesList().size()); while (iter.hasNext()) { ExecutableFile file = (ExecutableFile) iter.next(); execStream.writeObject(file); } execStream.flush(); outJar.closeEntry(); // Write out additional uninstall data // Do not "kill" the installation if there is a problem // with custom uninstall data. Therefore log it to Debug, // but do not throw. Map additionalData = udata.getAdditionalData(); if( additionalData != null && ! additionalData.isEmpty()) { Iterator keys = additionalData.keySet().iterator(); HashSet exist = new HashSet(); while( keys != null && keys.hasNext()) { String key = (String) keys.next(); Object contents = additionalData.get(key); if( key.equals("__uninstallLibs__")) { Iterator nativeLibIter = ((List) contents).iterator(); while( nativeLibIter != null && nativeLibIter.hasNext() ) { String nativeLibName = (String) ((List) nativeLibIter.next()).get(0); byte[] buffer = new byte[5120]; long bytesCopied = 0; int bytesInBuffer; outJar.putNextEntry(new ZipEntry( "native/" + nativeLibName)); InputStream in = getClass().getResourceAsStream("/native/" + nativeLibName); while ((bytesInBuffer = in.read(buffer)) != -1) { outJar.write(buffer, 0, bytesInBuffer); bytesCopied += bytesInBuffer; } outJar.closeEntry(); } } else if( key.equals("uninstallerListeners") || key.equals("uninstallerJars")) { // It is a ArrayList of ArrayLists which contains the full // package paths of all needed class files. // First we create a new ArrayList which contains only // the full paths for the uninstall listener self; thats // the first entry of each sub ArrayList. ArrayList subContents = new ArrayList(); // Secound put the class into uninstaller.jar Iterator listenerIter = ((List) contents).iterator(); while( listenerIter.hasNext() ) { byte[] buffer = new byte[5120]; long bytesCopied = 0; int bytesInBuffer; CustomData customData = (CustomData) listenerIter.next(); // First element of the list contains the listener class path; // remind it for later. if(customData.listenerName != null ) subContents.add(customData.listenerName); Iterator liClaIter = customData.contents.iterator(); while( liClaIter.hasNext() ) { String contentPath = (String) liClaIter.next(); if( exist.contains(contentPath )) continue; exist.add(contentPath); try { outJar.putNextEntry(new ZipEntry( contentPath)); } catch(ZipException ze ) { // Ignore, or ignore not ?? May be it is a exception because // a doubled entry was tried, then we should ignore ... Debug.trace("ZipException in writing custom data: " + ze.getMessage() ); continue; } InputStream in = getClass().getResourceAsStream("/" + contentPath); if( in != null ) { while ((bytesInBuffer = in.read(buffer)) != -1) { outJar.write(buffer, 0, bytesInBuffer); bytesCopied += bytesInBuffer; } } else Debug.trace("custom data not found: " + contentPath ); outJar.closeEntry(); } } // Third we write the list into the // uninstaller.jar outJar.putNextEntry(new ZipEntry(key)); ObjectOutputStream objOut = new ObjectOutputStream(outJar); objOut.writeObject(subContents); objOut.flush(); outJar.closeEntry(); } else { outJar.putNextEntry(new ZipEntry(key)); if( contents instanceof ByteArrayOutputStream ) { ((ByteArrayOutputStream) contents).writeTo(outJar); } else { ObjectOutputStream objOut = new ObjectOutputStream(outJar); objOut.writeObject(contents); objOut.flush(); } outJar.closeEntry(); } } } // Cleanup outJar.flush(); outJar.close(); } catch (Exception err) { err.printStackTrace(); } }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/df53b17757bee3d8fd6a9cb585cb425bb91e3213/InstallerFrame.java/buggy/src/lib/com/izforge/izpack/installer/InstallerFrame.java
private void writeUninstallData() { try { // We get the data UninstallData udata = UninstallData.getInstance(); List files = udata.getFilesList(); ZipOutputStream outJar = installdata.uninstallOutJar; if (outJar == null) return; // We write the files log outJar.putNextEntry(new ZipEntry("install.log")); BufferedWriter logWriter = new BufferedWriter(new OutputStreamWriter(outJar)); logWriter.write(installdata.getInstallPath()); logWriter.newLine(); Iterator iter = files.iterator(); while (iter.hasNext()) { logWriter.write((String) iter.next()); if (iter.hasNext()) logWriter.newLine(); } logWriter.flush(); outJar.closeEntry(); // We write the uninstaller jar file log outJar.putNextEntry(new ZipEntry("jarlocation.log")); logWriter = new BufferedWriter(new OutputStreamWriter(outJar)); logWriter.write(udata.getUninstallerJarFilename()); logWriter.newLine(); logWriter.write(udata.getUninstallerPath()); logWriter.flush(); outJar.closeEntry(); // Write out executables to execute on uninstall outJar.putNextEntry(new ZipEntry("executables")); ObjectOutputStream execStream = new ObjectOutputStream(outJar); iter = udata.getExecutablesList().iterator(); execStream.writeInt(udata.getExecutablesList().size()); while (iter.hasNext()) { ExecutableFile file = (ExecutableFile) iter.next(); execStream.writeObject(file); } execStream.flush(); outJar.closeEntry(); // Write out additional uninstall data // Do not "kill" the installation if there is a problem // with custom uninstall data. Therefore log it to Debug, // but do not throw. Map additionalData = udata.getAdditionalData(); if( additionalData != null && ! additionalData.isEmpty()) { Iterator keys = additionalData.keySet().iterator(); HashSet exist = new HashSet(); while( keys != null && keys.hasNext()) { String key = (String) keys.next(); Object contents = additionalData.get(key); if( key.equals("__uninstallLibs__")) { Iterator nativeLibIter = ((List) contents).iterator(); while( nativeLibIter != null && nativeLibIter.hasNext() ) { String nativeLibName = (String) ((List) nativeLibIter.next()).get(0); byte[] buffer = new byte[5120]; long bytesCopied = 0; int bytesInBuffer; outJar.putNextEntry(new ZipEntry( "native/" + nativeLibName)); InputStream in = getClass().getResourceAsStream("/native/" + nativeLibName); while ((bytesInBuffer = in.read(buffer)) != -1) { outJar.write(buffer, 0, bytesInBuffer); bytesCopied += bytesInBuffer; } outJar.closeEntry(); } } else if( key.equals("uninstallerListeners") || key.equals("uninstallerJars")) { // It is a ArrayList of ArrayLists which contains the full // package paths of all needed class files. // First we create a new ArrayList which contains only // the full paths for the uninstall listener self; thats // the first entry of each sub ArrayList. ArrayList subContents = new ArrayList(); // Secound put the class into uninstaller.jar Iterator listenerIter = ((List) contents).iterator(); while( listenerIter.hasNext() ) { byte[] buffer = new byte[5120]; long bytesCopied = 0; int bytesInBuffer; CustomData customData = (CustomData) listenerIter.next(); // First element of the list contains the listener class path; // remind it for later. if(customData.listenerName != null ) subContents.add(customData.listenerName); Iterator liClaIter = customData.contents.iterator(); while( liClaIter.hasNext() ) { String contentPath = (String) liClaIter.next(); if( exist.contains(contentPath )) continue; exist.add(contentPath); try { outJar.putNextEntry(new ZipEntry( contentPath)); } catch(ZipException ze ) { // Ignore, or ignore not ?? May be it is a exception because // a doubled entry was tried, then we should ignore ... Debug.trace("ZipException in writing custom data: " + ze.getMessage() ); continue; } InputStream in = getClass().getResourceAsStream("/" + contentPath); if( in != null ) { while ((bytesInBuffer = in.read(buffer)) != -1) { outJar.write(buffer, 0, bytesInBuffer); bytesCopied += bytesInBuffer; } } else Debug.trace("custom data not found: " + contentPath ); outJar.closeEntry(); } } // Third we write the list into the // uninstaller.jar outJar.putNextEntry(new ZipEntry(key)); ObjectOutputStream objOut = new ObjectOutputStream(outJar); objOut.writeObject(subContents); objOut.flush(); outJar.closeEntry(); } else { outJar.putNextEntry(new ZipEntry(key)); if( contents instanceof ByteArrayOutputStream ) { ((ByteArrayOutputStream) contents).writeTo(outJar); } else { ObjectOutputStream objOut = new ObjectOutputStream(outJar); objOut.writeObject(contents); objOut.flush(); } outJar.closeEntry(); } } } // Cleanup outJar.flush(); outJar.close(); } catch (Exception err) { err.printStackTrace(); } }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/df53b17757bee3d8fd6a9cb585cb425bb91e3213/InstallerFrame.java/buggy/src/lib/com/izforge/izpack/installer/InstallerFrame.java
private void writeUninstallData() { try { // We get the data UninstallData udata = UninstallData.getInstance(); List files = udata.getFilesList(); ZipOutputStream outJar = installdata.uninstallOutJar; if (outJar == null) return; // We write the files log outJar.putNextEntry(new ZipEntry("install.log")); BufferedWriter logWriter = new BufferedWriter(new OutputStreamWriter(outJar)); logWriter.write(installdata.getInstallPath()); logWriter.newLine(); Iterator iter = files.iterator(); while (iter.hasNext()) { logWriter.write((String) iter.next()); if (iter.hasNext()) logWriter.newLine(); } logWriter.flush(); outJar.closeEntry(); // We write the uninstaller jar file log outJar.putNextEntry(new ZipEntry("jarlocation.log")); logWriter = new BufferedWriter(new OutputStreamWriter(outJar)); logWriter.write(udata.getUninstallerJarFilename()); logWriter.newLine(); logWriter.write(udata.getUninstallerPath()); logWriter.flush(); outJar.closeEntry(); // Write out executables to execute on uninstall outJar.putNextEntry(new ZipEntry("executables")); ObjectOutputStream execStream = new ObjectOutputStream(outJar); iter = udata.getExecutablesList().iterator(); execStream.writeInt(udata.getExecutablesList().size()); while (iter.hasNext()) { ExecutableFile file = (ExecutableFile) iter.next(); execStream.writeObject(file); } execStream.flush(); outJar.closeEntry(); // Write out additional uninstall data // Do not "kill" the installation if there is a problem // with custom uninstall data. Therefore log it to Debug, // but do not throw. Map additionalData = udata.getAdditionalData(); if( additionalData != null && ! additionalData.isEmpty()) { Iterator keys = additionalData.keySet().iterator(); HashSet exist = new HashSet(); while( keys != null && keys.hasNext()) { String key = (String) keys.next(); Object contents = additionalData.get(key); if( key.equals("__uninstallLibs__")) { Iterator nativeLibIter = ((List) contents).iterator(); while( nativeLibIter != null && nativeLibIter.hasNext() ) { String nativeLibName = (String) ((List) nativeLibIter.next()).get(0); byte[] buffer = new byte[5120]; long bytesCopied = 0; int bytesInBuffer; outJar.putNextEntry(new ZipEntry( "native/" + nativeLibName)); InputStream in = getClass().getResourceAsStream("/native/" + nativeLibName); while ((bytesInBuffer = in.read(buffer)) != -1) { outJar.write(buffer, 0, bytesInBuffer); bytesCopied += bytesInBuffer; } outJar.closeEntry(); } } else if( key.equals("uninstallerListeners") || key.equals("uninstallerJars")) { // It is a ArrayList of ArrayLists which contains the full // package paths of all needed class files. // First we create a new ArrayList which contains only // the full paths for the uninstall listener self; thats // the first entry of each sub ArrayList. ArrayList subContents = new ArrayList(); // Secound put the class into uninstaller.jar Iterator listenerIter = ((List) contents).iterator(); while( listenerIter.hasNext() ) { byte[] buffer = new byte[5120]; long bytesCopied = 0; int bytesInBuffer; CustomData customData = (CustomData) listenerIter.next(); // First element of the list contains the listener class path; // remind it for later. if(customData.listenerName != null ) subContents.add(customData.listenerName); Iterator liClaIter = customData.contents.iterator(); while( liClaIter.hasNext() ) { String contentPath = (String) liClaIter.next(); if( exist.contains(contentPath )) continue; exist.add(contentPath); try { outJar.putNextEntry(new ZipEntry( contentPath)); } catch(ZipException ze ) { // Ignore, or ignore not ?? May be it is a exception because // a doubled entry was tried, then we should ignore ... Debug.trace("ZipException in writing custom data: " + ze.getMessage() ); continue; } InputStream in = getClass().getResourceAsStream("/" + contentPath); if( in != null ) { while ((bytesInBuffer = in.read(buffer)) != -1) { outJar.write(buffer, 0, bytesInBuffer); bytesCopied += bytesInBuffer; } } else Debug.trace("custom data not found: " + contentPath ); outJar.closeEntry(); } } // Third we write the list into the // uninstaller.jar outJar.putNextEntry(new ZipEntry(key)); ObjectOutputStream objOut = new ObjectOutputStream(outJar); objOut.writeObject(subContents); objOut.flush(); outJar.closeEntry(); } else { outJar.putNextEntry(new ZipEntry(key)); if( contents instanceof ByteArrayOutputStream ) { ((ByteArrayOutputStream) contents).writeTo(outJar); } else { ObjectOutputStream objOut = new ObjectOutputStream(outJar); objOut.writeObject(contents); objOut.flush(); } outJar.closeEntry(); } } } // Cleanup outJar.flush(); outJar.close(); } catch (Exception err) { err.printStackTrace(); } }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/df53b17757bee3d8fd6a9cb585cb425bb91e3213/InstallerFrame.java/buggy/src/lib/com/izforge/izpack/installer/InstallerFrame.java
private void writeUninstallData() { try { // We get the data UninstallData udata = UninstallData.getInstance(); List files = udata.getFilesList(); ZipOutputStream outJar = installdata.uninstallOutJar; if (outJar == null) return; // We write the files log outJar.putNextEntry(new ZipEntry("install.log")); BufferedWriter logWriter = new BufferedWriter(new OutputStreamWriter(outJar)); logWriter.write(installdata.getInstallPath()); logWriter.newLine(); Iterator iter = files.iterator(); while (iter.hasNext()) { logWriter.write((String) iter.next()); if (iter.hasNext()) logWriter.newLine(); } logWriter.flush(); outJar.closeEntry(); // We write the uninstaller jar file log outJar.putNextEntry(new ZipEntry("jarlocation.log")); logWriter = new BufferedWriter(new OutputStreamWriter(outJar)); logWriter.write(udata.getUninstallerJarFilename()); logWriter.newLine(); logWriter.write(udata.getUninstallerPath()); logWriter.flush(); outJar.closeEntry(); // Write out executables to execute on uninstall outJar.putNextEntry(new ZipEntry("executables")); ObjectOutputStream execStream = new ObjectOutputStream(outJar); iter = udata.getExecutablesList().iterator(); execStream.writeInt(udata.getExecutablesList().size()); while (iter.hasNext()) { ExecutableFile file = (ExecutableFile) iter.next(); execStream.writeObject(file); } execStream.flush(); outJar.closeEntry(); // Write out additional uninstall data // Do not "kill" the installation if there is a problem // with custom uninstall data. Therefore log it to Debug, // but do not throw. Map additionalData = udata.getAdditionalData(); if( additionalData != null && ! additionalData.isEmpty()) { Iterator keys = additionalData.keySet().iterator(); HashSet exist = new HashSet(); while( keys != null && keys.hasNext()) { String key = (String) keys.next(); Object contents = additionalData.get(key); if( key.equals("__uninstallLibs__")) { Iterator nativeLibIter = ((List) contents).iterator(); while( nativeLibIter != null && nativeLibIter.hasNext() ) { String nativeLibName = (String) ((List) nativeLibIter.next()).get(0); byte[] buffer = new byte[5120]; long bytesCopied = 0; int bytesInBuffer; outJar.putNextEntry(new ZipEntry( "native/" + nativeLibName)); InputStream in = getClass().getResourceAsStream("/native/" + nativeLibName); while ((bytesInBuffer = in.read(buffer)) != -1) { outJar.write(buffer, 0, bytesInBuffer); bytesCopied += bytesInBuffer; } outJar.closeEntry(); } } else if( key.equals("uninstallerListeners") || key.equals("uninstallerJars")) { // It is a ArrayList of ArrayLists which contains the full // package paths of all needed class files. // First we create a new ArrayList which contains only // the full paths for the uninstall listener self; thats // the first entry of each sub ArrayList. ArrayList subContents = new ArrayList(); // Secound put the class into uninstaller.jar Iterator listenerIter = ((List) contents).iterator(); while( listenerIter.hasNext() ) { byte[] buffer = new byte[5120]; long bytesCopied = 0; int bytesInBuffer; CustomData customData = (CustomData) listenerIter.next(); // First element of the list contains the listener class path; // remind it for later. if(customData.listenerName != null ) subContents.add(customData.listenerName); Iterator liClaIter = customData.contents.iterator(); while( liClaIter.hasNext() ) { String contentPath = (String) liClaIter.next(); if( exist.contains(contentPath )) continue; exist.add(contentPath); try { outJar.putNextEntry(new ZipEntry( contentPath)); } catch(ZipException ze ) { // Ignore, or ignore not ?? May be it is a exception because // a doubled entry was tried, then we should ignore ... Debug.trace("ZipException in writing custom data: " + ze.getMessage() ); continue; } InputStream in = getClass().getResourceAsStream("/" + contentPath); if( in != null ) { while ((bytesInBuffer = in.read(buffer)) != -1) { outJar.write(buffer, 0, bytesInBuffer); bytesCopied += bytesInBuffer; } } else Debug.trace("custom data not found: " + contentPath ); outJar.closeEntry(); } } // Third we write the list into the // uninstaller.jar outJar.putNextEntry(new ZipEntry(key)); ObjectOutputStream objOut = new ObjectOutputStream(outJar); objOut.writeObject(subContents); objOut.flush(); outJar.closeEntry(); } else { outJar.putNextEntry(new ZipEntry(key)); if( contents instanceof ByteArrayOutputStream ) { ((ByteArrayOutputStream) contents).writeTo(outJar); } else { ObjectOutputStream objOut = new ObjectOutputStream(outJar); objOut.writeObject(contents); objOut.flush(); } outJar.closeEntry(); } } } // Cleanup outJar.flush(); outJar.close(); } catch (Exception err) { err.printStackTrace(); } }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/df53b17757bee3d8fd6a9cb585cb425bb91e3213/InstallerFrame.java/buggy/src/lib/com/izforge/izpack/installer/InstallerFrame.java
updateComponents();
public void actionPerformed(ActionEvent e) { // We get the source Object source = e.getSource(); // We act depending of the source if (source == addPackButton) { // We make the new pack element XMLElement pack = new XMLElement("pack"); pack.setAttribute("required", "yes"); String inputValue; inputValue = JOptionPane.showInputDialog(langpack.getString("tabs.packs.pack_name")); if (inputValue == null) return; else pack.setAttribute("name", inputValue); XMLElement desc = new XMLElement("description"); inputValue = JOptionPane.showInputDialog(langpack.getString("tabs.packs.pack_desc")); if (inputValue == null) return; else desc.setContent(inputValue); // We add it pack.addChild(desc); installation.getFirstChildNamed("packs").addChild(pack); // We select it curPack = installation.getFirstChildNamed("packs").getChildrenNamed("pack").size() - 1; curFile = -1; } else if (source == delPackButton) { // We get the selected pack index int index = packsList.getSelectedIndex(); if (index == -1) return; // We remove the element installation.getFirstChildNamed("packs").removeChildAtIndex(index); // We try to keep something selected curPack = (index < packsList.getModel().getSize() - 2) ? index : packsList.getModel().getSize() - 2; curFile = -1; } else if (source == requiredCheckBox) { // We get the selected pack index int index = packsList.getSelectedIndex(); if (index == -1) return; // We update the element XMLElement el = installation.getFirstChildNamed("packs").getChildAtIndex(index); el.setAttribute("required", (requiredCheckBox.isSelected() ? "yes" : "no")); } else if (source == addFileButton) { // We get the selected pack index int index = packsList.getSelectedIndex(); if (index == -1) return; // We make a new element for the file XMLElement file = new XMLElement("file"); JFileChooser fileChooser = new JFileChooser(Frontend.lastDir); fileChooser.addChoosableFileFilter(fileChooser.getAcceptAllFileFilter()); fileChooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES); if (fileChooser.showOpenDialog(this) == JFileChooser.APPROVE_OPTION) { Frontend.lastDir = fileChooser.getSelectedFile().getParentFile().getAbsolutePath(); file.setAttribute("src", fileChooser.getSelectedFile().getAbsolutePath()); String inputValue; inputValue = JOptionPane.showInputDialog(langpack.getString("tabs.packs.target")); if (inputValue == null) return; else file.setAttribute("targetdir", inputValue); installation.getFirstChildNamed("packs").getChildAtIndex(index).addChild(file); // We select it curFile = filesList.getModel().getSize(); curPack = index; } } else if (source == delFileButton) { // We get the selected items indices int pindex = packsList.getSelectedIndex(); int findex = filesList.getSelectedIndex(); if ( (findex == -1) || (pindex == -1) ) return; // We remove it XMLElement root = installation.getFirstChildNamed("packs").getChildAtIndex(pindex); Vector v = root.getChildrenNamed("file"); XMLElement file = (XMLElement) v.get(findex); root.removeChild(file); // We try to keep something selected curFile = (findex < filesList.getModel().getSize() - 2) ? findex : filesList.getModel().getSize() - 2; curPack = pindex; } else if (source == parsableCheckBox) { // We get the selected items indices int pindex = packsList.getSelectedIndex(); int findex = filesList.getSelectedIndex(); if ( (findex == -1) || (pindex == -1) ) return; // We look for the file attributes XMLElement root = installation.getFirstChildNamed("packs").getChildAtIndex(pindex); Vector v = root.getChildrenNamed("file"); XMLElement file = (XMLElement) v.get(findex); File destFile = new File(file.getAttribute("src")); String destName = file.getAttribute("targetdir") + "/" + destFile.getName(); // We add or remove the parsable tag if (parsableCheckBox.isSelected()) { // Add it XMLElement p = new XMLElement("parsable"); p.setAttribute("targetfile", destName); root.addChild(p); } else { // Remove it Vector pv = root.getChildrenNamed("parsable"); int size = pv.size(); XMLElement toRemove = null; for (int i = 0; (i < size) && (toRemove == null); i++) { XMLElement el = (XMLElement) pv.get(i); if (el.getAttribute("targetfile").equalsIgnoreCase(destName)) toRemove = el; } root.removeChild(toRemove); } } else if (source == scriptPropsButton) { // We get the selected items indices int pindex = packsList.getSelectedIndex(); int findex = filesList.getSelectedIndex(); if ( (findex == -1) || (pindex == -1) ) return; // We look for the file attributes XMLElement root = installation.getFirstChildNamed("packs").getChildAtIndex(pindex); Vector v = root.getChildrenNamed("file"); XMLElement file = (XMLElement) v.get(findex); File destFile = new File(file.getAttribute("src")); String destName = file.getAttribute("targetdir") + "/" + destFile.getName(); // We find the tag Vector pv = root.getChildrenNamed("parsable"); int size = pv.size(); XMLElement toEdit = null; for (int i = 0; (i < size) && (toEdit == null); i++) { XMLElement el = (XMLElement) pv.get(i); if (el.getAttribute("targetfile").equalsIgnoreCase(destName)) toEdit = el; } // We ask for the extended attributes String inputValue; inputValue = JOptionPane.showInputDialog(langpack.getString("tabs.packs.f_type")); if (inputValue == null) return; else if (inputValue.length() != 0) toEdit.setAttribute("type", inputValue); else toEdit.removeAttribute("type"); inputValue = JOptionPane.showInputDialog(langpack.getString("tabs.packs.f_enc")); if (inputValue == null) return; else if (inputValue.length() != 0) toEdit.setAttribute("encoding", inputValue); else toEdit.removeAttribute("encoding"); } updateComponents(); }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/a55d0a442ff631fb139caa85a426e6c0211fab8e/FrontendPacksTab.java/buggy/src/lib/com/izforge/izpack/frontend/FrontendPacksTab.java
synchronized(this) { _numActive++; this.returnObject(obj); }
addObjectToPool(obj, false);
public void addObject() throws Exception { Object obj = _factory.makeObject(); synchronized(this) { _numActive++; // A little slimy - must do this because returnObject decrements it. this.returnObject(obj); } }
50977 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50977/7f2d67c8e6b741e24f7991bba00dd320f2ec7c84/GenericObjectPool.java/clean/src/java/org/apache/commons/pool/impl/GenericObjectPool.java
boolean success = true; if(_testOnReturn && !(_factory.validateObject(obj))) { success = false; } else { try { _factory.passivateObject(obj); } catch(Exception e) { success = false; } } boolean shouldDestroy = !success; synchronized(this) { _numActive--; if((_maxIdle >= 0) && (_pool.size() >= _maxIdle)) { shouldDestroy = true; } else if(success) { _pool.addFirst(new ObjectTimestampPair(obj)); } notifyAll(); } if(shouldDestroy) { try { _factory.destroyObject(obj); } catch(Exception e) { } }
addObjectToPool(obj, true);
public void returnObject(Object obj) throws Exception { assertOpen(); boolean success = true; if(_testOnReturn && !(_factory.validateObject(obj))) { success = false; } else { try { _factory.passivateObject(obj); } catch(Exception e) { success = false; } } boolean shouldDestroy = !success; synchronized(this) { _numActive--; if((_maxIdle >= 0) && (_pool.size() >= _maxIdle)) { shouldDestroy = true; } else if(success) { _pool.addFirst(new ObjectTimestampPair(obj)); } notifyAll(); // _numActive has changed } if(shouldDestroy) { try { _factory.destroyObject(obj); } catch(Exception e) { // ignored } } }
50977 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50977/7f2d67c8e6b741e24f7991bba00dd320f2ec7c84/GenericObjectPool.java/clean/src/java/org/apache/commons/pool/impl/GenericObjectPool.java
setProperty(var, val);
if (var != null && val != null) { setProperty(var, val); }
public void setVariable(String var, String val) { setProperty(var, val); }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/f4b47368117265b30f34c2a72f5cd69568bc18f0/AutomatedInstallData.java/clean/src/lib/com/izforge/izpack/installer/AutomatedInstallData.java
int check = checkValues[getPos(pack.name)];
private int dfs(int[] status) { for (int i = 0; i < packs.size(); i++) { Pack pack = (Pack) packs.get(i); int check = checkValues[getPos(pack.name)]; boolean wipe = false; if(Math.abs(check) !=1) { wipe = true; } if(pack.color == Pack.WHITE) { if(dfsVisit(pack,status,wipe)!=0) return -1; } } return 0; }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/bfa6bb3a7d59c6add151a3a40fae7af05d3f723a/PacksModel.java/clean/src/lib/com/izforge/izpack/panels/PacksModel.java
if(Math.abs(check) !=1) { wipe = true; } if(pack.color == Pack.WHITE) { if(dfsVisit(pack,status,wipe)!=0) return -1; }
if(dfsVisit(pack,status,wipe)!=0) return -1;
private int dfs(int[] status) { for (int i = 0; i < packs.size(); i++) { Pack pack = (Pack) packs.get(i); int check = checkValues[getPos(pack.name)]; boolean wipe = false; if(Math.abs(check) !=1) { wipe = true; } if(pack.color == Pack.WHITE) { if(dfsVisit(pack,status,wipe)!=0) return -1; } } return 0; }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/bfa6bb3a7d59c6add151a3a40fae7af05d3f723a/PacksModel.java/clean/src/lib/com/izforge/izpack/panels/PacksModel.java
int check = checkValues[getPos(v.name)]; if(Math.abs(check) !=1) { wipe = true; }
private int dfsVisit(Pack u,int[] status,boolean wipe) { u.color = Pack.GREY; List deps = u.revDependencies; if (deps != null) { for (int i = 0; i < deps.size(); i++) { String name = (String) deps.get(i); Pack v = (Pack)namesObj.get(name); if(wipe) { status[getPos(v.name)] =1; } int check = checkValues[getPos(v.name)]; if(Math.abs(check) !=1) { wipe = true; } if(v.color == Pack.WHITE) { final int result = dfsVisit(v,status,wipe); if(result != 0) return result; } } } u.color = Pack.BLACK; return 0; }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/bfa6bb3a7d59c6add151a3a40fae7af05d3f723a/PacksModel.java/clean/src/lib/com/izforge/izpack/panels/PacksModel.java
public Object getValueAt(int rowIndex, int columnIndex) { Pack pack = (Pack) packs.get(rowIndex); switch (columnIndex) { case 0 : return new Integer(checkValues[rowIndex]); case 1 : if (langpack == null || 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/bfa6bb3a7d59c6add151a3a40fae7af05d3f723a/PacksModel.java/clean/src/lib/com/izforge/izpack/panels/PacksModel.java
private void refreshPacksToInstall() { packsToInstall.clear(); for (int i = 0; i < packs.size(); i++) { Object pack = packs.get(i); if(Math.abs(checkValues[i]) == 1) packsToInstall.add(pack); } }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/bfa6bb3a7d59c6add151a3a40fae7af05d3f723a/PacksModel.java/clean/src/lib/com/izforge/izpack/panels/PacksModel.java
((Pack)packs.get(i)).color = Pack.WHITE;
private void updateDeps() { int[] statusArray = new int[packs.size()]; for (int i = 0; i < statusArray.length; i++) { ((Pack)packs.get(i)).color = Pack.WHITE; statusArray[i] = 0; } dfs(statusArray); for (int i = 0; i < statusArray.length; i++) { if (statusArray[i] ==0 && checkValues[i] <0) checkValues[i] += 2; if (statusArray[i] ==1 && checkValues[i] >=0) checkValues[i] = -2; } // The required ones must propagate their required status to all the ones // that they depend on for (int i = 0; i < packs.size(); i++) { Pack pack = (Pack) packs.get(i); if(pack.required ==true) propRequirement(pack.name); } }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/bfa6bb3a7d59c6add151a3a40fae7af05d3f723a/PacksModel.java/clean/src/lib/com/izforge/izpack/panels/PacksModel.java
private void updateDeps() { int[] statusArray = new int[packs.size()]; for (int i = 0; i < statusArray.length; i++) { ((Pack)packs.get(i)).color = Pack.WHITE; statusArray[i] = 0; } dfs(statusArray); for (int i = 0; i < statusArray.length; i++) { if (statusArray[i] ==0 && checkValues[i] <0) checkValues[i] += 2; if (statusArray[i] ==1 && checkValues[i] >=0) checkValues[i] = -2; } // The required ones must propagate their required status to all the ones // that they depend on for (int i = 0; i < packs.size(); i++) { Pack pack = (Pack) packs.get(i); if(pack.required ==true) propRequirement(pack.name); } }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/bfa6bb3a7d59c6add151a3a40fae7af05d3f723a/PacksModel.java/clean/src/lib/com/izforge/izpack/panels/PacksModel.java
public RegistryHandler(String className)
public RegistryHandler()
public RegistryHandler(String className) { super(className); setDefault(); }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/65829be7fc5a410510ee8132076f9911c480d666/RegistryHandler.java/buggy/src/lib/com/izforge/izpack/util/os/RegistryHandler.java
super(className); setDefault();
super();
public RegistryHandler(String className) { super(className); setDefault(); }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/65829be7fc5a410510ee8132076f9911c480d666/RegistryHandler.java/buggy/src/lib/com/izforge/izpack/util/os/RegistryHandler.java
layout = new GridBagLayout(); gbConstraints = new GridBagConstraints();
GridBagLayout layout = new GridBagLayout(); GridBagConstraints gbConstraints = new GridBagConstraints();
public InstallPanel(InstallerFrame parent, InstallData idata) { super(parent, idata); // We initialize our layout layout = new GridBagLayout(); gbConstraints = new GridBagConstraints(); setLayout(layout); int row = 1; this.tipLabel = LabelFactory.create(parent.langpack.getString("InstallPanel.tip"), parent.icons.getImageIcon("information"), JLabel.TRAILING); parent.buildConstraints(gbConstraints, 0, row++, 2, 1, 1.0, 0.0); gbConstraints.fill = GridBagConstraints.NONE; gbConstraints.anchor = GridBagConstraints.NORTHWEST; layout.addLayoutComponent(this.tipLabel, gbConstraints); add(this.tipLabel); this.packOpLabel = LabelFactory.create(" ", JLabel.TRAILING); parent.buildConstraints(gbConstraints, 0, row++, 2, 1, 1.0, 0.0); gbConstraints.anchor = GridBagConstraints.SOUTHWEST; layout.addLayoutComponent(this.packOpLabel, gbConstraints); add(this.packOpLabel); this.packProgressBar = new JProgressBar(); this.packProgressBar.setStringPainted(true); this.packProgressBar.setString(parent.langpack.getString("InstallPanel.begin")); this.packProgressBar.setValue(0); parent.buildConstraints(gbConstraints, 0, row++, 2, 1, 1.0, 0.0); gbConstraints.anchor = GridBagConstraints.NORTH; gbConstraints.fill = GridBagConstraints.HORIZONTAL; layout.addLayoutComponent(this.packProgressBar, gbConstraints); add(this.packProgressBar); // make sure there is some space between the progress bars JSeparator sep = new JSeparator(); Dimension dim = new Dimension(0, 10); sep.setPreferredSize(dim); sep.setMinimumSize(dim); sep.setMaximumSize(dim); parent.buildConstraints(gbConstraints, 0, row++, 2, 1, 1.0, 0.0); layout.addLayoutComponent(sep, gbConstraints); add(sep); this.overallOpLabel = LabelFactory.create(parent.langpack .getString("InstallPanel.progress"), parent.icons.getImageIcon("information"), JLabel.TRAILING); parent.buildConstraints(gbConstraints, 0, row++, 2, 1, 1.0, 0.0); gbConstraints.anchor = GridBagConstraints.NORTHWEST; gbConstraints.fill = GridBagConstraints.NONE; layout.addLayoutComponent(this.overallOpLabel, gbConstraints); add(this.overallOpLabel); this.overallProgressBar = new JProgressBar(); this.overallProgressBar.setStringPainted(true); this.overallProgressBar.setString(""); this.overallProgressBar.setValue(0); parent.buildConstraints(gbConstraints, 0, row++, 2, 1, 1.0, 0.0); gbConstraints.anchor = GridBagConstraints.NORTH; gbConstraints.fill = GridBagConstraints.HORIZONTAL; layout.addLayoutComponent(this.overallProgressBar, gbConstraints); add(this.overallProgressBar); }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/9619b3a25f43787dc92011111668210e06c00c71/InstallPanel.java/buggy/src/lib/com/izforge/izpack/panels/InstallPanel.java
dim.width = dim.width - (dim.width / 4);
dim.width -= (dim.width / 4);
public void panelActivate() { // We clip the panel Dimension dim = parent.getPanelsContainerSize(); dim.width = dim.width - (dim.width / 4); dim.height = 150; setMinimumSize(dim); setMaximumSize(dim); setPreferredSize(dim); parent.lockNextButton(); parent.install(this); }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/9619b3a25f43787dc92011111668210e06c00c71/InstallPanel.java/buggy/src/lib/com/izforge/izpack/panels/InstallPanel.java
properties.setProperty(property.getName(), property.getValue());
property.execute(); Properties props = property.getProperties(); Enumeration e = props.keys(); while (e.hasMoreElements()) { String name = (String) e.nextElement(); String value = props.getProperty(name); log("Adding property: " + property.getClass() + name+"=" + value, Project.MSG_VERBOSE); properties.setProperty(name, value); }
public void addConfiguredProperty(Property property) { if (properties == null) properties = new Properties(); properties.setProperty(property.getName(), property.getValue()); }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/a19c524e81d544d8a00252d0380a8beec63533d3/IzPackTask.java/buggy/src/lib/com/izforge/izpack/ant/IzPackTask.java
if (inheritAll == true) { Hashtable projectProps = getProject().getProperties(); Enumeration e = projectProps.keys(); while (e.hasMoreElements()) { String name = (String) e.nextElement(); String value = (String) projectProps.get(name); c.addProperty(name, value); } }
public void execute() throws org.apache.tools.ant.BuildException { if (input == null) throw new BuildException(ResourceBundle.getBundle( "com/izforge/izpack/ant/langpacks/messages").getString( "input_must_be_specified")); if (output == null) throw new BuildException(ResourceBundle.getBundle( "com/izforge/izpack/ant/langpacks/messages").getString( "output_must_be_specified")); // if (installerType == null) now optional if (basedir == null) throw new BuildException(ResourceBundle.getBundle( "com/izforge/izpack/ant/langpacks/messages").getString( "basedir_must_be_specified")); // if (izPackDir == null) // throw new // BuildException(java.util.ResourceBundle.getBundle("com/izforge/izpack/ant/langpacks/messages").getString("izPackDir_must_be_specified")); String kind = (installerType == null ? null : installerType.getValue()); Compiler c = new Compiler(input, basedir, kind, output);// Create the // compiler Compiler.IZPACK_HOME = izPackDir; c.setPackagerListener(this);// Listen to the compiler messages if (properties != null) { Enumeration e = properties.keys(); while (e.hasMoreElements()) { String name = (String) e.nextElement(); String value = properties.getProperty(name); c.addProperty(name, value); } } try { c.executeCompiler(); } catch (Exception e) { throw new BuildException(e);// Throw an exception if compilation // failed } }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/a19c524e81d544d8a00252d0380a8beec63533d3/IzPackTask.java/buggy/src/lib/com/izforge/izpack/ant/IzPackTask.java
font = font.deriveFont (Font.BOLD, font.getSize()*2.0f);
font = font.deriveFont (Font.BOLD, font.getSize() * 2.0f);
public CompilePanel(InstallerFrame parent, InstallData idata) throws IOException { super(parent, idata); this.worker = new CompileWorker (idata, this); GridBagConstraints gridBagConstraints; JLabel heading = new JLabel(); // put everything but the heading into it's own panel // (to center it vertically) JPanel subpanel = new JPanel (); JLabel compilerLabel = new JLabel(); compilerComboBox = new JComboBox(); this.browseButton = ButtonFactory.createButton (parent.langpack.getString ("CompilePanel.browse"), idata.buttonsHColor); JLabel argumentsLabel = new JLabel(); this.argumentsComboBox = new JComboBox(); this.startButton = ButtonFactory.createButton (parent.langpack.getString ("CompilePanel.start"), idata.buttonsHColor); this.tipLabel = new JLabel(parent.langpack.getString ("CompilePanel.tip"), parent.icons.getImageIcon ("tip"), SwingConstants.TRAILING); this.opLabel = new JLabel(); packProgressBar = new JProgressBar(); this.overallLabel = new JLabel(); this.overallProgressBar = new JProgressBar(); setLayout(new GridBagLayout()); Font font = heading.getFont (); font = font.deriveFont (Font.BOLD, font.getSize()*2.0f); heading.setFont(font); heading.setHorizontalAlignment(SwingConstants.CENTER); heading.setText(parent.langpack.getString ("CompilePanel.heading")); heading.setVerticalAlignment(SwingConstants.TOP); gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridy = 0; gridBagConstraints.fill = GridBagConstraints.HORIZONTAL; gridBagConstraints.anchor = GridBagConstraints.NORTH; gridBagConstraints.weightx = 1.0; gridBagConstraints.weighty = 0.1; add(heading, gridBagConstraints); gridBagConstraints = new GridBagConstraints(); gridBagConstraints.fill = GridBagConstraints.HORIZONTAL; gridBagConstraints.anchor = GridBagConstraints.CENTER; gridBagConstraints.gridy = 1; gridBagConstraints.weightx = 1.0; gridBagConstraints.weighty = 0.9; add (subpanel, gridBagConstraints); subpanel.setLayout(new GridBagLayout()); int row = 0; compilerLabel.setHorizontalAlignment(SwingConstants.LEFT); compilerLabel.setLabelFor(compilerComboBox); compilerLabel.setText(parent.langpack.getString ("CompilePanel.choose_compiler")); gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridy = row; gridBagConstraints.fill = GridBagConstraints.HORIZONTAL; //gridBagConstraints.weighty = 0.1; subpanel.add(compilerLabel, gridBagConstraints); compilerComboBox.setEditable(true); gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridy = row++; gridBagConstraints.fill = GridBagConstraints.HORIZONTAL; //gridBagConstraints.weighty = 0.1; Iterator it = this.worker.getAvailableCompilers().iterator(); while (it.hasNext()) compilerComboBox.addItem ((String)it.next()); subpanel.add(compilerComboBox, gridBagConstraints); gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridy = row++; gridBagConstraints.gridx = 1; gridBagConstraints.anchor = GridBagConstraints.EAST; browseButton.addActionListener (this); subpanel.add(browseButton, gridBagConstraints); argumentsLabel.setHorizontalAlignment(SwingConstants.LEFT); argumentsLabel.setLabelFor(argumentsComboBox); argumentsLabel.setText(parent.langpack.getString ("CompilePanel.additional_arguments")); //argumentsLabel.setToolTipText(""); gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridy = row; gridBagConstraints.fill = GridBagConstraints.HORIZONTAL; gridBagConstraints.weightx = 0.5; //gridBagConstraints.weighty = 0.1; subpanel.add(argumentsLabel, gridBagConstraints); argumentsComboBox.setEditable(true); gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridy = row++; gridBagConstraints.fill = GridBagConstraints.HORIZONTAL; gridBagConstraints.weightx = 0.5; //gridBagConstraints.weighty = 0.1; it = this.worker.getAvailableArguments ().iterator(); while (it.hasNext()) argumentsComboBox.addItem ((String)it.next()); subpanel.add(argumentsComboBox, gridBagConstraints); // leave some space above the label gridBagConstraints.insets = new Insets (10, 0, 0, 0); gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridy = row++; gridBagConstraints.gridwidth = 2; gridBagConstraints.fill = GridBagConstraints.NONE; gridBagConstraints.anchor = GridBagConstraints.NORTHWEST; subpanel.add(tipLabel, gridBagConstraints); opLabel.setText(" "); gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridy = row++; gridBagConstraints.gridwidth = 2; gridBagConstraints.fill = GridBagConstraints.HORIZONTAL; subpanel.add(opLabel, gridBagConstraints); packProgressBar.setValue(0); packProgressBar.setString(parent.langpack.getString ("CompilePanel.progress.initial")); packProgressBar.setStringPainted(true); gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridy = row++; gridBagConstraints.gridwidth = 2; gridBagConstraints.fill = GridBagConstraints.HORIZONTAL; gridBagConstraints.anchor = GridBagConstraints.SOUTH; subpanel.add(packProgressBar, gridBagConstraints); overallLabel.setText (parent.langpack.getString ("CompilePanel.progress.overall")); gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridy = row++; gridBagConstraints.gridwidth = 2; gridBagConstraints.fill = GridBagConstraints.HORIZONTAL; subpanel.add(overallLabel, gridBagConstraints); overallProgressBar.setValue(0); overallProgressBar.setString(""); overallProgressBar.setStringPainted(true); gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridy = row++; gridBagConstraints.gridwidth = 2; gridBagConstraints.fill = GridBagConstraints.HORIZONTAL; gridBagConstraints.anchor = GridBagConstraints.SOUTH; subpanel.add(overallProgressBar, gridBagConstraints); startButton.setText(parent.langpack.getString ("CompilePanel.start")); startButton.addActionListener (this); gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridwidth = 2; gridBagConstraints.gridy = row++; gridBagConstraints.fill = GridBagConstraints.NONE; // leave some space above the button gridBagConstraints.insets = new Insets (5, 0, 0, 0); subpanel.add(startButton, gridBagConstraints); }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/08ecc635ba8049aeb419722893f373a4a7f99a77/CompilePanel.java/clean/src/lib/com/izforge/izpack/panels/CompilePanel.java