rem
stringlengths
0
477k
add
stringlengths
0
313k
context
stringlengths
6
599k
meta
stringlengths
141
403
retrieveThumbnail();
public void setRetrievedClassification(Set paths) { if (model.getState() != LOADING_CLASSIFICATION) throw new IllegalStateException("This method should only be " + "invoked in the LOADING_CLASSIFICATION state."); if (paths == null) throw new IllegalArgumentException("No paths to set."); long userID = model.getUserDetails().getId(); long groupID = model.getParentModel().getRootGroupID(); Set set = TreeViewerTranslator.transformHierarchy(paths, userID, groupID); model.setClassifications(set); view.showClassifications(); model.getParentModel().setStatus(false, "", true); fireStateChange(); }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/464efde90db6bc5095c0a7e5952f51ad0f37ca86/EditorComponent.java/clean/SRC/org/openmicroscopy/shoola/agents/treeviewer/editors/EditorComponent.java
throw new IllegalArgumentException("No thumbnail.");
return; model.setThumbnailLoaded(true);
public void setThumbnail(BufferedImage thumbnail) { if (model.getState() != DISCARDED) { if (thumbnail == null) throw new IllegalArgumentException("No thumbnail."); view.setThumbnail(thumbnail); model.setState(READY); fireStateChange(); } }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/464efde90db6bc5095c0a7e5952f51ad0f37ca86/EditorComponent.java/clean/SRC/org/openmicroscopy/shoola/agents/treeviewer/editors/EditorComponent.java
} else if (object instanceof RubyArray) { List tmpList = (List) ((RubyArray) object).getList(); ArrayList newList = new ArrayList(); for (Iterator iter = tmpList.iterator(); iter.hasNext();) { newList.add(JavaUtil.convertArgument(primitive_to_java(recv, (IRubyObject) iter.next()), Object.class)); } javaObject = newList; } else if (object instanceof RubyHash) { Map tmpMap = (Map) ((RubyHash) object).getValueMap(); HashMap newHash = new HashMap(); for (Iterator iter = tmpMap.keySet().iterator(); iter.hasNext();) { IRubyObject key = (IRubyObject) iter.next(); IRubyObject value = (IRubyObject) tmpMap.get(key); newHash.put(JavaUtil.convertArgument(primitive_to_java(recv, key), Object.class), JavaUtil.convertArgument(primitive_to_java(recv, value), Object.class)); } javaObject = newHash;
public static IRubyObject primitive_to_java(IRubyObject recv, IRubyObject object) { if (object instanceof JavaObject) { return object; } Ruby runtime = recv.getRuntime(); Object javaObject; if (object.isNil()) { javaObject = null; } else if (object instanceof RubyFixnum) { javaObject = new Long(((RubyFixnum) object).getLongValue()); } else if (object instanceof RubyBignum) { javaObject = ((RubyBignum) object).getValue(); } else if (object instanceof RubyFloat) { javaObject = new Double(((RubyFloat) object).getValue()); } else if (object instanceof RubyString) { javaObject = ((RubyString) object).getValue(); } else if (object instanceof RubyBoolean) { javaObject = Boolean.valueOf(object.isTrue()); } else { javaObject = object; } return JavaObject.wrap(runtime, javaObject); }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/8c54b93def4895b998d669a089420d5925274ea0/Java.java/clean/src/org/jruby/javasupport/Java.java
setRolloverEnabled(true);
ClassifiedButton(ImageNode node) { if (node == null) throw new IllegalArgumentException("No node"); parentNode = node; setBorder(BorderFactory.createEmptyBorder()); //No border around icon. setMargin(new Insets(0, 0, 0, 0));//Just to make sure button sz=icon sz. setOpaque(false); //B/c button=icon. setFocusPainted(false); //Don't paint focus box on top of icon. setRolloverEnabled(true); IconManager im = IconManager.getInstance(); setIcon(im.getIcon(IconManager.CLASSIFIED_SMALL)); setRolloverIcon(im.getIcon(IconManager.CLASSIFIED_SMALL_OVER)); setToolTipText(DESCRIPTION); addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { parentNode.fireClassification(); } }); }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/58be91fb535c971d0bef1fde12344382b140273b/ClassifiedButton.java/buggy/SRC/org/openmicroscopy/shoola/agents/hiviewer/browser/ClassifiedButton.java
setRolloverIcon(im.getIcon(IconManager.CLASSIFIED_SMALL_OVER));
ClassifiedButton(ImageNode node) { if (node == null) throw new IllegalArgumentException("No node"); parentNode = node; setBorder(BorderFactory.createEmptyBorder()); //No border around icon. setMargin(new Insets(0, 0, 0, 0));//Just to make sure button sz=icon sz. setOpaque(false); //B/c button=icon. setFocusPainted(false); //Don't paint focus box on top of icon. setRolloverEnabled(true); IconManager im = IconManager.getInstance(); setIcon(im.getIcon(IconManager.CLASSIFIED_SMALL)); setRolloverIcon(im.getIcon(IconManager.CLASSIFIED_SMALL_OVER)); setToolTipText(DESCRIPTION); addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { parentNode.fireClassification(); } }); }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/58be91fb535c971d0bef1fde12344382b140273b/ClassifiedButton.java/buggy/SRC/org/openmicroscopy/shoola/agents/hiviewer/browser/ClassifiedButton.java
public Group(Integer attributeId, String name, org.openmicroscopy.omero.model.Experimenter leader, org.openmicroscopy.omero.model.Experimenter contact, org.openmicroscopy.omero.model.ModuleExecution moduleExecution, Set datasets, Set images, Set projects, Set experimenters, Set moduleExecutions, Set imageInfos) { this.attributeId = attributeId; this.name = name; this.leader = leader; this.contact = contact; this.moduleExecution = moduleExecution; this.datasets = datasets; this.images = images; this.projects = projects; this.experimenters = experimenters; this.moduleExecutions = moduleExecutions; this.imageInfos = imageInfos;
public Group() {
public Group(Integer attributeId, String name, org.openmicroscopy.omero.model.Experimenter leader, org.openmicroscopy.omero.model.Experimenter contact, org.openmicroscopy.omero.model.ModuleExecution moduleExecution, Set datasets, Set images, Set projects, Set experimenters, Set moduleExecutions, Set imageInfos) { this.attributeId = attributeId; this.name = name; this.leader = leader; this.contact = contact; this.moduleExecution = moduleExecution; this.datasets = datasets; this.images = images; this.projects = projects; this.experimenters = experimenters; this.moduleExecutions = moduleExecutions; this.imageInfos = imageInfos; }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/9570ef74198a070d72e77c417c9d25244a942de2/Group.java/clean/components/common/src/org/openmicroscopy/omero/model/Group.java
public org.openmicroscopy.omero.model.Experimenter getContact() {
public Experimenter getContact() {
public org.openmicroscopy.omero.model.Experimenter getContact() { return this.contact; }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/9570ef74198a070d72e77c417c9d25244a942de2/Group.java/clean/components/common/src/org/openmicroscopy/omero/model/Group.java
public org.openmicroscopy.omero.model.Experimenter getLeader() {
public Experimenter getLeader() {
public org.openmicroscopy.omero.model.Experimenter getLeader() { return this.leader; }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/9570ef74198a070d72e77c417c9d25244a942de2/Group.java/clean/components/common/src/org/openmicroscopy/omero/model/Group.java
public org.openmicroscopy.omero.model.ModuleExecution getModuleExecution() {
public ModuleExecution getModuleExecution() {
public org.openmicroscopy.omero.model.ModuleExecution getModuleExecution() { return this.moduleExecution; }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/9570ef74198a070d72e77c417c9d25244a942de2/Group.java/clean/components/common/src/org/openmicroscopy/omero/model/Group.java
public void setContact(org.openmicroscopy.omero.model.Experimenter contact) {
public void setContact(Experimenter contact) {
public void setContact(org.openmicroscopy.omero.model.Experimenter contact) { this.contact = contact; }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/9570ef74198a070d72e77c417c9d25244a942de2/Group.java/clean/components/common/src/org/openmicroscopy/omero/model/Group.java
public void setLeader(org.openmicroscopy.omero.model.Experimenter leader) {
public void setLeader(Experimenter leader) {
public void setLeader(org.openmicroscopy.omero.model.Experimenter leader) { this.leader = leader; }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/9570ef74198a070d72e77c417c9d25244a942de2/Group.java/clean/components/common/src/org/openmicroscopy/omero/model/Group.java
public void setModuleExecution(org.openmicroscopy.omero.model.ModuleExecution moduleExecution) {
public void setModuleExecution(ModuleExecution moduleExecution) {
public void setModuleExecution(org.openmicroscopy.omero.model.ModuleExecution moduleExecution) { this.moduleExecution = moduleExecution; }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/9570ef74198a070d72e77c417c9d25244a942de2/Group.java/clean/components/common/src/org/openmicroscopy/omero/model/Group.java
if (_log != null) { _log.info("target: " + t); }
public void addTarget(LogTarget t) { _targets.add(t); Enumeration s = _sources.elements(); while (s.hasMoreElements()) { LogSource l = (LogSource) s.nextElement(); t.attach(l); } }
52513 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/52513/4f312fd00a74365a2671f796aeebcfbe9888b8cc/LogManager.java/buggy/webmacro/src/org/webmacro/util/LogManager.java
RubyModule parentModule) {
SinglyLinkedList parentCRef) {
public RubyClass defineClassUnder(String name, RubyClass superClass, RubyModule parentModule) { throw new MockException(); }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/a1b8fc1d456e3d5c6e01579b88773383068aa85c/BaseMockRuby.java/clean/test/org/jruby/test/BaseMockRuby.java
public RubyModule defineModuleUnder(String name, RubyModule parentModule) {
public RubyModule defineModuleUnder(String name, SinglyLinkedList parentCRef) {
public RubyModule defineModuleUnder(String name, RubyModule parentModule) { throw new MockException(); }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/a1b8fc1d456e3d5c6e01579b88773383068aa85c/BaseMockRuby.java/clean/test/org/jruby/test/BaseMockRuby.java
}
}
public RubyNumeric newNumeric() { throw new MockException(); }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/a1b8fc1d456e3d5c6e01579b88773383068aa85c/BaseMockRuby.java/clean/test/org/jruby/test/BaseMockRuby.java
throw new MockException(); }
throw new MockException(); }
public RubyProc newProc() { throw new MockException(); }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/a1b8fc1d456e3d5c6e01579b88773383068aa85c/BaseMockRuby.java/clean/test/org/jruby/test/BaseMockRuby.java
/* * Seems a bit wasteful to check the URL here but t.parse() * generates "spurious" errors if the template doesn't exist */ InputStream _is = null; try { _is = url.openStream(); t = new URLTemplate(_broker,url); _log.debug("**PARSING "+url); t.parse(); return t; } finally { if (_is != null) _is.close(); }
t = new URLTemplate(_broker,url); _log.debug("**PARSING "+url); t.parse(); return t;
final private Template getTemplate(URL path) { _log.debug("get:"+path); URLTemplate t; String pre = null; String mid = null; String post = null; String pathStr = path.toExternalForm(); try { String[] parts = parseLocalePath(pathStr); String urlPath = null; URL url = path; if (parts == null) { urlPath = pathStr; } else { pre = parts[0]; mid = parts[1]; post = parts[2]; urlPath = pre+((mid == null) ? "" : mid)+post; url = new URL(urlPath); } if (urlPath.length() > 512) { throw new IllegalArgumentException("URL path too long: "+urlPath); } _log.debug("URLTemplateProvider: loading " + url+ "("+path+","+urlPath+")"); /* * Seems a bit wasteful to check the URL here but t.parse() * generates "spurious" errors if the template doesn't exist */ InputStream _is = null; try { _is = url.openStream(); t = new URLTemplate(_broker,url); _log.debug("**PARSING "+url); t.parse(); return t; } finally { if (_is != null) _is.close(); } } catch (IOException e) { _log.debug(e.getClass().getName()+" "+e.getMessage()); // try the next locale if (mid != null) { try { String p = buildPath(pre,mid,post); if (path != null) { return (Template) _broker.get(_TYPE,p); } else { return (Template) _broker.get(_TYPE,p); } } catch (Exception ex) { _log.debug(ex.getClass().getName()+" "+ex.getMessage()); // ignore } } _log.error("URLTemplateProvider(1): Could not load template: "+ path,e); } catch (Exception e) { _log.error("URLTemplateProvider(2): Could not load template: "+ path,e); } _log.debug("URLTemplateProvider: " + path + " not found."); return null; }
52513 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/52513/c6b8002d7c14caded0975f7dac50775e0400abda/URLTemplateProvider.java/buggy/webmacro/src/org/webmacro/resource/URLTemplateProvider.java
this.actException = actException; }
this.actException = actException; }
public RaiseException(RubyException actException) { this.actException = actException; }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/0a7181933af700ea8025a4197f3a5ebcc08333c3/RaiseException.java/buggy/org/jruby/exceptions/RaiseException.java
return actException; }
return actException; }
public RubyException getActException() { return actException; }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/0a7181933af700ea8025a4197f3a5ebcc08333c3/RaiseException.java/buggy/org/jruby/exceptions/RaiseException.java
this.actException = actException; }
this.actException = actException; }
public void setActException(RubyException actException) { this.actException = actException; }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/0a7181933af700ea8025a4197f3a5ebcc08333c3/RaiseException.java/buggy/org/jruby/exceptions/RaiseException.java
public static void main(String[] args) { String line; Vector nums = new Vector(); double num, sum = 0.0; double mean = 0.0; double average_deviation = 0.0; double standard_deviation = 0.0; double variance = 0.0; double skew = 0.0; double kurtosis = 0.0; double median = 0.0; double deviation = 0.0; int i, n, mid = 0; try { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); while ((line = in.readLine()) != null) { num = Double.parseDouble(line); sum += num; nums.add(new Double(num)); } } catch (IOException e) { System.err.println(e); return; } n = nums.size(); mean = sum/n; for (i=0; i<n; i++) { deviation = ((Double)nums.get(i)).doubleValue() - mean; average_deviation += Math.abs(deviation); variance += Math.pow(deviation,2); skew += Math.pow(deviation,3); kurtosis += Math.pow(deviation,4); } average_deviation /= n; variance /= (n - 1); standard_deviation = Math.sqrt(variance); if (variance != 0.0) { skew /= (n * variance * standard_deviation); kurtosis = kurtosis/(n * variance * variance) - 3.0; } Collections.sort(nums); mid = (n/2); median = (n % 2 != 0) ? ((Double)nums.get(mid)).doubleValue() : (((Double)nums.get(mid)).doubleValue() + ((Double)nums.get(mid-1)).doubleValue())/2; NumberFormat nf = NumberFormat.getInstance(); nf.setMaximumFractionDigits(13); nf.setGroupingUsed(false); nf.setMaximumFractionDigits(6); nf.setMinimumFractionDigits(6); System.out.println("n: " + n); System.out.println("median: " + nf.format(median)); System.out.println("mean: " + nf.format(mean)); System.out.println("average_deviation: " + nf.format(average_deviation)); System.out.println("standard_deviation: " + nf.format(standard_deviation)); System.out.println("variance: " + nf.format(variance)); System.out.println("skew: " + nf.format(skew)); System.out.println("kurtosis: " + nf.format(kurtosis)); }
53330 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/53330/eb6c850277407b38bcaefb81155941da0f27b849/moments.java/buggy/tests/shootout/java-start/moments.java
if("create".equals(iwc.getParameter(ContentViewer.PARAMETER_CONTENT_RESOURCE))){
if("create".equals(iwc.getParameter(ContentViewer.PARAMETER_ACTION))){
public void encodeBegin(FacesContext context) throws IOException { if(clearOnInit) { //WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "clear"); ArticleItemBean bean = getArticleItemBean(); if(bean!=null){ bean.clear(); } } // WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "updateLocale");// updateEditButtons(); super.encodeBegin(context); IWContext iwc = IWContext.getIWContext(context); String resourcePath = iwc.getParameter(ContentViewer.PARAMETER_CONTENT_RESOURCE); if(resourcePath!=null){ if("create".equals(iwc.getParameter(ContentViewer.PARAMETER_CONTENT_RESOURCE))){ //WFUtil.invoke(ARTICLE_ITEM_BEAN_ID,"setFolderLocation",resourcePath,String.class); getArticleItemBean().setFolderLocation(resourcePath); } else { //WFUtil.invoke(ARTICLE_ITEM_BEAN_ID,"load",resourcePath,String.class); try { getArticleItemBean().load(resourcePath); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } } WebDAVCategories categoriesUI = (WebDAVCategories)getCategoryEditor(); //Update the categoriesUI with the resourcePath given: if(!isInCreateMode()&& categoriesUI!=null){ //there is no resourcepath set for the article if it's about to be created categoriesUI.setResourcePath(resourcePath); } }// if(((Boolean)WFUtil.invoke(ARTICLE_ITEM_BEAN_ID,"getLanguageChange")).booleanValue()) { String languageChange=(String)WFUtil.invoke(ARTICLE_ITEM_BEAN_ID,"getLanguageChange"); if(languageChange!=null) { String articlePath = (String)WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "getArticlePath"); if(null!=articlePath && articlePath.length()>0) { boolean result = ((Boolean)WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "load",articlePath+"/"+languageChange+ArticleItemBean.ARTICLE_SUFFIX)).booleanValue(); if(!result) { System.out.println("Warning loading new language did not work!"); } } WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "setLanguageChange",""); } }
57000 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57000/44c7553551d463f44b7cb7cf5d0a43b62412701b/EditArticleView.java/buggy/src/java/com/idega/block/article/component/EditArticleView.java
buf.append(RESOURCE_DIRECTORY.getAbsolutePath()).append(";");
try { buf.append(RESOURCE_DIRECTORY.getCanonicalPath()).append(";"); } catch (IOException e) { e.printStackTrace(); }
public static void main(final String[] args) { EnhancedDebuggerWindow.PERSISTED_DEBUGGER = true; EnhancedDebuggerWindow.MAX_TABLE_ROWS = 10; XMPPConnection.DEBUG_ENABLED = true; String current = System.getProperty("java.library.path"); String classPath = System.getProperty("java.class.path"); // Set UIManager properties for JTree System.setProperty("apple.laf.useScreenMenuBar", "true"); /** Update Library Path **/ StringBuffer buf = new StringBuffer(); buf.append(current); buf.append(";"); final String workingDirectory = System.getProperty("appdir"); if (workingDirectory == null) { RESOURCE_DIRECTORY = new File(USER_HOME, "/Spark/resources").getAbsoluteFile(); BIN_DIRECTORY = new File(USER_HOME, "/Spark/bin").getAbsoluteFile(); LOG_DIRECTORY = new File(USER_HOME, "/Spark/logs").getAbsoluteFile(); RESOURCE_DIRECTORY.mkdirs(); LOG_DIRECTORY.mkdirs(); if (!RESOURCE_DIRECTORY.exists() || !LOG_DIRECTORY.exists()) { JOptionPane.showMessageDialog(new JFrame(), "Unable to create directories necessary for runtime.", "Spark Error", JOptionPane.ERROR_MESSAGE); System.exit(1); } } else { // This is the installed executable. File workingDir = new File(workingDirectory); RESOURCE_DIRECTORY = new File(workingDir, "resources").getAbsoluteFile(); BIN_DIRECTORY = new File(workingDir, "bin").getAbsoluteFile(); LOG_DIRECTORY = new File(USER_HOME, "/Spark/logs").getAbsoluteFile(); LOG_DIRECTORY.mkdirs(); buf.append(RESOURCE_DIRECTORY.getAbsolutePath()).append(";"); } buf.append(classPath); // Update System Properties System.setProperty("java.library.path", buf.toString()); System.setProperty("sun.java2d.noddraw", "true"); SwingUtilities.invokeLater(new Runnable() { public void run() { // Start Application new Spark(); } }); // Handle arguments if (args.length > 0) { argument = args[0]; } }
52006 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/52006/0807e1b794eeaa6c07d31a5c351697146a85040b/Spark.java/clean/src/java/org/jivesoftware/Spark.java
} catch (BreakException bExcptn) {
} catch (BreakJump bExcptn) {
public RubyObject eval(Ruby ruby, RubyObject self) { RubyObject result; ruby.getBlock().push(getVarNode(), getBodyNode(), self); ruby.getIter().push(RubyIter.ITER_PRE); try { while (true) { try { String file = ruby.getSourceFile(); int line = ruby.getSourceLine(); ruby.getBlock().flags &= ~RubyBlock.BLOCK_D_SCOPE; RubyBlock tmpBlock = ArgsUtil.beginCallArgs(ruby); RubyObject recv = getIterNode().eval(ruby, self); ArgsUtil.endCallArgs(ruby, tmpBlock); ruby.setSourceFile(file); ruby.setSourceLine(line); return recv.getRubyClass().call(recv, "each", null, 0); } catch (RetryException rExcptn) { } } } catch (ReturnException rExcptn) { return rExcptn.getReturnValue(); } catch (BreakException bExcptn) { return ruby.getNil(); } finally { ruby.getIter().pop(); ruby.getBlock().pop(); } }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/786cea08c1dd2092a02d1254b49fbee371ace5f9/ForNode.java/buggy/org/jruby/nodes/ForNode.java
createException = new MockCreateException();
assertValidServiceContext(serviceContext); this.serviceContext = serviceContext; createException = new MockCreateException("MockCreateException");
public Object createService(ServiceContext serviceContext) { createException = new MockCreateException(); if (throwExceptionFromCreate) throw createException; return super.createService(serviceContext); }
52533 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/52533/e4a9cb81c5b1bfeb724fd5cb9f7325ab7867ae4b/ServiceManagerTest.java/clean/kernel/src/test/org/gbean/kernel/standard/ServiceManagerTest.java
destroyException = new MockDestroyException();
assertSame(this.serviceContext, serviceContext); assertValidServiceContext(serviceContext); destroyException = new MockDestroyException("MockDestroyException");
public void destroyService(ServiceContext serviceContext) { destroyException = new MockDestroyException(); if (throwExceptionFromDestroy) throw destroyException; super.destroyService(serviceContext); }
52533 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/52533/e4a9cb81c5b1bfeb724fd5cb9f7325ab7867ae4b/ServiceManagerTest.java/clean/kernel/src/test/org/gbean/kernel/standard/ServiceManagerTest.java
public Set getStartConditions() {
public synchronized Set getStartConditions() {
public Set getStartConditions() { Set startConditions = new HashSet(super.getStartConditions()); startConditions.add(startCondition); return startConditions; }
52533 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/52533/e4a9cb81c5b1bfeb724fd5cb9f7325ab7867ae4b/ServiceManagerTest.java/clean/kernel/src/test/org/gbean/kernel/standard/ServiceManagerTest.java
public Set getStopConditions() {
public synchronized Set getStopConditions() {
public Set getStopConditions() { Set stopConditions = new HashSet(super.getStopConditions()); stopConditions.add(stopCondition); return stopConditions; }
52533 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/52533/e4a9cb81c5b1bfeb724fd5cb9f7325ab7867ae4b/ServiceManagerTest.java/clean/kernel/src/test/org/gbean/kernel/standard/ServiceManagerTest.java
assertValidEvent(serviceEvent, false);
public void serviceRegistered(ServiceEvent serviceEvent) { registered = serviceEvent; }
52533 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/52533/e4a9cb81c5b1bfeb724fd5cb9f7325ab7867ae4b/ServiceManagerTest.java/clean/kernel/src/test/org/gbean/kernel/standard/ServiceManagerTest.java
assertValidEvent(serviceEvent, true);
public void serviceRunning(ServiceEvent serviceEvent) { running = serviceEvent; }
52533 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/52533/e4a9cb81c5b1bfeb724fd5cb9f7325ab7867ae4b/ServiceManagerTest.java/clean/kernel/src/test/org/gbean/kernel/standard/ServiceManagerTest.java
assertValidEvent(serviceEvent, false);
public void serviceStartError(ServiceEvent serviceEvent) { startError = serviceEvent; }
52533 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/52533/e4a9cb81c5b1bfeb724fd5cb9f7325ab7867ae4b/ServiceManagerTest.java/clean/kernel/src/test/org/gbean/kernel/standard/ServiceManagerTest.java
assertValidEvent(serviceEvent, false);
public void serviceStarting(ServiceEvent serviceEvent) { starting = serviceEvent; }
52533 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/52533/e4a9cb81c5b1bfeb724fd5cb9f7325ab7867ae4b/ServiceManagerTest.java/clean/kernel/src/test/org/gbean/kernel/standard/ServiceManagerTest.java
assertValidEvent(serviceEvent, false);
public void serviceStopError(ServiceEvent serviceEvent) { stopError = serviceEvent; }
52533 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/52533/e4a9cb81c5b1bfeb724fd5cb9f7325ab7867ae4b/ServiceManagerTest.java/clean/kernel/src/test/org/gbean/kernel/standard/ServiceManagerTest.java
assertValidEvent(serviceEvent, false);
public void serviceStopped(ServiceEvent serviceEvent) { stopped = serviceEvent; }
52533 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/52533/e4a9cb81c5b1bfeb724fd5cb9f7325ab7867ae4b/ServiceManagerTest.java/clean/kernel/src/test/org/gbean/kernel/standard/ServiceManagerTest.java
assertValidEvent(serviceEvent, false);
public void serviceStopping(ServiceEvent serviceEvent) { stopping = serviceEvent; }
52533 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/52533/e4a9cb81c5b1bfeb724fd5cb9f7325ab7867ae4b/ServiceManagerTest.java/clean/kernel/src/test/org/gbean/kernel/standard/ServiceManagerTest.java
assertValidEvent(serviceEvent, false);
public void serviceUnregistered(ServiceEvent serviceEvent) { unregistered = serviceEvent; }
52533 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/52533/e4a9cb81c5b1bfeb724fd5cb9f7325ab7867ae4b/ServiceManagerTest.java/clean/kernel/src/test/org/gbean/kernel/standard/ServiceManagerTest.java
assertValidEvent(serviceEvent, false);
public void serviceWaitingToStart(ServiceEvent serviceEvent) { waitingToStart = serviceEvent; }
52533 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/52533/e4a9cb81c5b1bfeb724fd5cb9f7325ab7867ae4b/ServiceManagerTest.java/clean/kernel/src/test/org/gbean/kernel/standard/ServiceManagerTest.java
assertValidEvent(serviceEvent, true);
public void serviceWaitingToStop(ServiceEvent serviceEvent) { waitingToStop = serviceEvent; }
52533 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/52533/e4a9cb81c5b1bfeb724fd5cb9f7325ab7867ae4b/ServiceManagerTest.java/clean/kernel/src/test/org/gbean/kernel/standard/ServiceManagerTest.java
assertValidServiceConditionContext(context);
public void initialize(ServiceConditionContext context) { initializeCalled = true; this.context = context; if (initializedSignal != null) { initializedSignal.countDown(); } }
52533 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/52533/e4a9cb81c5b1bfeb724fd5cb9f7325ab7867ae4b/ServiceManagerTest.java/clean/kernel/src/test/org/gbean/kernel/standard/ServiceManagerTest.java
assertValidServiceConditionContext(context);
public void initialize(ServiceConditionContext context) { initializeCalled = true; this.context = context; if (initializedSignal != null) { initializedSignal.countDown(); } }
52533 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/52533/e4a9cb81c5b1bfeb724fd5cb9f7325ab7867ae4b/ServiceManagerTest.java/clean/kernel/src/test/org/gbean/kernel/standard/ServiceManagerTest.java
} else if (serviceFactory.throwExceptionFromDestroy != true) {
} else if (!serviceFactory.throwExceptionFromDestroy) {
private void destroy(StopStrategy stopStrategy) { ServiceState initialState = serviceManager.getState(); serviceMonitor.reset(); startCondition.reset(); stopCondition.reset(); kernel.reset(); try { serviceManager.destroy(stopStrategy); } catch (IllegalServiceStateException e) { assertFalse(stopCondition.satisfied); assertSame(StopStrategies.ASYNCHRONOUS, stopStrategy); } catch (UnsatisfiedConditionsException e) { assertFalse(stopCondition.satisfied); assertSame(StopStrategies.SYNCHRONOUS, stopStrategy); assertTrue(e.getUnsatisfiedConditions().contains(stopCondition)); } if (serviceFactory.restartable || initialState == ServiceState.STOPPED) { assertSame(ServiceState.STOPPED, serviceManager.getState()); assertSame(serviceName, serviceManager.getServiceName()); assertSame(serviceFactory, serviceManager.getServiceFactory()); assertSame(classLoader, serviceManager.getClassLoader()); assertEquals(0, serviceManager.getStartTime()); assertNull(serviceManager.getService()); // verify expected events fired assertNull(serviceMonitor.registered); assertNull(serviceMonitor.starting); assertNull(serviceMonitor.waitingToStart); assertNull(serviceMonitor.startError); assertNull(serviceMonitor.running); assertNull(serviceMonitor.stopping); assertNull(serviceMonitor.waitingToStop); assertNull(serviceMonitor.stopError); assertNull(serviceMonitor.stopped); assertNotNull(serviceMonitor.unregistered); } else if (!stopCondition.satisfied && stopStrategy != StopStrategies.FORCE) { assertSame(ServiceState.RUNNING, serviceManager.getState()); assertSame(serviceName, serviceManager.getServiceName()); assertSame(serviceFactory, serviceManager.getServiceFactory()); assertSame(classLoader, serviceManager.getClassLoader()); assertTrue(serviceManager.getStartTime() > 0); assertNotNull(serviceManager.getService()); assertNull(serviceMonitor.registered); assertNull(serviceMonitor.starting); assertNull(serviceMonitor.waitingToStart); assertNull(serviceMonitor.startError); assertNull(serviceMonitor.running); assertNull(serviceMonitor.stopping); if (stopStrategy == StopStrategies.ASYNCHRONOUS) { assertNotNull(serviceMonitor.waitingToStop); assertTrue(serviceMonitor.waitingToStop.getUnsatisfiedConditions().contains(stopCondition)); } else { assertNull(serviceMonitor.waitingToStop); } assertNull(serviceMonitor.stopError); assertNull(serviceMonitor.stopped); assertNull(serviceMonitor.unregistered); } else if (serviceFactory.throwExceptionFromDestroy != true) { assertSame(ServiceState.STOPPED, serviceManager.getState()); assertEquals(0, serviceManager.getStartTime()); assertNull(serviceManager.getService()); assertNull(serviceMonitor.registered); assertNull(serviceMonitor.starting); assertNull(serviceMonitor.waitingToStart); assertNull(serviceMonitor.startError); assertNull(serviceMonitor.running); assertNotNull(serviceMonitor.stopping); assertNull(serviceMonitor.waitingToStop); if (!stopCondition.satisfied && stopStrategy == StopStrategies.FORCE) { assertNotNull(serviceMonitor.stopError); } else { assertNull(serviceMonitor.stopError); } assertNotNull(serviceMonitor.stopped); assertNotNull(serviceMonitor.unregistered); if (!stopCondition.satisfied && stopStrategy == StopStrategies.FORCE) { assertEquals(serviceMonitor.stopError.getEventId() + 1, serviceMonitor.stopping.getEventId()); assertEquals(serviceMonitor.stopError.getEventId() + 2, serviceMonitor.stopped.getEventId()); assertEquals(serviceMonitor.stopError.getEventId() + 3, serviceMonitor.unregistered.getEventId()); } else { assertEquals(serviceMonitor.stopping.getEventId() + 1, serviceMonitor.stopped.getEventId()); assertEquals(serviceMonitor.stopping.getEventId() + 2, serviceMonitor.unregistered.getEventId()); } assertFalse(startCondition.initializeCalled); assertFalse(startCondition.isSatisfiedCalled); assertTrue(startCondition.destroyCalled); // There is no way to determine if the init should have been called // stopCondition.initializeCalled assertTrue(stopCondition.isSatisfiedCalled); assertTrue(stopCondition.destroyCalled); } else { assertSame(ServiceState.STOPPED, serviceManager.getState()); assertEquals(0, serviceManager.getStartTime()); assertNull(serviceManager.getService()); assertNull(serviceMonitor.registered); assertNull(serviceMonitor.starting); assertNull(serviceMonitor.waitingToStart); assertNull(serviceMonitor.startError); assertNull(serviceMonitor.running); assertNotNull(serviceMonitor.stopping); assertNull(serviceMonitor.waitingToStop); assertNotNull(serviceMonitor.stopError); assertNotNull(serviceMonitor.stopped); assertNotNull(serviceMonitor.unregistered); assertEquals(serviceMonitor.stopping.getEventId() + 1, serviceMonitor.stopError.getEventId()); assertEquals(serviceMonitor.stopping.getEventId() + 2, serviceMonitor.stopped.getEventId()); assertEquals(serviceMonitor.stopping.getEventId() + 3, serviceMonitor.unregistered.getEventId()); assertFalse(startCondition.initializeCalled); assertFalse(startCondition.isSatisfiedCalled); assertTrue(startCondition.destroyCalled); assertTrue(stopCondition.initializeCalled); assertTrue(stopCondition.isSatisfiedCalled); assertTrue(stopCondition.destroyCalled); } }
52533 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/52533/e4a9cb81c5b1bfeb724fd5cb9f7325ab7867ae4b/ServiceManagerTest.java/clean/kernel/src/test/org/gbean/kernel/standard/ServiceManagerTest.java
assertEquals(serviceName, e.getServiceName());
private void disabledStart(StartStrategy startStrategy) throws Exception { serviceFactory.setEnabled(false); try { serviceManager.start(false, startStrategy); fail("A disabled service should throw an IllegalServiceStateException from start"); } catch (IllegalServiceStateException e) { // expected } // move to starting disable, move to running, and try to restart serviceFactory.setEnabled(true); startCondition.satisfied = false; start(false, StartStrategies.ASYNCHRONOUS); serviceFactory.setEnabled(false); startCondition.satisfied = true; start(false, startStrategy); start(false, startStrategy); stop(StopStrategies.ASYNCHRONOUS); try { serviceManager.start(false, startStrategy); fail("A disabled service should throw an IllegalServiceStateException from start"); } catch (IllegalServiceStateException e) { // expected } }
52533 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/52533/e4a9cb81c5b1bfeb724fd5cb9f7325ab7867ae4b/ServiceManagerTest.java/clean/kernel/src/test/org/gbean/kernel/standard/ServiceManagerTest.java
assertTrue(serviceFactory.throwExceptionFromCreate == true);
assertTrue(serviceFactory.throwExceptionFromCreate);
private void initialize() throws Exception { long now = System.currentTimeMillis(); // introduce a bit of delay so subsequent times are much less likely to equal to not Thread.sleep(50); serviceMonitor.reset(); startCondition.reset(); stopCondition.reset(); kernel.reset(); try { serviceManager.initialize(); } catch (MockCreateException e) { assertTrue(serviceFactory.throwExceptionFromCreate == true); assertSame(serviceFactory.createException, e); } catch (UnsatisfiedConditionsException e) { assertTrue(startCondition.satisfied == false); assertTrue(e.getUnsatisfiedConditions().contains(startCondition)); } catch (IllegalServiceStateException e) { assertFalse(serviceFactory.isEnabled()); } assertSame(serviceName, serviceManager.getServiceName()); assertSame(serviceFactory, serviceManager.getServiceFactory()); assertSame(classLoader, serviceManager.getClassLoader()); if (serviceFactory.restartable) { assertSame(ServiceState.STOPPED, serviceManager.getState()); assertEquals(0, serviceManager.getStartTime()); assertNull(serviceManager.getService()); assertNotNull(serviceMonitor.registered); assertNull(serviceMonitor.starting); assertNull(serviceMonitor.waitingToStart); assertNull(serviceMonitor.startError); assertNull(serviceMonitor.running); assertNull(serviceMonitor.stopping); assertNull(serviceMonitor.waitingToStop); assertNull(serviceMonitor.stopError); assertNull(serviceMonitor.stopped); assertNull(serviceMonitor.unregistered); assertFalse(startCondition.initializeCalled); assertFalse(startCondition.isSatisfiedCalled); assertFalse(startCondition.destroyCalled); assertFalse(stopCondition.initializeCalled); assertFalse(stopCondition.isSatisfiedCalled); assertFalse(stopCondition.destroyCalled); } else if (!serviceFactory.isEnabled()) { assertSame(ServiceState.STOPPED, serviceManager.getState()); assertEquals(0, serviceManager.getStartTime()); assertNull(serviceManager.getService()); assertNull(serviceMonitor.registered); assertNull(serviceMonitor.starting); assertNull(serviceMonitor.waitingToStart); assertNull(serviceMonitor.startError); assertNull(serviceMonitor.running); assertNull(serviceMonitor.stopping); assertNull(serviceMonitor.stopError); assertNull(serviceMonitor.stopped); assertNull(serviceMonitor.unregistered); assertFalse(startCondition.initializeCalled); assertFalse(startCondition.isSatisfiedCalled); assertFalse(startCondition.destroyCalled); assertFalse(stopCondition.initializeCalled); assertFalse(stopCondition.isSatisfiedCalled); assertFalse(stopCondition.destroyCalled); } else if (serviceFactory.throwExceptionFromCreate != true && startCondition.satisfied == true) { assertSame(ServiceState.RUNNING, serviceManager.getState()); assertSame(SERVICE, serviceManager.getService()); assertTrue(serviceManager.getStartTime() > now); assertNotNull(serviceMonitor.registered); assertNotNull(serviceMonitor.starting); assertNull(serviceMonitor.waitingToStart); assertNull(serviceMonitor.startError); assertNotNull(serviceMonitor.running); assertNull(serviceMonitor.stopping); assertNull(serviceMonitor.stopError); assertNull(serviceMonitor.stopped); assertNull(serviceMonitor.unregistered); assertEquals(serviceMonitor.registered.getEventId() + 1, serviceMonitor.starting.getEventId()); assertEquals(serviceMonitor.registered.getEventId() + 2, serviceMonitor.running.getEventId()); assertTrue(startCondition.initializeCalled); assertTrue(startCondition.isSatisfiedCalled); assertFalse(startCondition.destroyCalled); assertFalse(stopCondition.initializeCalled); assertFalse(stopCondition.isSatisfiedCalled); assertFalse(stopCondition.destroyCalled); } else { assertSame(ServiceState.STOPPED, serviceManager.getState()); assertEquals(0, serviceManager.getStartTime()); assertNull(serviceManager.getService()); assertNotNull(serviceMonitor.registered); assertNotNull(serviceMonitor.starting); assertNull(serviceMonitor.waitingToStart); assertNull(serviceMonitor.startError); assertNull(serviceMonitor.running); assertNotNull(serviceMonitor.stopping); assertNull(serviceMonitor.stopError); assertNotNull(serviceMonitor.stopped); assertNotNull(serviceMonitor.unregistered); assertEquals(serviceMonitor.registered.getEventId() + 1, serviceMonitor.starting.getEventId()); assertEquals(serviceMonitor.registered.getEventId() + 2, serviceMonitor.stopping.getEventId()); assertEquals(serviceMonitor.registered.getEventId() + 3, serviceMonitor.stopped.getEventId()); assertEquals(serviceMonitor.registered.getEventId() + 4, serviceMonitor.unregistered.getEventId()); assertTrue(startCondition.initializeCalled); assertTrue(startCondition.isSatisfiedCalled); assertTrue(startCondition.destroyCalled); assertFalse(stopCondition.initializeCalled); assertFalse(stopCondition.isSatisfiedCalled); assertFalse(stopCondition.destroyCalled); } }
52533 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/52533/e4a9cb81c5b1bfeb724fd5cb9f7325ab7867ae4b/ServiceManagerTest.java/clean/kernel/src/test/org/gbean/kernel/standard/ServiceManagerTest.java
assertTrue(startCondition.satisfied == false);
assertTrue(!startCondition.satisfied);
private void initialize() throws Exception { long now = System.currentTimeMillis(); // introduce a bit of delay so subsequent times are much less likely to equal to not Thread.sleep(50); serviceMonitor.reset(); startCondition.reset(); stopCondition.reset(); kernel.reset(); try { serviceManager.initialize(); } catch (MockCreateException e) { assertTrue(serviceFactory.throwExceptionFromCreate == true); assertSame(serviceFactory.createException, e); } catch (UnsatisfiedConditionsException e) { assertTrue(startCondition.satisfied == false); assertTrue(e.getUnsatisfiedConditions().contains(startCondition)); } catch (IllegalServiceStateException e) { assertFalse(serviceFactory.isEnabled()); } assertSame(serviceName, serviceManager.getServiceName()); assertSame(serviceFactory, serviceManager.getServiceFactory()); assertSame(classLoader, serviceManager.getClassLoader()); if (serviceFactory.restartable) { assertSame(ServiceState.STOPPED, serviceManager.getState()); assertEquals(0, serviceManager.getStartTime()); assertNull(serviceManager.getService()); assertNotNull(serviceMonitor.registered); assertNull(serviceMonitor.starting); assertNull(serviceMonitor.waitingToStart); assertNull(serviceMonitor.startError); assertNull(serviceMonitor.running); assertNull(serviceMonitor.stopping); assertNull(serviceMonitor.waitingToStop); assertNull(serviceMonitor.stopError); assertNull(serviceMonitor.stopped); assertNull(serviceMonitor.unregistered); assertFalse(startCondition.initializeCalled); assertFalse(startCondition.isSatisfiedCalled); assertFalse(startCondition.destroyCalled); assertFalse(stopCondition.initializeCalled); assertFalse(stopCondition.isSatisfiedCalled); assertFalse(stopCondition.destroyCalled); } else if (!serviceFactory.isEnabled()) { assertSame(ServiceState.STOPPED, serviceManager.getState()); assertEquals(0, serviceManager.getStartTime()); assertNull(serviceManager.getService()); assertNull(serviceMonitor.registered); assertNull(serviceMonitor.starting); assertNull(serviceMonitor.waitingToStart); assertNull(serviceMonitor.startError); assertNull(serviceMonitor.running); assertNull(serviceMonitor.stopping); assertNull(serviceMonitor.stopError); assertNull(serviceMonitor.stopped); assertNull(serviceMonitor.unregistered); assertFalse(startCondition.initializeCalled); assertFalse(startCondition.isSatisfiedCalled); assertFalse(startCondition.destroyCalled); assertFalse(stopCondition.initializeCalled); assertFalse(stopCondition.isSatisfiedCalled); assertFalse(stopCondition.destroyCalled); } else if (serviceFactory.throwExceptionFromCreate != true && startCondition.satisfied == true) { assertSame(ServiceState.RUNNING, serviceManager.getState()); assertSame(SERVICE, serviceManager.getService()); assertTrue(serviceManager.getStartTime() > now); assertNotNull(serviceMonitor.registered); assertNotNull(serviceMonitor.starting); assertNull(serviceMonitor.waitingToStart); assertNull(serviceMonitor.startError); assertNotNull(serviceMonitor.running); assertNull(serviceMonitor.stopping); assertNull(serviceMonitor.stopError); assertNull(serviceMonitor.stopped); assertNull(serviceMonitor.unregistered); assertEquals(serviceMonitor.registered.getEventId() + 1, serviceMonitor.starting.getEventId()); assertEquals(serviceMonitor.registered.getEventId() + 2, serviceMonitor.running.getEventId()); assertTrue(startCondition.initializeCalled); assertTrue(startCondition.isSatisfiedCalled); assertFalse(startCondition.destroyCalled); assertFalse(stopCondition.initializeCalled); assertFalse(stopCondition.isSatisfiedCalled); assertFalse(stopCondition.destroyCalled); } else { assertSame(ServiceState.STOPPED, serviceManager.getState()); assertEquals(0, serviceManager.getStartTime()); assertNull(serviceManager.getService()); assertNotNull(serviceMonitor.registered); assertNotNull(serviceMonitor.starting); assertNull(serviceMonitor.waitingToStart); assertNull(serviceMonitor.startError); assertNull(serviceMonitor.running); assertNotNull(serviceMonitor.stopping); assertNull(serviceMonitor.stopError); assertNotNull(serviceMonitor.stopped); assertNotNull(serviceMonitor.unregistered); assertEquals(serviceMonitor.registered.getEventId() + 1, serviceMonitor.starting.getEventId()); assertEquals(serviceMonitor.registered.getEventId() + 2, serviceMonitor.stopping.getEventId()); assertEquals(serviceMonitor.registered.getEventId() + 3, serviceMonitor.stopped.getEventId()); assertEquals(serviceMonitor.registered.getEventId() + 4, serviceMonitor.unregistered.getEventId()); assertTrue(startCondition.initializeCalled); assertTrue(startCondition.isSatisfiedCalled); assertTrue(startCondition.destroyCalled); assertFalse(stopCondition.initializeCalled); assertFalse(stopCondition.isSatisfiedCalled); assertFalse(stopCondition.destroyCalled); } }
52533 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/52533/e4a9cb81c5b1bfeb724fd5cb9f7325ab7867ae4b/ServiceManagerTest.java/clean/kernel/src/test/org/gbean/kernel/standard/ServiceManagerTest.java
} else if (serviceFactory.throwExceptionFromCreate != true && startCondition.satisfied == true) {
} else if (!serviceFactory.throwExceptionFromCreate && startCondition.satisfied) {
private void initialize() throws Exception { long now = System.currentTimeMillis(); // introduce a bit of delay so subsequent times are much less likely to equal to not Thread.sleep(50); serviceMonitor.reset(); startCondition.reset(); stopCondition.reset(); kernel.reset(); try { serviceManager.initialize(); } catch (MockCreateException e) { assertTrue(serviceFactory.throwExceptionFromCreate == true); assertSame(serviceFactory.createException, e); } catch (UnsatisfiedConditionsException e) { assertTrue(startCondition.satisfied == false); assertTrue(e.getUnsatisfiedConditions().contains(startCondition)); } catch (IllegalServiceStateException e) { assertFalse(serviceFactory.isEnabled()); } assertSame(serviceName, serviceManager.getServiceName()); assertSame(serviceFactory, serviceManager.getServiceFactory()); assertSame(classLoader, serviceManager.getClassLoader()); if (serviceFactory.restartable) { assertSame(ServiceState.STOPPED, serviceManager.getState()); assertEquals(0, serviceManager.getStartTime()); assertNull(serviceManager.getService()); assertNotNull(serviceMonitor.registered); assertNull(serviceMonitor.starting); assertNull(serviceMonitor.waitingToStart); assertNull(serviceMonitor.startError); assertNull(serviceMonitor.running); assertNull(serviceMonitor.stopping); assertNull(serviceMonitor.waitingToStop); assertNull(serviceMonitor.stopError); assertNull(serviceMonitor.stopped); assertNull(serviceMonitor.unregistered); assertFalse(startCondition.initializeCalled); assertFalse(startCondition.isSatisfiedCalled); assertFalse(startCondition.destroyCalled); assertFalse(stopCondition.initializeCalled); assertFalse(stopCondition.isSatisfiedCalled); assertFalse(stopCondition.destroyCalled); } else if (!serviceFactory.isEnabled()) { assertSame(ServiceState.STOPPED, serviceManager.getState()); assertEquals(0, serviceManager.getStartTime()); assertNull(serviceManager.getService()); assertNull(serviceMonitor.registered); assertNull(serviceMonitor.starting); assertNull(serviceMonitor.waitingToStart); assertNull(serviceMonitor.startError); assertNull(serviceMonitor.running); assertNull(serviceMonitor.stopping); assertNull(serviceMonitor.stopError); assertNull(serviceMonitor.stopped); assertNull(serviceMonitor.unregistered); assertFalse(startCondition.initializeCalled); assertFalse(startCondition.isSatisfiedCalled); assertFalse(startCondition.destroyCalled); assertFalse(stopCondition.initializeCalled); assertFalse(stopCondition.isSatisfiedCalled); assertFalse(stopCondition.destroyCalled); } else if (serviceFactory.throwExceptionFromCreate != true && startCondition.satisfied == true) { assertSame(ServiceState.RUNNING, serviceManager.getState()); assertSame(SERVICE, serviceManager.getService()); assertTrue(serviceManager.getStartTime() > now); assertNotNull(serviceMonitor.registered); assertNotNull(serviceMonitor.starting); assertNull(serviceMonitor.waitingToStart); assertNull(serviceMonitor.startError); assertNotNull(serviceMonitor.running); assertNull(serviceMonitor.stopping); assertNull(serviceMonitor.stopError); assertNull(serviceMonitor.stopped); assertNull(serviceMonitor.unregistered); assertEquals(serviceMonitor.registered.getEventId() + 1, serviceMonitor.starting.getEventId()); assertEquals(serviceMonitor.registered.getEventId() + 2, serviceMonitor.running.getEventId()); assertTrue(startCondition.initializeCalled); assertTrue(startCondition.isSatisfiedCalled); assertFalse(startCondition.destroyCalled); assertFalse(stopCondition.initializeCalled); assertFalse(stopCondition.isSatisfiedCalled); assertFalse(stopCondition.destroyCalled); } else { assertSame(ServiceState.STOPPED, serviceManager.getState()); assertEquals(0, serviceManager.getStartTime()); assertNull(serviceManager.getService()); assertNotNull(serviceMonitor.registered); assertNotNull(serviceMonitor.starting); assertNull(serviceMonitor.waitingToStart); assertNull(serviceMonitor.startError); assertNull(serviceMonitor.running); assertNotNull(serviceMonitor.stopping); assertNull(serviceMonitor.stopError); assertNotNull(serviceMonitor.stopped); assertNotNull(serviceMonitor.unregistered); assertEquals(serviceMonitor.registered.getEventId() + 1, serviceMonitor.starting.getEventId()); assertEquals(serviceMonitor.registered.getEventId() + 2, serviceMonitor.stopping.getEventId()); assertEquals(serviceMonitor.registered.getEventId() + 3, serviceMonitor.stopped.getEventId()); assertEquals(serviceMonitor.registered.getEventId() + 4, serviceMonitor.unregistered.getEventId()); assertTrue(startCondition.initializeCalled); assertTrue(startCondition.isSatisfiedCalled); assertTrue(startCondition.destroyCalled); assertFalse(stopCondition.initializeCalled); assertFalse(stopCondition.isSatisfiedCalled); assertFalse(stopCondition.destroyCalled); } }
52533 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/52533/e4a9cb81c5b1bfeb724fd5cb9f7325ab7867ae4b/ServiceManagerTest.java/clean/kernel/src/test/org/gbean/kernel/standard/ServiceManagerTest.java
assertEquals(serviceName, e.getServiceName());
private void startException(StartStrategy startStrategy, boolean recursive) throws Exception { serviceFactory.throwExceptionFromCreate = true; try { start(recursive, startStrategy); } catch (MockCreateException e) { assertTrue(startStrategy == StartStrategies.SYNCHRONOUS || startStrategy == StartStrategies.BLOCK); assertEquals(serviceFactory.createException, e); } catch (UnregisterServiceException e) { assertEquals(StartStrategies.UNREGISTER, startStrategy); assertSame(serviceFactory.createException, e.getCause()); } stop(StopStrategies.SYNCHRONOUS); }
52533 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/52533/e4a9cb81c5b1bfeb724fd5cb9f7325ab7867ae4b/ServiceManagerTest.java/clean/kernel/src/test/org/gbean/kernel/standard/ServiceManagerTest.java
} catch (IllegalServiceStateException excpected) {
} catch (IllegalServiceStateException e) {
private void startFromStopping(StartStrategy startStrategy) throws Exception { start(false, StartStrategies.ASYNCHRONOUS); stopCondition.satisfied = false; stop(StopStrategies.ASYNCHRONOUS); try { serviceManager.start(false, startStrategy); fail("Should have thrown an IllegalServiceStateException since start on a stopping service is an error"); } catch (IllegalServiceStateException excpected) { // expected } stopCondition.satisfied = true; stop(StopStrategies.ASYNCHRONOUS); }
52533 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/52533/e4a9cb81c5b1bfeb724fd5cb9f7325ab7867ae4b/ServiceManagerTest.java/clean/kernel/src/test/org/gbean/kernel/standard/ServiceManagerTest.java
assertEquals(serviceName, e.getServiceName());
private void startFromStopping(StartStrategy startStrategy) throws Exception { start(false, StartStrategies.ASYNCHRONOUS); stopCondition.satisfied = false; stop(StopStrategies.ASYNCHRONOUS); try { serviceManager.start(false, startStrategy); fail("Should have thrown an IllegalServiceStateException since start on a stopping service is an error"); } catch (IllegalServiceStateException excpected) { // expected } stopCondition.satisfied = true; stop(StopStrategies.ASYNCHRONOUS); }
52533 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/52533/e4a9cb81c5b1bfeb724fd5cb9f7325ab7867ae4b/ServiceManagerTest.java/clean/kernel/src/test/org/gbean/kernel/standard/ServiceManagerTest.java
assertEquals(serviceName, e.getServiceName());
private void startStopsException(StartStrategy startStrategy, StopStrategy stopStrategy) throws Exception { serviceFactory.throwExceptionFromCreate = true; serviceFactory.throwExceptionFromDestroy = true; try { start(false, startStrategy); } catch (MockCreateException e) { assertTrue(startStrategy == StartStrategies.SYNCHRONOUS || startStrategy == StartStrategies.BLOCK); assertEquals(serviceFactory.createException, e); } catch (UnregisterServiceException e) { assertEquals(StartStrategies.UNREGISTER, startStrategy); assertSame(serviceFactory.createException, e.getCause()); } stop(stopStrategy); }
52533 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/52533/e4a9cb81c5b1bfeb724fd5cb9f7325ab7867ae4b/ServiceManagerTest.java/clean/kernel/src/test/org/gbean/kernel/standard/ServiceManagerTest.java
assertEquals(serviceName, cause.getServiceName());
private void startWaiting(StartStrategy startStrategy, boolean recursive) throws Exception { startCondition.satisfied = false; try { start(recursive, startStrategy); } catch (UnsatisfiedConditionsException e) { assertTrue(startStrategy == StartStrategies.SYNCHRONOUS); assertTrue(e.getUnsatisfiedConditions().contains(startCondition)); } catch (UnregisterServiceException e) { assertEquals(StartStrategies.UNREGISTER, startStrategy); UnsatisfiedConditionsException cause = (UnsatisfiedConditionsException) e.getCause(); assertTrue(cause.getUnsatisfiedConditions().contains(startCondition)); } stop(StopStrategies.SYNCHRONOUS); }
52533 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/52533/e4a9cb81c5b1bfeb724fd5cb9f7325ab7867ae4b/ServiceManagerTest.java/clean/kernel/src/test/org/gbean/kernel/standard/ServiceManagerTest.java
assertEquals(serviceName, cause.getServiceName());
private void startWaitingStart(StartStrategy startStrategy, boolean recursive) throws Exception { startCondition.satisfied = recursive; try { start(recursive, startStrategy); } catch (UnsatisfiedConditionsException e) { assertTrue(startStrategy == StartStrategies.SYNCHRONOUS); assertTrue(e.getUnsatisfiedConditions().contains(startCondition)); } catch (UnregisterServiceException e) { assertEquals(StartStrategies.UNREGISTER, startStrategy); UnsatisfiedConditionsException cause = (UnsatisfiedConditionsException) e.getCause(); assertTrue(cause.getUnsatisfiedConditions().contains(startCondition)); } try { start(recursive, startStrategy); } catch (UnsatisfiedConditionsException e) { assertTrue(startStrategy == StartStrategies.SYNCHRONOUS); assertTrue(e.getUnsatisfiedConditions().contains(startCondition)); } catch (UnregisterServiceException e) { assertEquals(StartStrategies.UNREGISTER, startStrategy); UnsatisfiedConditionsException cause = (UnsatisfiedConditionsException) e.getCause(); assertTrue(cause.getUnsatisfiedConditions().contains(startCondition)); } startCondition.satisfied = true; start(recursive, startStrategy); start(recursive, startStrategy); stop(StopStrategies.SYNCHRONOUS); }
52533 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/52533/e4a9cb81c5b1bfeb724fd5cb9f7325ab7867ae4b/ServiceManagerTest.java/clean/kernel/src/test/org/gbean/kernel/standard/ServiceManagerTest.java
assertEquals(serviceName, cause.getServiceName());
private void stop(StopStrategy stopStrategy) throws Exception { serviceMonitor.reset(); startCondition.reset(); stopCondition.reset(); kernel.reset(); ServiceState initialState = serviceManager.getState(); serviceManager.stop(stopStrategy); assertSame(serviceName, serviceManager.getServiceName()); assertSame(serviceFactory, serviceManager.getServiceFactory()); assertSame(classLoader, serviceManager.getClassLoader()); // these events should never fire in response to start assertNull(serviceMonitor.registered); assertNull(serviceMonitor.starting); assertNull(serviceMonitor.waitingToStart); assertNull(serviceMonitor.startError); assertNull(serviceMonitor.running); if (initialState == ServiceState.STOPPED) { // // We were alredy stopped so nothing should have happened // assertEquals(0, serviceManager.getStartTime()); assertNull(serviceManager.getService()); assertSame(ServiceState.STOPPED, serviceManager.getState()); assertNull(serviceMonitor.stopping); assertNull(serviceMonitor.waitingToStop); assertNull(serviceMonitor.stopError); assertNull(serviceMonitor.stopped); assertNull(serviceMonitor.unregistered); // start condition methods assertFalse(startCondition.initializeCalled); assertFalse(startCondition.isSatisfiedCalled); assertFalse(startCondition.destroyCalled); // stop condition methods assertFalse(stopCondition.initializeCalled); assertFalse(stopCondition.isSatisfiedCalled); assertFalse(stopCondition.destroyCalled); } else if (!stopCondition.satisfied && stopStrategy != StopStrategies.FORCE) { // // waiting to stop // assertSame(ServiceState.STOPPING, serviceManager.getState()); assertTrue(serviceManager.getStartTime() > 0); assertSame(SERVICE, serviceManager.getService()); // verify expected events fired if (initialState != ServiceState.STOPPING) { assertNotNull(serviceMonitor.stopping); } assertNotNull(serviceMonitor.waitingToStop); assertNull(serviceMonitor.stopError); assertNull(serviceMonitor.stopped); assertNull(serviceMonitor.unregistered); // verify events fired in the correct order if (initialState != ServiceState.STOPPING) { assertEquals(serviceMonitor.stopping.getEventId() + 1, serviceMonitor.waitingToStop.getEventId()); } // our condition should be in the unsatisfied condition list assertNotNull(serviceMonitor.waitingToStop.getUnsatisfiedConditions()); assertTrue(serviceMonitor.waitingToStop.getUnsatisfiedConditions().contains(stopCondition)); // start condition methods assertFalse(startCondition.initializeCalled); assertFalse(startCondition.isSatisfiedCalled); assertFalse(startCondition.destroyCalled); // stop condition methods if (initialState == ServiceState.RUNNING) { assertTrue(stopCondition.initializeCalled); } else { assertFalse(stopCondition.initializeCalled); } assertTrue(stopCondition.isSatisfiedCalled); assertFalse(stopCondition.destroyCalled); } else if (!serviceFactory.throwExceptionFromDestroy) { // // Normal transition to STOPPED from either STARTING, RUNNING or STOPPING // assertSame(ServiceState.STOPPED, serviceManager.getState()); assertEquals(0, serviceManager.getStartTime()); assertNull(serviceManager.getService()); // verify expected events fired if (initialState != ServiceState.STOPPING) { assertNotNull(serviceMonitor.stopping); } assertNull(serviceMonitor.waitingToStop); if (stopStrategy == StopStrategies.FORCE) { assertNotNull(serviceMonitor.stopError); ForcedStopException cause = (ForcedStopException) serviceMonitor.stopError.getCause(); assertTrue(cause.getUnsatisfiedConditions().contains(stopCondition)); } else { assertNull(serviceMonitor.stopError); } assertNotNull(serviceMonitor.stopped); assertNull(serviceMonitor.unregistered); // verify events fired in the correct order if (stopStrategy == StopStrategies.FORCE) { assertEquals(serviceMonitor.stopping.getEventId() + 1, serviceMonitor.stopError.getEventId()); assertEquals(serviceMonitor.stopping.getEventId() + 2, serviceMonitor.stopped.getEventId()); } else if (initialState != ServiceState.STOPPING) { assertEquals(serviceMonitor.stopping.getEventId() + 1, serviceMonitor.stopped.getEventId()); } // start condition methods assertFalse(startCondition.initializeCalled); assertFalse(startCondition.isSatisfiedCalled); assertTrue(startCondition.destroyCalled); // stop condition methods if (initialState == ServiceState.STOPPING) { assertFalse(stopCondition.initializeCalled); assertTrue(stopCondition.isSatisfiedCalled); assertTrue(stopCondition.destroyCalled); } else { assertTrue(stopCondition.initializeCalled); assertTrue(stopCondition.isSatisfiedCalled); assertTrue(stopCondition.destroyCalled); } } else { // // Throw an exception from the destroy method // assertEquals(0, serviceManager.getStartTime()); assertNull(serviceManager.getService()); assertSame(ServiceState.STOPPED, serviceManager.getState()); // verify expected events fired if (initialState != ServiceState.STOPPING) { assertNotNull(serviceMonitor.stopping); } assertNull(serviceMonitor.waitingToStop); assertNotNull(serviceMonitor.stopError); assertNotNull(serviceMonitor.stopped); assertNull(serviceMonitor.unregistered); // verify events fired in the correct order if (initialState != ServiceState.STOPPING) { assertEquals(serviceMonitor.stopping.getEventId() + 1, serviceMonitor.stopError.getEventId()); assertEquals(serviceMonitor.stopping.getEventId() + 2, serviceMonitor.stopped.getEventId()); } else { assertEquals(serviceMonitor.stopError.getEventId() + 1, serviceMonitor.stopped.getEventId()); } // verify that the exception is in the reson field assertSame(serviceFactory.destroyException, serviceMonitor.stopError.getCause()); // start condition methods assertFalse(startCondition.initializeCalled); assertFalse(startCondition.isSatisfiedCalled); assertTrue(startCondition.destroyCalled); // stop condition methods if (initialState == ServiceState.RUNNING) { assertTrue(stopCondition.initializeCalled); } else { assertFalse(stopCondition.initializeCalled); } assertTrue(stopCondition.isSatisfiedCalled); assertTrue(stopCondition.destroyCalled); } }
52533 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/52533/e4a9cb81c5b1bfeb724fd5cb9f7325ab7867ae4b/ServiceManagerTest.java/clean/kernel/src/test/org/gbean/kernel/standard/ServiceManagerTest.java
assertEquals(serviceName, e.getServiceName());
public void waitingStop(StopStrategy stopStrategy) throws Exception { start(false, StartStrategies.SYNCHRONOUS); stopCondition.satisfied = false; try { stop(stopStrategy); } catch (UnsatisfiedConditionsException e) { assertTrue(stopStrategy == StopStrategies.SYNCHRONOUS); assertTrue(e.getUnsatisfiedConditions().contains(stopCondition)); } try { stop(stopStrategy); } catch (UnsatisfiedConditionsException e) { assertTrue(stopStrategy == StopStrategies.SYNCHRONOUS); assertTrue(e.getUnsatisfiedConditions().contains(stopCondition)); } stopCondition.satisfied = true; stop(stopStrategy); }
52533 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/52533/e4a9cb81c5b1bfeb724fd5cb9f7325ab7867ae4b/ServiceManagerTest.java/clean/kernel/src/test/org/gbean/kernel/standard/ServiceManagerTest.java
.println(" [\"String\", \"Number\", \"Percentage\", \"Percentage\", \"LocalizedNumber\"]);");
.println(" [\"String\", \"Number\", \"Percentage\", \"Percentage\", \"FormattedNumber\"]);");
private void generateOverview(PackageData packageData) throws IOException { Iterator iter; String filename; if (packageData == null) { filename = "frame-summary.html"; } else { filename = "frame-summary-" + packageData.getName() + ".html"; } File file = new File(destinationDir, filename); PrintStream out = null; try { out = new PrintStream(new FileOutputStream(file)); out.println("<html>"); out.println("<head>"); out.println("<title>Coverage Report</title>"); out .println("<link title=\"Style\" type=\"text/css\" rel=\"stylesheet\" href=\"css/main.css\" />"); out .println("<link title=\"Style\" type=\"text/css\" rel=\"stylesheet\" href=\"css/sortabletable.css\" />"); out .println("<script type=\"text/javascript\" src=\"js/popup.js\"></script>"); out .println("<script type=\"text/javascript\" src=\"js/sortabletable.js\"></script>"); out .println("<script type=\"text/javascript\" src=\"js/customsorttypes.js\"></script>"); out.println("</head>"); out.println("<body>"); out.print("<h5>Coverage Report - "); out.print(packageData == null ? "All Packages" : generatePackageName(packageData)); out.println("</h5>"); out.println("<p>"); out.println("<table class=\"report\" id=\"packageResults\">"); out.println("<thead>"); out.println("<tr>"); out.println(" <td class=\"heading\">Package</td>"); out.println(" <td class=\"heading\"># Classes</td>"); out.println(generateCommonTableColumns()); out.println("</tr>"); out.println("</thead>"); out.println("<tbody>"); SortedSet packages; if (packageData == null) { // Output a summary line for all packages out.println(generateTableRowForTotal()); // Get packages packages = projectData.getPackages(); } else { // Get subpackages packages = projectData.getSubPackages(packageData.getName()); } // Output a line for each package or subpackage iter = packages.iterator(); while (iter.hasNext()) { PackageData subPackageData = (PackageData)iter.next(); out.println(generateTableRowForPackage(subPackageData)); } out.println("</tbody>"); out.println("</table>"); out.println("<script type=\"text/javascript\">"); out .println("var packageTable = new SortableTable(document.getElementById(\"packageResults\"),"); out .println(" [\"String\", \"Number\", \"Percentage\", \"Percentage\", \"LocalizedNumber\"]);"); out.println("packageTable.sort(0);"); out.println("</script>"); out.println("</p>"); // Get the list of source files in this package Collection sourceFiles; if (packageData == null) { PackageData defaultPackage = (PackageData)projectData .getChild(""); if (defaultPackage != null) { sourceFiles = defaultPackage.getSourceFiles(); } else { sourceFiles = new TreeSet(); } } else { sourceFiles = packageData.getSourceFiles(); } // Output a line for each class if (sourceFiles.size() > 0) { out.println("<p>"); out.println("<table class=\"report\" id=\"classResults\">"); out.println(generateTableHeaderForClasses()); out.println("<tbody>"); iter = sourceFiles.iterator(); while (iter.hasNext()) { SourceFileData sourceFileData = (SourceFileData)iter .next(); out .println(generateTableRowForSourceFile(sourceFileData)); } out.println("</tbody>"); out.println("</table>"); out.println("<script type=\"text/javascript\">"); out .println("var classTable = new SortableTable(document.getElementById(\"classResults\"),"); out .println(" [\"String\", \"Percentage\", \"Percentage\", \"LocalizedNumber\"]);"); out.println("classTable.sort(0);"); out.println("</script>"); out.println("</p>"); } out.println("<div class=\"footer\">"); out .println("Report generated by <a href=\"http://cobertura.sourceforge.net/\" target=\"_top\">Cobertura</a>."); out.println("</div>"); out.println("</body>"); out.println("</html>"); } finally { if (out != null) { out.close(); } } }
50197 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50197/44269750c437f83c33c41ee2416e5dc0fd270215/HTMLReport.java/clean/cobertura/src/net/sourceforge/cobertura/reporting/html/HTMLReport.java
.println(" [\"String\", \"Percentage\", \"Percentage\", \"LocalizedNumber\"]);");
.println(" [\"String\", \"Percentage\", \"Percentage\", \"FormattedNumber\"]);");
private void generateOverview(PackageData packageData) throws IOException { Iterator iter; String filename; if (packageData == null) { filename = "frame-summary.html"; } else { filename = "frame-summary-" + packageData.getName() + ".html"; } File file = new File(destinationDir, filename); PrintStream out = null; try { out = new PrintStream(new FileOutputStream(file)); out.println("<html>"); out.println("<head>"); out.println("<title>Coverage Report</title>"); out .println("<link title=\"Style\" type=\"text/css\" rel=\"stylesheet\" href=\"css/main.css\" />"); out .println("<link title=\"Style\" type=\"text/css\" rel=\"stylesheet\" href=\"css/sortabletable.css\" />"); out .println("<script type=\"text/javascript\" src=\"js/popup.js\"></script>"); out .println("<script type=\"text/javascript\" src=\"js/sortabletable.js\"></script>"); out .println("<script type=\"text/javascript\" src=\"js/customsorttypes.js\"></script>"); out.println("</head>"); out.println("<body>"); out.print("<h5>Coverage Report - "); out.print(packageData == null ? "All Packages" : generatePackageName(packageData)); out.println("</h5>"); out.println("<p>"); out.println("<table class=\"report\" id=\"packageResults\">"); out.println("<thead>"); out.println("<tr>"); out.println(" <td class=\"heading\">Package</td>"); out.println(" <td class=\"heading\"># Classes</td>"); out.println(generateCommonTableColumns()); out.println("</tr>"); out.println("</thead>"); out.println("<tbody>"); SortedSet packages; if (packageData == null) { // Output a summary line for all packages out.println(generateTableRowForTotal()); // Get packages packages = projectData.getPackages(); } else { // Get subpackages packages = projectData.getSubPackages(packageData.getName()); } // Output a line for each package or subpackage iter = packages.iterator(); while (iter.hasNext()) { PackageData subPackageData = (PackageData)iter.next(); out.println(generateTableRowForPackage(subPackageData)); } out.println("</tbody>"); out.println("</table>"); out.println("<script type=\"text/javascript\">"); out .println("var packageTable = new SortableTable(document.getElementById(\"packageResults\"),"); out .println(" [\"String\", \"Number\", \"Percentage\", \"Percentage\", \"LocalizedNumber\"]);"); out.println("packageTable.sort(0);"); out.println("</script>"); out.println("</p>"); // Get the list of source files in this package Collection sourceFiles; if (packageData == null) { PackageData defaultPackage = (PackageData)projectData .getChild(""); if (defaultPackage != null) { sourceFiles = defaultPackage.getSourceFiles(); } else { sourceFiles = new TreeSet(); } } else { sourceFiles = packageData.getSourceFiles(); } // Output a line for each class if (sourceFiles.size() > 0) { out.println("<p>"); out.println("<table class=\"report\" id=\"classResults\">"); out.println(generateTableHeaderForClasses()); out.println("<tbody>"); iter = sourceFiles.iterator(); while (iter.hasNext()) { SourceFileData sourceFileData = (SourceFileData)iter .next(); out .println(generateTableRowForSourceFile(sourceFileData)); } out.println("</tbody>"); out.println("</table>"); out.println("<script type=\"text/javascript\">"); out .println("var classTable = new SortableTable(document.getElementById(\"classResults\"),"); out .println(" [\"String\", \"Percentage\", \"Percentage\", \"LocalizedNumber\"]);"); out.println("classTable.sort(0);"); out.println("</script>"); out.println("</p>"); } out.println("<div class=\"footer\">"); out .println("Report generated by <a href=\"http://cobertura.sourceforge.net/\" target=\"_top\">Cobertura</a>."); out.println("</div>"); out.println("</body>"); out.println("</html>"); } finally { if (out != null) { out.close(); } } }
50197 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50197/44269750c437f83c33c41ee2416e5dc0fd270215/HTMLReport.java/clean/cobertura/src/net/sourceforge/cobertura/reporting/html/HTMLReport.java
+ "<td class=\"value\">" + getDoubleValue(ccn) + "</td>";
+ "<td class=\"value\"><span class=\"hidden\">" + ccn + ";</span>" + getDoubleValue(ccn) + "</td>";
private static String generateTableColumnsFromData(double lineCoverage, double branchCoverage, double ccn) { String lineCoverageCell = (lineCoverage == -1) ? generateNAPercent() : generatePercentResult(lineCoverage); String branchCoverageCell = (branchCoverage == -1) ? generateNAPercent() : generatePercentResult(branchCoverage); return "<td class=\"value\">" + lineCoverageCell + "</td>" + "<td class=\"value\">" + branchCoverageCell + "</td>" + "<td class=\"value\">" + getDoubleValue(ccn) + "</td>"; }
50197 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50197/44269750c437f83c33c41ee2416e5dc0fd270215/HTMLReport.java/clean/cobertura/src/net/sourceforge/cobertura/reporting/html/HTMLReport.java
module.defineModuleFunction("warn", callbackFactory.getSingletonMethod("warn", IRubyObject.class));
public static RubyModule createKernelModule(IRuby runtime) { RubyModule module = runtime.defineModule("Kernel"); CallbackFactory callbackFactory = runtime.callbackFactory(RubyKernel.class); CallbackFactory objectCallbackFactory = runtime.callbackFactory(RubyObject.class); module.defineModuleFunction("Array", callbackFactory.getSingletonMethod("new_array", IRubyObject.class)); module.defineModuleFunction("Float", callbackFactory.getSingletonMethod("new_float", IRubyObject.class)); module.defineModuleFunction("Integer", callbackFactory.getSingletonMethod("new_integer", IRubyObject.class)); module.defineModuleFunction("String", callbackFactory.getSingletonMethod("new_string", IRubyObject.class)); module.defineModuleFunction("`", callbackFactory.getSingletonMethod("backquote", IRubyObject.class)); // TODO: Implement Kernel#abort module.defineModuleFunction("at_exit", callbackFactory.getSingletonMethod("at_exit")); module.defineModuleFunction("autoload", callbackFactory.getSingletonMethod("autoload", IRubyObject.class, IRubyObject.class)); // TODO: Implement Kernel#autoload? module.defineModuleFunction("binding", callbackFactory.getSingletonMethod("binding")); module.defineModuleFunction("block_given?", callbackFactory.getSingletonMethod("block_given")); // TODO: Implement Kernel#callcc module.defineModuleFunction("caller", callbackFactory.getOptSingletonMethod("caller")); module.defineModuleFunction("catch", callbackFactory.getSingletonMethod("rbCatch", IRubyObject.class)); module.defineModuleFunction("chomp", callbackFactory.getOptSingletonMethod("chomp")); module.defineModuleFunction("chomp!", callbackFactory.getOptSingletonMethod("chomp_bang")); module.defineModuleFunction("chop", callbackFactory.getSingletonMethod("chop")); module.defineModuleFunction("chop!", callbackFactory.getSingletonMethod("chop_bang")); module.defineModuleFunction("eval", callbackFactory.getOptSingletonMethod("eval")); // TODO: Implement Kernel#exec module.defineModuleFunction("exit", callbackFactory.getOptSingletonMethod("exit")); module.defineModuleFunction("exit!", callbackFactory.getOptSingletonMethod("exit_bang")); module.defineModuleFunction("fail", callbackFactory.getOptSingletonMethod("raise")); // TODO: Implement Kernel#fork module.defineModuleFunction("format", callbackFactory.getOptSingletonMethod("sprintf")); module.defineModuleFunction("gets", callbackFactory.getOptSingletonMethod("gets")); module.defineModuleFunction("global_variables", callbackFactory.getSingletonMethod("global_variables")); module.defineModuleFunction("gsub", callbackFactory.getOptSingletonMethod("gsub")); module.defineModuleFunction("gsub!", callbackFactory.getOptSingletonMethod("gsub_bang")); // TODO: Add deprecation to Kernel#iterator? (maybe formal deprecation mech.) module.defineAlias("iterator?", "block_given?"); module.defineModuleFunction("lambda", callbackFactory.getSingletonMethod("proc")); module.defineModuleFunction("load", callbackFactory.getOptSingletonMethod("load")); module.defineModuleFunction("local_variables", callbackFactory.getSingletonMethod("local_variables")); module.defineModuleFunction("loop", callbackFactory.getSingletonMethod("loop")); // Note: method_missing is documented as being in Object, but ruby appears to stick it in Kernel. module.defineModuleFunction("method_missing", callbackFactory.getOptSingletonMethod("method_missing")); module.defineModuleFunction("open", callbackFactory.getOptSingletonMethod("open")); module.defineModuleFunction("p", callbackFactory.getOptSingletonMethod("p")); module.defineModuleFunction("print", callbackFactory.getOptSingletonMethod("print")); module.defineModuleFunction("printf", callbackFactory.getOptSingletonMethod("printf")); module.defineModuleFunction("proc", callbackFactory.getSingletonMethod("proc")); // TODO: implement Kernel#putc module.defineModuleFunction("puts", callbackFactory.getOptSingletonMethod("puts")); module.defineAlias("raise", "fail"); module.defineModuleFunction("rand", callbackFactory.getOptSingletonMethod("rand")); module.defineModuleFunction("readline", callbackFactory.getOptSingletonMethod("readline")); module.defineModuleFunction("readlines", callbackFactory.getOptSingletonMethod("readlines")); module.defineModuleFunction("require", callbackFactory.getSingletonMethod("require", IRubyObject.class)); module.defineModuleFunction("scan", callbackFactory.getSingletonMethod("scan", IRubyObject.class)); // TODO: Implement Kernel#select module.defineModuleFunction("set_trace_func", callbackFactory.getSingletonMethod("set_trace_func", IRubyObject.class)); module.defineModuleFunction("sleep", callbackFactory.getSingletonMethod("sleep", IRubyObject.class)); module.defineModuleFunction("split", callbackFactory.getOptSingletonMethod("split")); module.defineAlias("sprintf", "format"); module.defineModuleFunction("srand", callbackFactory.getOptSingletonMethod("srand")); module.defineModuleFunction("sub", callbackFactory.getOptSingletonMethod("sub")); module.defineModuleFunction("sub!", callbackFactory.getOptSingletonMethod("sub_bang")); // Skipping: Kernel#syscall (too system dependent) module.defineModuleFunction("system", callbackFactory.getOptSingletonMethod("system")); // TODO: Implement Kernel#test (partial impl) module.defineModuleFunction("throw", callbackFactory.getOptSingletonMethod("rbThrow")); // TODO: Implement Kernel#trace_var module.defineModuleFunction("trap", callbackFactory.getOptSingletonMethod("trap")); // TODO: Implement Kernel#untrace_var // TODO: Implement Kernel#warn // Defined p411 Pickaxe 2nd ed. module.defineModuleFunction("singleton_method_added", callbackFactory.getSingletonMethod("singleton_method_added", IRubyObject.class)); // Object methods module.definePublicModuleFunction("==", objectCallbackFactory.getMethod("equal", IRubyObject.class)); module.defineAlias("===", "=="); module.defineAlias("eql?", "=="); module.definePublicModuleFunction("to_s", objectCallbackFactory.getMethod("to_s")); module.definePublicModuleFunction("nil?", objectCallbackFactory.getMethod("nil_p")); module.definePublicModuleFunction("to_a", objectCallbackFactory.getMethod("to_a")); module.definePublicModuleFunction("hash", objectCallbackFactory.getMethod("hash")); module.definePublicModuleFunction("id", objectCallbackFactory.getMethod("id")); module.defineAlias("__id__", "id"); module.defineAlias("object_id", "id"); module.definePublicModuleFunction("is_a?", objectCallbackFactory.getMethod("kind_of", IRubyObject.class)); module.defineAlias("kind_of?", "is_a?"); module.definePublicModuleFunction("dup", objectCallbackFactory.getMethod("dup")); module.definePublicModuleFunction("equal?", objectCallbackFactory.getMethod("same", IRubyObject.class)); module.definePublicModuleFunction("type", objectCallbackFactory.getMethod("type_deprecated")); module.definePublicModuleFunction("class", objectCallbackFactory.getMethod("type")); module.definePublicModuleFunction("inspect", objectCallbackFactory.getMethod("inspect")); module.definePublicModuleFunction("=~", objectCallbackFactory.getMethod("match", IRubyObject.class)); module.definePublicModuleFunction("clone", objectCallbackFactory.getMethod("rbClone")); module.definePublicModuleFunction("display", objectCallbackFactory.getOptMethod("display")); module.definePublicModuleFunction("extend", objectCallbackFactory.getOptMethod("extend")); module.definePublicModuleFunction("freeze", objectCallbackFactory.getMethod("freeze")); module.definePublicModuleFunction("frozen?", objectCallbackFactory.getMethod("frozen")); module.defineModuleFunction("initialize_copy", objectCallbackFactory.getMethod("initialize_copy", IRubyObject.class)); module.definePublicModuleFunction("instance_eval", objectCallbackFactory.getOptMethod("instance_eval")); module.definePublicModuleFunction("instance_of?", objectCallbackFactory.getMethod("instance_of", IRubyObject.class)); module.definePublicModuleFunction("instance_variables", objectCallbackFactory.getMethod("instance_variables")); module.definePublicModuleFunction("instance_variable_get", objectCallbackFactory.getMethod("instance_variable_get", IRubyObject.class)); module.definePublicModuleFunction("instance_variable_set", objectCallbackFactory.getMethod("instance_variable_set", IRubyObject.class, IRubyObject.class)); module.definePublicModuleFunction("method", objectCallbackFactory.getMethod("method", IRubyObject.class)); module.definePublicModuleFunction("methods", objectCallbackFactory.getOptMethod("methods")); module.definePublicModuleFunction("private_methods", objectCallbackFactory.getMethod("private_methods")); module.definePublicModuleFunction("protected_methods", objectCallbackFactory.getMethod("protected_methods")); module.definePublicModuleFunction("public_methods", objectCallbackFactory.getOptMethod("public_methods")); module.definePublicModuleFunction("remove_instance_variable", objectCallbackFactory.getMethod("remove_instance_variable", IRubyObject.class)); module.definePublicModuleFunction("respond_to?", objectCallbackFactory.getOptMethod("respond_to")); module.definePublicModuleFunction("send", objectCallbackFactory.getOptMethod("send")); module.defineAlias("__send__", "send"); module.definePublicModuleFunction("singleton_methods", objectCallbackFactory.getMethod("singleton_methods")); module.definePublicModuleFunction("taint", objectCallbackFactory.getMethod("taint")); module.definePublicModuleFunction("tainted?", objectCallbackFactory.getMethod("tainted")); module.definePublicModuleFunction("untaint", objectCallbackFactory.getMethod("untaint")); return module; }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/62395b140d1fb0b5b75ba224eb0f4b564f70979b/RubyKernel.java/clean/src/org/jruby/RubyKernel.java
g2d.setClip(vButtonShape);
if(!Spark.isMac()){ g2d.setClip(vButtonShape); }
public void paint(Graphics g, JComponent c) { Graphics2D g2d = (Graphics2D)g; g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); Insets vInsets = c.getInsets(); int w = c.getWidth() - (vInsets.left + vInsets.right); int h = c.getHeight() - (vInsets.top + vInsets.bottom); int x = vInsets.left; int y = vInsets.top; int arc = 8; Shape vButtonShape = new RoundRectangle2D.Double((double)x, (double)y, (double)w, (double)h, (double)arc, (double)arc); Shape vOldClip = g.getClip(); g2d.setClip(vButtonShape); g2d.setColor(backgroundColor2); g2d.fillRect(x, y, w, h); g2d.setClip(vOldClip); GradientPaint vPaint = new GradientPaint(x, y, borderColor, x, y + h, borderHighlight); g2d.setPaint(vPaint); // Handle custom actions. if (placement == JTabbedPane.TOP) { if (selected) { g2d.setColor(Color.lightGray); g2d.drawRoundRect(x, y, w, h, arc, arc); } g2d.clipRect(x, y, w + 1, h - arc / 4); g2d.setColor(borderColorAlpha1); g2d.setClip(vOldClip); g2d.setColor(borderColorAlpha2); g2d.setColor(backgroundColor2); g2d.fillRect(x, h - 5, w, h); } else { // Make straight line. g2d.setColor(backgroundColor2); g2d.fillRect(x, y, w, 4); } if (selected) { } else if (!hideBorder) { // Draw border on right side. g2d.setColor(Color.lightGray); g2d.drawLine(w - 1, 4, w - 1, h - 4); } }
52006 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/52006/1230b9151d62dc1da764a5a6dc7c80caf97a0718/TabPanelUI.java/buggy/src/java/org/jivesoftware/spark/component/tabbedPane/TabPanelUI.java
p.add(addButton); p.add(Box.createRigidArea(DataManagerUIF.HBOX));
private JPanel buildButtonPanel() { JPanel p = new JPanel(); p.setLayout(new BoxLayout(p, BoxLayout.X_AXIS)); p.add(viewButton); p.add(Box.createRigidArea(DataManagerUIF.HBOX)); p.add(saveButton); p.add(Box.createRigidArea(DataManagerUIF.HBOX)); p.add(addButton); p.add(Box.createRigidArea(DataManagerUIF.HBOX)); p.setOpaque(false); //make panel transparent return p; }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/1ed79437fda6d8f6b2566c6fe677bfaaf3352055/ProjectEditorBar.java/clean/SRC/org/openmicroscopy/shoola/agents/datamng/editors/project/ProjectEditorBar.java
add(UIUtilities.buildComponentPanel(addButton));
private void buildGUI() { add(UIUtilities.buildComponentPanelRight(buildButtonPanel())); }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/1ed79437fda6d8f6b2566c6fe677bfaaf3352055/ProjectEditorBar.java/clean/SRC/org/openmicroscopy/shoola/agents/datamng/editors/project/ProjectEditorBar.java
addButton = new JButton("Add datasets");
addButton = new JButton("Add datasets...");
private void initButtons() { saveButton = new JButton("Save"); saveButton.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); saveButton.setToolTipText( UIUtilities.formatToolTipText("Save data in the DB.")); saveButton.setEnabled(false); addButton = new JButton("Add datasets"); addButton.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); addButton.setToolTipText( UIUtilities.formatToolTipText("Add datasets to the project.")); viewButton = new JButton("Browse"); viewButton.setToolTipText(UIUtilities.formatToolTipText("Browse" + " the project.")); }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/1ed79437fda6d8f6b2566c6fe677bfaaf3352055/ProjectEditorBar.java/clean/SRC/org/openmicroscopy/shoola/agents/datamng/editors/project/ProjectEditorBar.java
public void fileTransferRequest(FileTransferRequest request) { if (fireTransferListeners(request)) { return; } String requestor = request.getRequestor(); String bareJID = StringUtils.parseBareAddress(requestor); ContactItem contactItem = contactList.getContactItemByJID(bareJID); ChatRoom chatRoom; if (contactItem != null) { chatRoom = SparkManager.getChatManager().createChatRoom(bareJID, contactItem.getNickname(), contactItem.getNickname()); } else { chatRoom = SparkManager.getChatManager().createChatRoom(bareJID, bareJID, bareJID); } TranscriptWindow transcriptWindow = chatRoom.getTranscriptWindow(); StyledDocument doc = (StyledDocument)transcriptWindow.getDocument(); Style style = doc.addStyle("StyleName", null); final ReceiveMessage receivingMessageUI = new ReceiveMessage(); receivingMessageUI.acceptFileTransfer(request); chatRoom.addClosingListener(new ChatRoomClosingListener() { public void closing() { receivingMessageUI.cancelTransfer();
public void fileTransferRequest(final FileTransferRequest request) { SwingUtilities.invokeLater(new Runnable() { public void run() { handleTransferRequest(request, contactList);
private SparkTransferManager() { boolean enabled = Enterprise.containsFeature(Enterprise.FILE_TRANSFER_FEATURE); if (!enabled) { return; } // Register Preferences PreferenceManager prefManager = SparkManager.getPreferenceManager(); prefManager.addPreference(new FileTransferPreference()); final JMenu actionsMenu = SparkManager.getMainWindow().getMenuByName("Actions"); JMenuItem downloadsMenu = new JMenuItem("", SparkRes.getImageIcon(SparkRes.DOWNLOAD_16x16)); ResourceUtils.resButton(downloadsMenu, "&View Downloads"); actionsMenu.add(downloadsMenu); downloadsMenu.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { Downloads downloads = Downloads.getInstance(); downloads.showDownloadsDirectory(); } }); // Create the file transfer manager transferManager = new FileTransferManager(SparkManager.getConnection()); final ContactList contactList = SparkManager.getWorkspace().getContactList(); // Create the listener transferManager.addFileTransferListener(new org.jivesoftware.smackx.filetransfer.FileTransferListener() { public void fileTransferRequest(FileTransferRequest request) { // Check if a listener handled this request if (fireTransferListeners(request)) { return; } String requestor = request.getRequestor(); String bareJID = StringUtils.parseBareAddress(requestor); ContactItem contactItem = contactList.getContactItemByJID(bareJID); ChatRoom chatRoom; if (contactItem != null) { chatRoom = SparkManager.getChatManager().createChatRoom(bareJID, contactItem.getNickname(), contactItem.getNickname()); } else { chatRoom = SparkManager.getChatManager().createChatRoom(bareJID, bareJID, bareJID); } TranscriptWindow transcriptWindow = chatRoom.getTranscriptWindow(); StyledDocument doc = (StyledDocument)transcriptWindow.getDocument(); // The image must first be wrapped in a style Style style = doc.addStyle("StyleName", null); final ReceiveMessage receivingMessageUI = new ReceiveMessage(); receivingMessageUI.acceptFileTransfer(request); chatRoom.addClosingListener(new ChatRoomClosingListener() { public void closing() { receivingMessageUI.cancelTransfer(); } }); StyleConstants.setComponent(style, receivingMessageUI); // Insert the image at the end of the text try { doc.insertString(doc.getLength(), "ignored text", style); doc.insertString(doc.getLength(), "\n", null); } catch (BadLocationException e) { Log.error(e); } chatRoom.scrollToBottom(); SparkManager.getChatManager().getChatContainer().fireNotifyOnMessage(chatRoom); } }); // Add Send File to Chat Room addSendFileButton(); contactList.addFileDropListener(new FileDropListener() { public void filesDropped(Collection files, Component component) { if (component instanceof ContactItem) { ContactItem item = (ContactItem)component; ChatRoom chatRoom = null; Iterator iter = files.iterator(); while (iter.hasNext()) { chatRoom = sendFile((File)iter.next(), item.getFullJID()); } if (chatRoom != null) { SparkManager.getChatManager().getChatContainer().activateChatRoom(chatRoom); } } } }); if (defaultDirectory == null) { defaultDirectory = new File(System.getProperty("user.home")); } addPresenceListener(); // Add View Downloads to Command Panel StatusBar statusBar = SparkManager.getWorkspace().getStatusBar(); JPanel commandPanel = statusBar.getCommandPanel(); RolloverButton viewDownloads = new RolloverButton(SparkRes.getImageIcon(SparkRes.DOWNLOAD_16x16)); viewDownloads.setToolTipText("View Downloads"); commandPanel.add(viewDownloads); viewDownloads.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { Downloads downloads = Downloads.getInstance(); downloads.showDownloadsDirectory(); } }); }
52006 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/52006/90f230809a192f7030b7fb4ee9b40a0993429b8c/SparkTransferManager.java/buggy/src/java/org/jivesoftware/spark/filetransfer/SparkTransferManager.java
StyleConstants.setComponent(style, receivingMessageUI); try { doc.insertString(doc.getLength(), "ignored text", style); doc.insertString(doc.getLength(), "\n", null); } catch (BadLocationException e) { Log.error(e); } chatRoom.scrollToBottom(); SparkManager.getChatManager().getChatContainer().fireNotifyOnMessage(chatRoom);
private SparkTransferManager() { boolean enabled = Enterprise.containsFeature(Enterprise.FILE_TRANSFER_FEATURE); if (!enabled) { return; } // Register Preferences PreferenceManager prefManager = SparkManager.getPreferenceManager(); prefManager.addPreference(new FileTransferPreference()); final JMenu actionsMenu = SparkManager.getMainWindow().getMenuByName("Actions"); JMenuItem downloadsMenu = new JMenuItem("", SparkRes.getImageIcon(SparkRes.DOWNLOAD_16x16)); ResourceUtils.resButton(downloadsMenu, "&View Downloads"); actionsMenu.add(downloadsMenu); downloadsMenu.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { Downloads downloads = Downloads.getInstance(); downloads.showDownloadsDirectory(); } }); // Create the file transfer manager transferManager = new FileTransferManager(SparkManager.getConnection()); final ContactList contactList = SparkManager.getWorkspace().getContactList(); // Create the listener transferManager.addFileTransferListener(new org.jivesoftware.smackx.filetransfer.FileTransferListener() { public void fileTransferRequest(FileTransferRequest request) { // Check if a listener handled this request if (fireTransferListeners(request)) { return; } String requestor = request.getRequestor(); String bareJID = StringUtils.parseBareAddress(requestor); ContactItem contactItem = contactList.getContactItemByJID(bareJID); ChatRoom chatRoom; if (contactItem != null) { chatRoom = SparkManager.getChatManager().createChatRoom(bareJID, contactItem.getNickname(), contactItem.getNickname()); } else { chatRoom = SparkManager.getChatManager().createChatRoom(bareJID, bareJID, bareJID); } TranscriptWindow transcriptWindow = chatRoom.getTranscriptWindow(); StyledDocument doc = (StyledDocument)transcriptWindow.getDocument(); // The image must first be wrapped in a style Style style = doc.addStyle("StyleName", null); final ReceiveMessage receivingMessageUI = new ReceiveMessage(); receivingMessageUI.acceptFileTransfer(request); chatRoom.addClosingListener(new ChatRoomClosingListener() { public void closing() { receivingMessageUI.cancelTransfer(); } }); StyleConstants.setComponent(style, receivingMessageUI); // Insert the image at the end of the text try { doc.insertString(doc.getLength(), "ignored text", style); doc.insertString(doc.getLength(), "\n", null); } catch (BadLocationException e) { Log.error(e); } chatRoom.scrollToBottom(); SparkManager.getChatManager().getChatContainer().fireNotifyOnMessage(chatRoom); } }); // Add Send File to Chat Room addSendFileButton(); contactList.addFileDropListener(new FileDropListener() { public void filesDropped(Collection files, Component component) { if (component instanceof ContactItem) { ContactItem item = (ContactItem)component; ChatRoom chatRoom = null; Iterator iter = files.iterator(); while (iter.hasNext()) { chatRoom = sendFile((File)iter.next(), item.getFullJID()); } if (chatRoom != null) { SparkManager.getChatManager().getChatContainer().activateChatRoom(chatRoom); } } } }); if (defaultDirectory == null) { defaultDirectory = new File(System.getProperty("user.home")); } addPresenceListener(); // Add View Downloads to Command Panel StatusBar statusBar = SparkManager.getWorkspace().getStatusBar(); JPanel commandPanel = statusBar.getCommandPanel(); RolloverButton viewDownloads = new RolloverButton(SparkRes.getImageIcon(SparkRes.DOWNLOAD_16x16)); viewDownloads.setToolTipText("View Downloads"); commandPanel.add(viewDownloads); viewDownloads.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { Downloads downloads = Downloads.getInstance(); downloads.showDownloadsDirectory(); } }); }
52006 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/52006/90f230809a192f7030b7fb4ee9b40a0993429b8c/SparkTransferManager.java/buggy/src/java/org/jivesoftware/spark/filetransfer/SparkTransferManager.java
public void fileTransferRequest(FileTransferRequest request) { if (fireTransferListeners(request)) { return; } String requestor = request.getRequestor(); String bareJID = StringUtils.parseBareAddress(requestor); ContactItem contactItem = contactList.getContactItemByJID(bareJID); ChatRoom chatRoom; if (contactItem != null) { chatRoom = SparkManager.getChatManager().createChatRoom(bareJID, contactItem.getNickname(), contactItem.getNickname()); } else { chatRoom = SparkManager.getChatManager().createChatRoom(bareJID, bareJID, bareJID); } TranscriptWindow transcriptWindow = chatRoom.getTranscriptWindow(); StyledDocument doc = (StyledDocument)transcriptWindow.getDocument(); Style style = doc.addStyle("StyleName", null); final ReceiveMessage receivingMessageUI = new ReceiveMessage(); receivingMessageUI.acceptFileTransfer(request); chatRoom.addClosingListener(new ChatRoomClosingListener() { public void closing() { receivingMessageUI.cancelTransfer();
public void fileTransferRequest(final FileTransferRequest request) { SwingUtilities.invokeLater(new Runnable() { public void run() { handleTransferRequest(request, contactList);
public void fileTransferRequest(FileTransferRequest request) { // Check if a listener handled this request if (fireTransferListeners(request)) { return; } String requestor = request.getRequestor(); String bareJID = StringUtils.parseBareAddress(requestor); ContactItem contactItem = contactList.getContactItemByJID(bareJID); ChatRoom chatRoom; if (contactItem != null) { chatRoom = SparkManager.getChatManager().createChatRoom(bareJID, contactItem.getNickname(), contactItem.getNickname()); } else { chatRoom = SparkManager.getChatManager().createChatRoom(bareJID, bareJID, bareJID); } TranscriptWindow transcriptWindow = chatRoom.getTranscriptWindow(); StyledDocument doc = (StyledDocument)transcriptWindow.getDocument(); // The image must first be wrapped in a style Style style = doc.addStyle("StyleName", null); final ReceiveMessage receivingMessageUI = new ReceiveMessage(); receivingMessageUI.acceptFileTransfer(request); chatRoom.addClosingListener(new ChatRoomClosingListener() { public void closing() { receivingMessageUI.cancelTransfer(); } }); StyleConstants.setComponent(style, receivingMessageUI); // Insert the image at the end of the text try { doc.insertString(doc.getLength(), "ignored text", style); doc.insertString(doc.getLength(), "\n", null); } catch (BadLocationException e) { Log.error(e); } chatRoom.scrollToBottom(); SparkManager.getChatManager().getChatContainer().fireNotifyOnMessage(chatRoom); }
52006 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/52006/90f230809a192f7030b7fb4ee9b40a0993429b8c/SparkTransferManager.java/buggy/src/java/org/jivesoftware/spark/filetransfer/SparkTransferManager.java
StyleConstants.setComponent(style, receivingMessageUI); try { doc.insertString(doc.getLength(), "ignored text", style); doc.insertString(doc.getLength(), "\n", null); } catch (BadLocationException e) { Log.error(e); } chatRoom.scrollToBottom(); SparkManager.getChatManager().getChatContainer().fireNotifyOnMessage(chatRoom);
public void fileTransferRequest(FileTransferRequest request) { // Check if a listener handled this request if (fireTransferListeners(request)) { return; } String requestor = request.getRequestor(); String bareJID = StringUtils.parseBareAddress(requestor); ContactItem contactItem = contactList.getContactItemByJID(bareJID); ChatRoom chatRoom; if (contactItem != null) { chatRoom = SparkManager.getChatManager().createChatRoom(bareJID, contactItem.getNickname(), contactItem.getNickname()); } else { chatRoom = SparkManager.getChatManager().createChatRoom(bareJID, bareJID, bareJID); } TranscriptWindow transcriptWindow = chatRoom.getTranscriptWindow(); StyledDocument doc = (StyledDocument)transcriptWindow.getDocument(); // The image must first be wrapped in a style Style style = doc.addStyle("StyleName", null); final ReceiveMessage receivingMessageUI = new ReceiveMessage(); receivingMessageUI.acceptFileTransfer(request); chatRoom.addClosingListener(new ChatRoomClosingListener() { public void closing() { receivingMessageUI.cancelTransfer(); } }); StyleConstants.setComponent(style, receivingMessageUI); // Insert the image at the end of the text try { doc.insertString(doc.getLength(), "ignored text", style); doc.insertString(doc.getLength(), "\n", null); } catch (BadLocationException e) { Log.error(e); } chatRoom.scrollToBottom(); SparkManager.getChatManager().getChatContainer().fireNotifyOnMessage(chatRoom); }
52006 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/52006/90f230809a192f7030b7fb4ee9b40a0993429b8c/SparkTransferManager.java/buggy/src/java/org/jivesoftware/spark/filetransfer/SparkTransferManager.java
public void actionPerformed(ActionEvent e) { SwingWorker worker = new SwingWorker() { public Object construct() { try { Thread.sleep(10); } catch (InterruptedException e1) { Log.error(e1); } return "delay"; } public void finished() { ChatRoomImpl roomImpl = (ChatRoomImpl)room; getFileChooser().setDialogTitle("Select File(s) to send"); getFileChooser().setMultiSelectionEnabled(true); int ok = getFileChooser().showOpenDialog(roomImpl); if (ok != JFileChooser.APPROVE_OPTION) { return; } File[] file = getFileChooser().getSelectedFiles(); if (file == null || file.length == 0) { return; } final int no = file.length; for (int i = 0; i < no; i++) { File sendFile = file[i]; if (sendFile.exists()) { defaultDirectory = sendFile.getParentFile(); sendFile(sendFile, roomImpl.getParticipantJID()); } } } }; worker.start();
public void actionPerformed(ActionEvent actionEvent) { sendScreenshot(sendScreenShotButton, room);
public void actionPerformed(ActionEvent e) { SwingWorker worker = new SwingWorker() { public Object construct() { try { Thread.sleep(10); } catch (InterruptedException e1) { Log.error(e1); } return "delay"; } public void finished() { ChatRoomImpl roomImpl = (ChatRoomImpl)room; getFileChooser().setDialogTitle("Select File(s) to send"); getFileChooser().setMultiSelectionEnabled(true); int ok = getFileChooser().showOpenDialog(roomImpl); if (ok != JFileChooser.APPROVE_OPTION) { return; } File[] file = getFileChooser().getSelectedFiles(); if (file == null || file.length == 0) { return; } final int no = file.length; for (int i = 0; i < no; i++) { File sendFile = file[i]; if (sendFile.exists()) { defaultDirectory = sendFile.getParentFile(); sendFile(sendFile, roomImpl.getParticipantJID()); } } } }; worker.start(); }
52006 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/52006/90f230809a192f7030b7fb4ee9b40a0993429b8c/SparkTransferManager.java/buggy/src/java/org/jivesoftware/spark/filetransfer/SparkTransferManager.java
if (presence == null || presence.getType() == Presence.Type.unavailable) { if (transfer != null) { transfer.cancel();
if (presence != null) { String bareJID = StringUtils.parseBareAddress(presence.getFrom()); List list = (List)waitMap.get(bareJID); if (list != null) { Iterator iter = list.iterator(); ChatRoom room = null; while (iter.hasNext()) { File file = (File)iter.next(); room = sendFile(file, bareJID); } if (room != null) { Message message = new Message(); message.setBody("You have just been sent offline file(s)."); room.sendMessage(message); }
public void processPacket(Packet packet) { Presence presence = (Presence)packet; if (presence == null || presence.getType() == Presence.Type.unavailable) { if (transfer != null) { transfer.cancel(); } } }
52006 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/52006/90f230809a192f7030b7fb4ee9b40a0993429b8c/SparkTransferManager.java/buggy/src/java/org/jivesoftware/spark/filetransfer/SparkTransferManager.java
waitMap.remove(bareJID);
public void processPacket(Packet packet) { Presence presence = (Presence)packet; if (presence == null || presence.getType() == Presence.Type.unavailable) { if (transfer != null) { transfer.cancel(); } } }
52006 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/52006/90f230809a192f7030b7fb4ee9b40a0993429b8c/SparkTransferManager.java/buggy/src/java/org/jivesoftware/spark/filetransfer/SparkTransferManager.java
try { Robot robot = new Robot(); Rectangle area = new Rectangle(Toolkit.getDefaultToolkit().getScreenSize()); return robot.createScreenCapture(area); } catch (AWTException e) { Log.error(e); } return null; }
try { Thread.sleep(10); } catch (InterruptedException e1) { Log.error(e1); } return "delay"; }
public Object construct() { try { Robot robot = new Robot(); Rectangle area = new Rectangle(Toolkit.getDefaultToolkit().getScreenSize()); return robot.createScreenCapture(area); } catch (AWTException e) { Log.error(e); } return null; }
52006 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/52006/90f230809a192f7030b7fb4ee9b40a0993429b8c/SparkTransferManager.java/buggy/src/java/org/jivesoftware/spark/filetransfer/SparkTransferManager.java
BufferedImage bufferedImage = (BufferedImage)get(); if (bufferedImage != null) { sendImage(bufferedImage, room); }
ChatRoomImpl roomImpl = (ChatRoomImpl)room;
public void finished() { BufferedImage bufferedImage = (BufferedImage)get(); if (bufferedImage != null) { sendImage(bufferedImage, room); } button.setEnabled(true); room.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); }
52006 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/52006/90f230809a192f7030b7fb4ee9b40a0993429b8c/SparkTransferManager.java/buggy/src/java/org/jivesoftware/spark/filetransfer/SparkTransferManager.java
button.setEnabled(true); room.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); }
getFileChooser().setDialogTitle("Select File(s) to send"); getFileChooser().setMultiSelectionEnabled(true); int ok = getFileChooser().showOpenDialog(roomImpl); if (ok != JFileChooser.APPROVE_OPTION) { return; } File[] file = getFileChooser().getSelectedFiles(); if (file == null || file.length == 0) { return; } final int no = file.length; for (int i = 0; i < no; i++) { File sendFile = file[i]; if (sendFile.exists()) { defaultDirectory = sendFile.getParentFile(); sendFile(sendFile, roomImpl.getParticipantJID()); } } }
public void finished() { BufferedImage bufferedImage = (BufferedImage)get(); if (bufferedImage != null) { sendImage(bufferedImage, room); } button.setEnabled(true); room.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); }
52006 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/52006/90f230809a192f7030b7fb4ee9b40a0993429b8c/SparkTransferManager.java/buggy/src/java/org/jivesoftware/spark/filetransfer/SparkTransferManager.java
String path = ome.io.nio.Helper.getFilesPath(new Long(1000000001));
String path = new PixelsService("/OME/OMEIS/").getFilesPath(new Long(1000000001));
public void testFilesFourDirectoryLowerBoundsPath() { String path = ome.io.nio.Helper.getFilesPath(new Long(1000000001)); assertEquals("/OME/OMEIS/Files/Dir-001/Dir-000/Dir-000/1000000001", path); }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/ae0b01fad17fcacba3ec0999ca1ad645f389b5f9/HelperUnitTest.java/clean/components/omeio-nio/test/ome/io/nio/utests/HelperUnitTest.java
String path = ome.io.nio.Helper.getFilesPath((long)Integer.MAX_VALUE);
String path = new PixelsService("/OME/OMEIS/").getFilesPath((long)Integer.MAX_VALUE);
public void testFilesFourDirectoryUpperBoundsPath() { String path = ome.io.nio.Helper.getFilesPath((long)Integer.MAX_VALUE); assertEquals("/OME/OMEIS/Files/Dir-002/Dir-147/Dir-483/2147483647", path); }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/ae0b01fad17fcacba3ec0999ca1ad645f389b5f9/HelperUnitTest.java/clean/components/omeio-nio/test/ome/io/nio/utests/HelperUnitTest.java
String path = ome.io.nio.Helper.getFilesPath(new Long(1));
String path = new PixelsService("/OME/OMEIS/").getFilesPath(new Long(1));
public void testFilesSingleDirectoryLowerBoundsPath() { String path = ome.io.nio.Helper.getFilesPath(new Long(1)); assertEquals("/OME/OMEIS/Files/1", path); }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/ae0b01fad17fcacba3ec0999ca1ad645f389b5f9/HelperUnitTest.java/clean/components/omeio-nio/test/ome/io/nio/utests/HelperUnitTest.java
String path = ome.io.nio.Helper.getFilesPath(new Long(999));
String path = new PixelsService("/OME/OMEIS/").getFilesPath(new Long(999));
public void testFilesSingleDirectoryUpperBoundsPath() { String path = ome.io.nio.Helper.getFilesPath(new Long(999)); assertEquals("/OME/OMEIS/Files/999", path); }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/ae0b01fad17fcacba3ec0999ca1ad645f389b5f9/HelperUnitTest.java/clean/components/omeio-nio/test/ome/io/nio/utests/HelperUnitTest.java
String path = ome.io.nio.Helper.getFilesPath(new Long(1000001));
String path = new PixelsService("/OME/OMEIS/").getFilesPath(new Long(1000001));
public void testFilesThreeDirectoryLowerBoundsPath() { String path = ome.io.nio.Helper.getFilesPath(new Long(1000001)); assertEquals("/OME/OMEIS/Files/Dir-001/Dir-000/1000001", path); }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/ae0b01fad17fcacba3ec0999ca1ad645f389b5f9/HelperUnitTest.java/clean/components/omeio-nio/test/ome/io/nio/utests/HelperUnitTest.java
String path = ome.io.nio.Helper.getFilesPath(new Long(999999999));
String path = new PixelsService("/OME/OMEIS/").getFilesPath(new Long(999999999));
public void testFilesThreeDirectoryUpperBoundsPath() { String path = ome.io.nio.Helper.getFilesPath(new Long(999999999)); assertEquals("/OME/OMEIS/Files/Dir-999/Dir-999/999999999", path); }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/ae0b01fad17fcacba3ec0999ca1ad645f389b5f9/HelperUnitTest.java/clean/components/omeio-nio/test/ome/io/nio/utests/HelperUnitTest.java
String path = ome.io.nio.Helper.getFilesPath(new Long(1001));
String path = new PixelsService("/OME/OMEIS/").getFilesPath(new Long(1001));
public void testFilesTwoDirectoryLowerBoundsPath() { String path = ome.io.nio.Helper.getFilesPath(new Long(1001)); assertEquals("/OME/OMEIS/Files/Dir-001/1001", path); }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/ae0b01fad17fcacba3ec0999ca1ad645f389b5f9/HelperUnitTest.java/clean/components/omeio-nio/test/ome/io/nio/utests/HelperUnitTest.java
String path = ome.io.nio.Helper.getFilesPath(new Long(999999));
String path = new PixelsService("/OME/OMEIS/").getFilesPath(new Long(999999));
public void testFilesTwoDirectoryUpperBoundsPath() { String path = ome.io.nio.Helper.getFilesPath(new Long(999999)); assertEquals("/OME/OMEIS/Files/Dir-999/999999", path); }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/ae0b01fad17fcacba3ec0999ca1ad645f389b5f9/HelperUnitTest.java/clean/components/omeio-nio/test/ome/io/nio/utests/HelperUnitTest.java
String path = ome.io.nio.Helper.getPixelsPath(new Long(1000000001));
String path = new PixelsService("/OME/OMEIS/").getPixelsPath(new Long(1000000001));
public void testPixelsFourDirectoryLowerBoundsPath() { String path = ome.io.nio.Helper.getPixelsPath(new Long(1000000001)); assertEquals("/OME/OMEIS/Pixels/Dir-001/Dir-000/Dir-000/1000000001", path); }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/ae0b01fad17fcacba3ec0999ca1ad645f389b5f9/HelperUnitTest.java/clean/components/omeio-nio/test/ome/io/nio/utests/HelperUnitTest.java
String path = ome.io.nio.Helper.getPixelsPath((long)Integer.MAX_VALUE);
String path = new PixelsService("/OME/OMEIS/").getPixelsPath((long)Integer.MAX_VALUE);
public void testPixelsFourDirectoryUpperBoundsPath() { String path = ome.io.nio.Helper.getPixelsPath((long)Integer.MAX_VALUE); assertEquals("/OME/OMEIS/Pixels/Dir-002/Dir-147/Dir-483/2147483647", path); }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/ae0b01fad17fcacba3ec0999ca1ad645f389b5f9/HelperUnitTest.java/clean/components/omeio-nio/test/ome/io/nio/utests/HelperUnitTest.java
String path = ome.io.nio.Helper.getPixelsPath(new Long(1));
String path = new PixelsService("/OME/OMEIS/").getPixelsPath(new Long(1));
public void testPixelsSingleDirectoryLowerBoundsPath() { String path = ome.io.nio.Helper.getPixelsPath(new Long(1)); assertEquals("/OME/OMEIS/Pixels/1", path); }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/ae0b01fad17fcacba3ec0999ca1ad645f389b5f9/HelperUnitTest.java/clean/components/omeio-nio/test/ome/io/nio/utests/HelperUnitTest.java
String path = ome.io.nio.Helper.getPixelsPath(new Long(999));
String path = new PixelsService("/OME/OMEIS/").getPixelsPath(new Long(999));
public void testPixelsSingleDirectoryUpperBoundsPath() { String path = ome.io.nio.Helper.getPixelsPath(new Long(999)); assertEquals("/OME/OMEIS/Pixels/999", path); }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/ae0b01fad17fcacba3ec0999ca1ad645f389b5f9/HelperUnitTest.java/clean/components/omeio-nio/test/ome/io/nio/utests/HelperUnitTest.java
String path = ome.io.nio.Helper.getPixelsPath(new Long(1000001));
String path = new PixelsService("/OME/OMEIS/").getPixelsPath(new Long(1000001));
public void testPixelsThreeDirectoryLowerBoundsPath() { String path = ome.io.nio.Helper.getPixelsPath(new Long(1000001)); assertEquals("/OME/OMEIS/Pixels/Dir-001/Dir-000/1000001", path); }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/ae0b01fad17fcacba3ec0999ca1ad645f389b5f9/HelperUnitTest.java/clean/components/omeio-nio/test/ome/io/nio/utests/HelperUnitTest.java
String path = ome.io.nio.Helper.getPixelsPath(new Long(999999999));
String path = new PixelsService("/OME/OMEIS/").getPixelsPath(new Long(999999999));
public void testPixelsThreeDirectoryUpperBoundsPath() { String path = ome.io.nio.Helper.getPixelsPath(new Long(999999999)); assertEquals("/OME/OMEIS/Pixels/Dir-999/Dir-999/999999999", path); }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/ae0b01fad17fcacba3ec0999ca1ad645f389b5f9/HelperUnitTest.java/clean/components/omeio-nio/test/ome/io/nio/utests/HelperUnitTest.java
String path = ome.io.nio.Helper.getPixelsPath(new Long(1001));
String path = new PixelsService("/OME/OMEIS/").getPixelsPath(new Long(1001));
public void testPixelsTwoDirectoryLowerBoundsPath() { String path = ome.io.nio.Helper.getPixelsPath(new Long(1001)); assertEquals("/OME/OMEIS/Pixels/Dir-001/1001", path); }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/ae0b01fad17fcacba3ec0999ca1ad645f389b5f9/HelperUnitTest.java/clean/components/omeio-nio/test/ome/io/nio/utests/HelperUnitTest.java
String path = ome.io.nio.Helper.getPixelsPath(new Long(999999));
String path = new PixelsService("/OME/OMEIS/").getPixelsPath(new Long(999999));
public void testPixelsTwoDirectoryUpperBoundsPath() { String path = ome.io.nio.Helper.getPixelsPath(new Long(999999)); assertEquals("/OME/OMEIS/Pixels/Dir-999/999999", path); }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/ae0b01fad17fcacba3ec0999ca1ad645f389b5f9/HelperUnitTest.java/clean/components/omeio-nio/test/ome/io/nio/utests/HelperUnitTest.java
indent -= indentRate;
if (indent > 0) indent--;
void decreaseIndentation() { indent -= indentRate; }
50197 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50197/4d63a8c9fa3cc11c9152b3635695cdd64fa70119/XMLReport.java/buggy/cobertura/src/net/sourceforge/cobertura/reporting/xml/XMLReport.java
indent += indentRate;
indent++;
void increaseIndentation() { indent += indentRate; }
50197 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50197/4d63a8c9fa3cc11c9152b3635695cdd64fa70119/XMLReport.java/buggy/cobertura/src/net/sourceforge/cobertura/reporting/xml/XMLReport.java
int i = 0; while (st.hasMoreElements()) {
for (int i=0; st.hasMoreElements(); i++) {
static private String[] tokenize(String list) { StringTokenizer st = new StringTokenizer(list," \t\n\f\r;,"); String[] tokens = new String[st.countTokens()]; int i = 0; while (st.hasMoreElements()) { tokens[i] = st.nextToken(); } return tokens; }
52513 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/52513/abe5553399408c243ffa20f1b662334a2c8120a5/ComponentMap.java/clean/webmacro/src/org/webmacro/util/ComponentMap.java
maxZoomLabel.setText(String.valueOf(val)+"%");
public void maxZoomLevelChanged(double level) { int val = (int)Math.round(level*100); if(slider.getValue() > val) { slider.setValue(val); } slider.setMaximum(val); }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/186ead79c1ec71a6147b8b6e6e37ef46e68e9924/BrowserInternalFrame.java/buggy/SRC/org/openmicroscopy/shoola/agents/browser/ui/BrowserInternalFrame.java
System.err.println("minzoom change: "+level);
public void minZoomLevelChanged(double level) { System.err.println("minzoom change: "+level); int val = (int)Math.round(level*100); if(slider.getValue() < val) { slider.setValue(val); } slider.setMinimum(val); }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/186ead79c1ec71a6147b8b6e6e37ef46e68e9924/BrowserInternalFrame.java/buggy/SRC/org/openmicroscopy/shoola/agents/browser/ui/BrowserInternalFrame.java
minZoomLabel.setText(String.valueOf(val)+"%");
public void minZoomLevelChanged(double level) { System.err.println("minzoom change: "+level); int val = (int)Math.round(level*100); if(slider.getValue() < val) { slider.setValue(val); } slider.setMinimum(val); }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/186ead79c1ec71a6147b8b6e6e37ef46e68e9924/BrowserInternalFrame.java/buggy/SRC/org/openmicroscopy/shoola/agents/browser/ui/BrowserInternalFrame.java
System.err.println("zoom changed: "+level);
public void zoomLevelChanged(double level) { System.err.println("zoom changed: "+level); if(!slider.getValueIsAdjusting()) { int val = (int)Math.round(level*100); slider.setValue(val); } }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/186ead79c1ec71a6147b8b6e6e37ef46e68e9924/BrowserInternalFrame.java/buggy/SRC/org/openmicroscopy/shoola/agents/browser/ui/BrowserInternalFrame.java
System.err.println("bounds: ["+iX+","+iY+","+iEX+"," +iEY+","+iW+","+iH+"]");
public void cameraBoundsChanged(double valueX, double valueY, double extentX, double extentY, double width, double height) { int iX = (int)Math.round(valueX); int iY = (int)Math.round(valueY); int iEX = (int)Math.round(extentX); int iEY = (int)Math.round(extentY); int iW = (int)Math.round(width); int iH = (int)Math.round(height); System.err.println("bounds: ["+iX+","+iY+","+iEX+"," +iEY+","+iW+","+iH+"]"); BoundedRangeModel horizModel = horizontalBar.getModel(); BoundedRangeModel vertModel = verticalBar.getModel(); if(iEX+iX > iW) horizontalBar.setEnabled(false); else { horizontalBar.setEnabled(true); if(iW != horizModel.getMaximum() || iEX != horizModel.getExtent()) { BoundedRangeModel hModel = new DefaultBoundedRangeModel(iX,iEX,0,iW); horizontalBar.setModel(hModel); } else { horizModel.setValue(iX); } } if(iEY+iY > iH) verticalBar.setEnabled(false); else { verticalBar.setEnabled(true); if(iH != vertModel.getMaximum() || iEY != vertModel.getExtent()) { BoundedRangeModel vModel = new DefaultBoundedRangeModel(iY,iEY,0,iH); verticalBar.setModel(vModel); } else { horizModel.setValue(iY); } } }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/186ead79c1ec71a6147b8b6e6e37ef46e68e9924/BrowserInternalFrame.java/buggy/SRC/org/openmicroscopy/shoola/agents/browser/ui/BrowserInternalFrame.java
horizModel.setValue(iY);
vertModel.setValue(iY);
public void cameraBoundsChanged(double valueX, double valueY, double extentX, double extentY, double width, double height) { int iX = (int)Math.round(valueX); int iY = (int)Math.round(valueY); int iEX = (int)Math.round(extentX); int iEY = (int)Math.round(extentY); int iW = (int)Math.round(width); int iH = (int)Math.round(height); System.err.println("bounds: ["+iX+","+iY+","+iEX+"," +iEY+","+iW+","+iH+"]"); BoundedRangeModel horizModel = horizontalBar.getModel(); BoundedRangeModel vertModel = verticalBar.getModel(); if(iEX+iX > iW) horizontalBar.setEnabled(false); else { horizontalBar.setEnabled(true); if(iW != horizModel.getMaximum() || iEX != horizModel.getExtent()) { BoundedRangeModel hModel = new DefaultBoundedRangeModel(iX,iEX,0,iW); horizontalBar.setModel(hModel); } else { horizModel.setValue(iX); } } if(iEY+iY > iH) verticalBar.setEnabled(false); else { verticalBar.setEnabled(true); if(iH != vertModel.getMaximum() || iEY != vertModel.getExtent()) { BoundedRangeModel vModel = new DefaultBoundedRangeModel(iY,iEY,0,iH); verticalBar.setModel(vModel); } else { horizModel.setValue(iY); } } }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/186ead79c1ec71a6147b8b6e6e37ef46e68e9924/BrowserInternalFrame.java/buggy/SRC/org/openmicroscopy/shoola/agents/browser/ui/BrowserInternalFrame.java
public ColorChooser(ChannelBindings cb)
public ColorChooser(HSBPaneManager hsbManager, int[] rgba)
public ColorChooser(ChannelBindings cb) { int[] rgba = cb.getRGBA(); int v = (int) (rgba[ALPHA]*100/255); Color c = new Color(rgba[RED], rgba[GREEN], rgba[BLUE], rgba[ALPHA]); ccManager = new ColorChooserManager(this, rgba, v); cp = new ColorPalette(ccManager); Container contentPane = super.getContentPane(); initButtons(); initSlider(v); initTextBoxes(rgba, v); initColorPanel(c); buildGUI(); contents.setSize(WIN_W, WIN_H); contentPane.add(contents); ccManager.attachListeners(); setResizable(false); setSize(WIN_W+W_EXTRA, WIN_H+H_EXTRA); }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/0c2418384f5c30e274953927e006a71647a24f1b/ColorChooser.java/buggy/SRC/org/openmicroscopy/shoola/agents/rnd/model/ColorChooser.java
int[] rgba = cb.getRGBA();
super(hsbManager.getReferenceFrame(), "ColorChooser", true);
public ColorChooser(ChannelBindings cb) { int[] rgba = cb.getRGBA(); int v = (int) (rgba[ALPHA]*100/255); Color c = new Color(rgba[RED], rgba[GREEN], rgba[BLUE], rgba[ALPHA]); ccManager = new ColorChooserManager(this, rgba, v); cp = new ColorPalette(ccManager); Container contentPane = super.getContentPane(); initButtons(); initSlider(v); initTextBoxes(rgba, v); initColorPanel(c); buildGUI(); contents.setSize(WIN_W, WIN_H); contentPane.add(contents); ccManager.attachListeners(); setResizable(false); setSize(WIN_W+W_EXTRA, WIN_H+H_EXTRA); }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/0c2418384f5c30e274953927e006a71647a24f1b/ColorChooser.java/buggy/SRC/org/openmicroscopy/shoola/agents/rnd/model/ColorChooser.java
ccManager = new ColorChooserManager(this, rgba, v);
ccManager = new ColorChooserManager(this, hsbManager, rgba, v);
public ColorChooser(ChannelBindings cb) { int[] rgba = cb.getRGBA(); int v = (int) (rgba[ALPHA]*100/255); Color c = new Color(rgba[RED], rgba[GREEN], rgba[BLUE], rgba[ALPHA]); ccManager = new ColorChooserManager(this, rgba, v); cp = new ColorPalette(ccManager); Container contentPane = super.getContentPane(); initButtons(); initSlider(v); initTextBoxes(rgba, v); initColorPanel(c); buildGUI(); contents.setSize(WIN_W, WIN_H); contentPane.add(contents); ccManager.attachListeners(); setResizable(false); setSize(WIN_W+W_EXTRA, WIN_H+H_EXTRA); }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/0c2418384f5c30e274953927e006a71647a24f1b/ColorChooser.java/buggy/SRC/org/openmicroscopy/shoola/agents/rnd/model/ColorChooser.java