rem
stringlengths
0
477k
add
stringlengths
0
313k
context
stringlengths
6
599k
meta
stringlengths
141
403
println("<source>" + sourceDirectory.getAbsolutePath() + "</source>");
println("<source>" + sourceDirectory + "</source>");
private void dumpSource(File sourceDirectory) { println("<source>" + sourceDirectory.getAbsolutePath() + "</source>"); }
50197 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50197/c26f5a170c752d9d1d5b884dd7eb60b982637269/XMLReport.java/clean/cobertura/src/net/sourceforge/cobertura/reporting/xml/XMLReport.java
for (Iterator it = finder.getBaseDirectories().iterator(); it.hasNext(); ) { File dir = (File) it.next();
for (Iterator it = finder.getSourceDirectoryList().iterator(); it.hasNext(); ) { String dir = (String) it.next();
private void dumpSources() { println("<sources>"); increaseIndentation(); for (Iterator it = finder.getBaseDirectories().iterator(); it.hasNext(); ) { File dir = (File) it.next(); dumpSource(dir); } decreaseIndentation(); println("</sources>"); }
50197 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50197/c26f5a170c752d9d1d5b884dd7eb60b982637269/XMLReport.java/clean/cobertura/src/net/sourceforge/cobertura/reporting/xml/XMLReport.java
StringWriter stackTrace = new StringWriter(); exception.printStackTrace(new PrintWriter(stackTrace)); StringBuffer sb = new StringBuffer(); sb.append("Native Exception: '"); sb.append(exception.getClass()).append("\'; Message: "); sb.append(exception.getMessage()); sb.append("; StackTrace: "); sb.append(stackTrace.getBuffer().toString()); throw new RaiseException(ruby, "RuntimeError", sb.toString());
throw createRaiseException(exception);
public void handleNativeException(Exception exception) { Class excptnClass = exception.getClass(); RubyProc handler = (RubyProc)exceptionHandlers.get(excptnClass.getName()); while (handler == null && excptnClass != Exception.class) { excptnClass = excptnClass.getSuperclass(); } if (handler != null) { handler.call(new IRubyObject[]{JavaUtil.convertJavaToRuby(ruby, exception)}); } else { StringWriter stackTrace = new StringWriter(); exception.printStackTrace(new PrintWriter(stackTrace)); StringBuffer sb = new StringBuffer(); sb.append("Native Exception: '"); sb.append(exception.getClass()).append("\'; Message: "); sb.append(exception.getMessage()); sb.append("; StackTrace: "); sb.append(stackTrace.getBuffer().toString()); throw new RaiseException(ruby, "RuntimeError", sb.toString()); } }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/9028c57cb1199775e0b355581f41e146adcb60c1/JavaSupport.java/clean/org/jruby/javasupport/JavaSupport.java
unit = size/getPixelsSizeX();
if (getPixelsSizeX() > 0) unit = size/getPixelsSizeX(); else unit = size;
void setUnitBarSize(double size) { unit = size/getPixelsSizeX(); }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/5caa05ab93022edbd6aaba0c505784dcbed59934/BrowserModel.java/buggy/SRC/org/openmicroscopy/shoola/agents/imviewer/browser/BrowserModel.java
*/
public static void main (String args[]) { System.out.println(); System.out.println("----------------------------------------------------"); System.out.println("--- WARNING this is an ALPHA version of JRuby!!! ---"); System.out.println("----------------------------------------------------"); System.out.println(); // Benchmark long now = -1; if (args.length == 0) { printUsage(); } else { int lenArg = args.length; for (int i = 0; i < lenArg; i++) { if (args[i].equals("-h") || args[i].equals("-help")) { printUsage(); } else if (args[i].equals("-e")) { if (i++ >= lenArg) { System.err.println("invalid argument " + i); System.err.println(" -e must be followed by an expression to evaluate"); printUsage(); } else { runInterpreter(args[i], "command line " + i, new String[0]); } } else if (args[i].equals("-b")) { // Benchmark now = System.currentTimeMillis(); } else if (args[i].equals("-rx")) { if (i++ >= lenArg) { System.err.println("invalid argument " + i); System.err.println(" -rx must be followed by an expression to evaluate"); printUsage(); } else { try { sRegexpAdapter = Class.forName(args[i]); } catch (Exception e) { System.err.println("invalid argument " + i ); System.err.println("failed to load RegexpAdapter: " + args[i]); System.err.println("defaulting to default RegexpAdapter: GNURegexpAdapter"); } } } else { String[] argv = new String[lenArg - i - 1]; System.arraycopy(args, i + 1, argv, 0, argv.length); runInterpreterOnFile(args[i], argv); break; } } } // Benchmark if (now != -1) { System.out.println("Runtime: " + (System.currentTimeMillis() - now) + " ms"); } }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/a6fb3288b71aaedfe3a7b5e8d1e561e0bc249dc6/Main.java/buggy/org/jruby/Main.java
int remaining = encode.remaining(); char[] s = encode.nextSubstring(4).toCharArray(); if (remaining > 2 && s[2] == '=') lElem.append((char)((a << 2 | b >> 4) & 255)); if (c != -1 && remaining > 3 && s[3] == '=') { lElem.append((char)((a << 2 | b >> 4) & 255)); lElem.append((char)((b << 4 | c >> 2) & 255)); }
lElem.append((char)((a << 2 | b >> 4) & 255)); if(c != -1) { lElem.append((char)((b << 4 | c >> 2) & 255)); }
public static RubyArray unpack(String encodedString, RubyString formatString) { IRuby runtime = formatString.getRuntime(); RubyArray result = runtime.newArray(); PtrList format = new PtrList(formatString.toString()); PtrList encode = new PtrList(encodedString); char type = format.nextChar(); // Type to be unpacked while(!format.isAtEnd()) { // Possible next type, format of current type, occurrences of type char next = format.nextChar(); // Next indicates to decode using native encoding format if (next == '_' || next == '!') { if (NATIVE_CODES.indexOf(type) == -1) { throw runtime.newArgumentError("'" + next + "' allowed only after types " + NATIVE_CODES); } // We advance in case occurences follows next = format.nextChar(); } // How many occurrences of 'type' we want int occurrences = 0; if (format.isAtEnd()) { occurrences = 1; } else if (next == '*') { occurrences = IS_STAR; next = format.nextChar(); } else if (Character.isDigit(next)) { format.backup(1); occurrences = format.nextAsciiNumber(); next = format.nextChar(); } else { occurrences = type == '@' ? 0 : 1; } // See if we have a converter for the job... Converter converter = (Converter) converters.get(new Character(type)); if (converter != null) { decode(runtime, encode, occurrences, result, converter); type = next; continue; } // Otherwise the unpack should be here... switch (type) { case '@' : encode.setPosition(occurrences); break; case '%' : throw runtime.newArgumentError("% is not supported"); case 'A' : { if (occurrences == IS_STAR || occurrences > encode.remaining()) { occurrences = encode.remaining(); } String potential = encode.nextSubstring(occurrences); for (int t = occurrences - 1; occurrences > 0; occurrences--, t--) { char c = potential.charAt(t); if (c != '\0' && c != ' ') { break; } } potential = potential.substring(0, occurrences); result.append(runtime.newString(potential)); } break; case 'Z' : { if (occurrences == IS_STAR || occurrences > encode.remaining()) { occurrences = encode.remaining(); } String potential = encode.nextSubstring(occurrences); for (int t = occurrences - 1; occurrences > 0; occurrences--, t--) { char c = potential.charAt(t); if (c != '\0') { break; } } potential = potential.substring(0, occurrences); result.append(runtime.newString(potential)); } break; case 'a' : if (occurrences == IS_STAR || occurrences > encode.remaining()) { occurrences = encode.remaining(); } result.append(runtime.newString(encode.nextSubstring(occurrences))); break; case 'b' : { if (occurrences == IS_STAR || occurrences > encode.remaining() * 8) { occurrences = encode.remaining() * 8; } int bits = 0; StringBuffer lElem = new StringBuffer(occurrences); for (int lCurByte = 0; lCurByte < occurrences; lCurByte++) { if ((lCurByte & 7) != 0) { bits >>>= 1; } else { bits = encode.nextChar(); } lElem.append((bits & 1) != 0 ? '1' : '0'); } result.append(runtime.newString(lElem.toString())); } break; case 'B' : { if (occurrences == IS_STAR || occurrences > encode.remaining() * 8) { occurrences = encode.remaining() * 8; } int bits = 0; StringBuffer lElem = new StringBuffer(occurrences); for (int lCurByte = 0; lCurByte < occurrences; lCurByte++) { if ((lCurByte & 7) != 0) bits <<= 1; else bits = encode.nextChar(); lElem.append((bits & 128) != 0 ? '1' : '0'); } result.append(runtime.newString(lElem.toString())); } break; case 'h' : { if (occurrences == IS_STAR || occurrences > encode.remaining() * 2) { occurrences = encode.remaining() * 2; } int bits = 0; StringBuffer lElem = new StringBuffer(occurrences); for (int lCurByte = 0; lCurByte < occurrences; lCurByte++) { if ((lCurByte & 1) != 0) { bits >>>= 4; } else { bits = encode.nextChar(); } lElem.append(sHexDigits[bits & 15]); } result.append(runtime.newString(lElem.toString())); } break; case 'H' : { if (occurrences == IS_STAR || occurrences > encode.remaining() * 2) { occurrences = encode.remaining() * 2; } int bits = 0; StringBuffer lElem = new StringBuffer(occurrences); for (int lCurByte = 0; lCurByte < occurrences; lCurByte++) { if ((lCurByte & 1) != 0) bits <<= 4; else bits = encode.nextChar(); lElem.append(sHexDigits[(bits >>> 4) & 15]); } result.append(runtime.newString(lElem.toString())); } break; case 'u': { int length = encode.remaining() * 3 / 4; StringBuffer lElem = new StringBuffer(length); char s; int total = 0; s = encode.nextChar(); while (!encode.isAtEnd() && s > ' ' && s < 'a') { int a, b, c, d; char[] hunk = new char[3]; int len = (s - ' ') & 077; s = encode.nextChar(); total += len; if (total > length) { len -= total - length; total = length; } while (len > 0) { int mlen = len > 3 ? 3 : len; if (!encode.isAtEnd() && s >= ' ') { a = (s - ' ') & 077; s = encode.nextChar(); } else a = 0; if (!encode.isAtEnd() && s >= ' ') { b = (s - ' ') & 077; s = encode.nextChar(); } else b = 0; if (!encode.isAtEnd() && s >= ' ') { c = (s - ' ') & 077; s = encode.nextChar(); } else c = 0; if (!encode.isAtEnd() && s >= ' ') { d = (s - ' ') & 077; s = encode.nextChar(); } else d = 0; hunk[0] = (char) ((a << 2 | b >> 4) & 255); hunk[1] = (char) ((b << 4 | c >> 2) & 255); hunk[2] = (char) ((c << 6 | d) & 255); lElem.append(hunk, 0, (int) mlen); len -= mlen; } if (s == '\r') s = encode.nextChar(); if (s == '\n') s = encode.nextChar(); else if (!encode.isAtEnd()) { if (encode.nextChar() == '\n') { encode.nextChar(); // Possible Checksum Byte } else if (!encode.isAtEnd()) { encode.backup(1); } } } result.append(runtime.newString(lElem.toString())); } break; case 'm': { int length = encode.remaining()*3/4; StringBuffer lElem = new StringBuffer(length); int a = -1, b = -1, c = 0, d; while (!encode.isAtEnd()) { char s; do { s = encode.nextChar(); } while (s == '\r' || s == '\n'); if ((a = b64_xtable[s]) == -1) break; if ((b = b64_xtable[s = encode.nextChar()]) == -1) break; if ((c = b64_xtable[s = encode.nextChar()]) == -1) break; if ((d = b64_xtable[s = encode.nextChar()]) == -1) break; lElem.append((char)((a << 2 | b >> 4) & 255)); lElem.append((char)((b << 4 | c >> 2) & 255)); lElem.append((char)((c << 6 | d) & 255)); } if (a != -1 && b != -1) { int remaining = encode.remaining(); char[] s = encode.nextSubstring(4).toCharArray(); if (remaining > 2 && s[2] == '=') lElem.append((char)((a << 2 | b >> 4) & 255)); if (c != -1 && remaining > 3 && s[3] == '=') { lElem.append((char)((a << 2 | b >> 4) & 255)); lElem.append((char)((b << 4 | c >> 2) & 255)); } } result.append(runtime.newString(lElem.toString())); } break; case 'M' : { StringBuffer lElem = new StringBuffer(Math.max(encode.remaining(),0)); for(;;) { char c = encode.nextChar(); if (encode.isAtEnd()) break; if (c != '=') { lElem.append(c); } else { char c1 = encode.nextChar(); if (encode.isAtEnd()) break; if (c1 == '\n') continue; char c2 = encode.nextChar(); if (encode.isAtEnd()) break; String hexString = new String(new char[]{c1,c2}); int value = Integer.parseInt(hexString,16); lElem.append((char)value); } } result.append(runtime.newString(lElem.toString())); } break; case 'U' : { if (occurrences == IS_STAR || occurrences > encode.remaining()) { occurrences = encode.remaining(); } //get the correct substring String toUnpack = encode.nextSubstring(occurrences); String lUtf8 = null; try { lUtf8 = new String(toUnpack.getBytes("iso8859-1"), "UTF-8"); } catch (java.io.UnsupportedEncodingException e) { assert false : "can't convert from UTF8"; } char[] c = lUtf8.toCharArray(); for (int lCurCharIdx = 0; occurrences-- > 0 && lCurCharIdx < c.length; lCurCharIdx++) result.append(runtime.newFixnum(c[lCurCharIdx])); } break; case 'X': if (occurrences == IS_STAR) { occurrences = encode.getLength() - encode.remaining(); } try { encode.backup(occurrences); } catch (IllegalArgumentException e) { throw runtime.newArgumentError("in `unpack': X outside of string"); } break; case 'x': if (occurrences == IS_STAR) { occurrences = encode.remaining(); } try { encode.nextSubstring(occurrences); } catch (IllegalArgumentException e) { throw runtime.newArgumentError("in `unpack': x outside of string"); } break; } type = next; } return result; }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/7267f4fa96d07007cab8b8de87753fd877169e12/Pack.java/clean/src/org/jruby/util/Pack.java
template = props.getProperty (page.getTitle());
if (props.getProperty (page.getTitle()) != null) template = props.getProperty (page.getTitle());
public String getTemplateName(WikiSystem wiki, WikiPage page) { Properties props = wiki.getProperties(); String template = props.getProperty ("ViewPageAction.Template"); if (page != null) { template = props.getProperty (page.getTitle()); } return template; }
52513 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/52513/92e61b70f298345a3b88128f6d589229626609d1/ViewPageAction.java/clean/wiki/src/org/tcdi/opensource/wiki/servlet/ViewPageAction.java
} catch (BreakException bExcptn) {
} catch (BreakJump bExcptn) {
public RubyObject eval(Ruby ruby, RubyObject self) { while (getConditionNode().eval(ruby, self).isTrue()) { while (true) { try { getBodyNode().eval(ruby, self); break; } catch (RedoException rExcptn) { } catch (NextException nExcptn) { break; } catch (BreakException bExcptn) { return ruby.getNil(); } } } return ruby.getNil(); }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/786cea08c1dd2092a02d1254b49fbee371ace5f9/WhileNode.java/buggy/org/jruby/nodes/WhileNode.java
generateClassLists();
generateSourceFileLists();
public HTMLReport(ProjectData projectData, File outputDir, File sourceDir) throws Exception { this.destinationDir = outputDir; this.sourceDir = sourceDir; this.projectData = projectData; CopyFiles.copy(outputDir); generatePackageList(); generateClassLists(); generateOverviews(); generateSourceFiles(); }
50197 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50197/cd01654d464661ad4ee16d9e5f0f6e799c0ad9e4/HTMLReport.java/buggy/cobertura/src/net/sourceforge/cobertura/reporting/html/HTMLReport.java
Collection classes;
Collection sourceFiles;
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>"); Collection packages; if (packageData == null) { // Output a summary line for all packages out.println(generateTableRowForTotal()); // Get packages packages = projectData.getChildren(); } 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 classes in this package Collection classes; if (packageData == null) { classes = new TreeSet(); if (projectData.getNumberOfClasses() > 0) { iter = projectData.getClasses().iterator(); while (iter.hasNext()) { ClassData classData = (ClassData)iter.next(); if (classData.getPackageName() == null) { classes.add(classData); } } } } else { classes = packageData.getClasses(); } // Output a line for each class if (classes.size() > 0) { out.println("<p>"); out.println("<table class=\"report\" id=\"classResults\">"); out.println(generateTableHeaderForClasses()); out.println("<tbody>"); iter = classes.iterator(); while (iter.hasNext()) { ClassData classData = (ClassData)iter.next(); out.println(generateTableRowForClass(classData)); } 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/cd01654d464661ad4ee16d9e5f0f6e799c0ad9e4/HTMLReport.java/buggy/cobertura/src/net/sourceforge/cobertura/reporting/html/HTMLReport.java
classes = new TreeSet(); if (projectData.getNumberOfClasses() > 0) { iter = projectData.getClasses().iterator(); while (iter.hasNext()) { ClassData classData = (ClassData)iter.next(); if (classData.getPackageName() == null) { classes.add(classData); } } }
sourceFiles = projectData.getSourceFiles();
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>"); Collection packages; if (packageData == null) { // Output a summary line for all packages out.println(generateTableRowForTotal()); // Get packages packages = projectData.getChildren(); } 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 classes in this package Collection classes; if (packageData == null) { classes = new TreeSet(); if (projectData.getNumberOfClasses() > 0) { iter = projectData.getClasses().iterator(); while (iter.hasNext()) { ClassData classData = (ClassData)iter.next(); if (classData.getPackageName() == null) { classes.add(classData); } } } } else { classes = packageData.getClasses(); } // Output a line for each class if (classes.size() > 0) { out.println("<p>"); out.println("<table class=\"report\" id=\"classResults\">"); out.println(generateTableHeaderForClasses()); out.println("<tbody>"); iter = classes.iterator(); while (iter.hasNext()) { ClassData classData = (ClassData)iter.next(); out.println(generateTableRowForClass(classData)); } 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/cd01654d464661ad4ee16d9e5f0f6e799c0ad9e4/HTMLReport.java/buggy/cobertura/src/net/sourceforge/cobertura/reporting/html/HTMLReport.java
classes = packageData.getClasses();
sourceFiles = packageData.getSourceFiles();
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>"); Collection packages; if (packageData == null) { // Output a summary line for all packages out.println(generateTableRowForTotal()); // Get packages packages = projectData.getChildren(); } 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 classes in this package Collection classes; if (packageData == null) { classes = new TreeSet(); if (projectData.getNumberOfClasses() > 0) { iter = projectData.getClasses().iterator(); while (iter.hasNext()) { ClassData classData = (ClassData)iter.next(); if (classData.getPackageName() == null) { classes.add(classData); } } } } else { classes = packageData.getClasses(); } // Output a line for each class if (classes.size() > 0) { out.println("<p>"); out.println("<table class=\"report\" id=\"classResults\">"); out.println(generateTableHeaderForClasses()); out.println("<tbody>"); iter = classes.iterator(); while (iter.hasNext()) { ClassData classData = (ClassData)iter.next(); out.println(generateTableRowForClass(classData)); } 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/cd01654d464661ad4ee16d9e5f0f6e799c0ad9e4/HTMLReport.java/buggy/cobertura/src/net/sourceforge/cobertura/reporting/html/HTMLReport.java
if (classes.size() > 0)
if (sourceFiles.size() > 0)
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>"); Collection packages; if (packageData == null) { // Output a summary line for all packages out.println(generateTableRowForTotal()); // Get packages packages = projectData.getChildren(); } 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 classes in this package Collection classes; if (packageData == null) { classes = new TreeSet(); if (projectData.getNumberOfClasses() > 0) { iter = projectData.getClasses().iterator(); while (iter.hasNext()) { ClassData classData = (ClassData)iter.next(); if (classData.getPackageName() == null) { classes.add(classData); } } } } else { classes = packageData.getClasses(); } // Output a line for each class if (classes.size() > 0) { out.println("<p>"); out.println("<table class=\"report\" id=\"classResults\">"); out.println(generateTableHeaderForClasses()); out.println("<tbody>"); iter = classes.iterator(); while (iter.hasNext()) { ClassData classData = (ClassData)iter.next(); out.println(generateTableRowForClass(classData)); } 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/cd01654d464661ad4ee16d9e5f0f6e799c0ad9e4/HTMLReport.java/buggy/cobertura/src/net/sourceforge/cobertura/reporting/html/HTMLReport.java
iter = classes.iterator();
iter = sourceFiles.iterator();
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>"); Collection packages; if (packageData == null) { // Output a summary line for all packages out.println(generateTableRowForTotal()); // Get packages packages = projectData.getChildren(); } 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 classes in this package Collection classes; if (packageData == null) { classes = new TreeSet(); if (projectData.getNumberOfClasses() > 0) { iter = projectData.getClasses().iterator(); while (iter.hasNext()) { ClassData classData = (ClassData)iter.next(); if (classData.getPackageName() == null) { classes.add(classData); } } } } else { classes = packageData.getClasses(); } // Output a line for each class if (classes.size() > 0) { out.println("<p>"); out.println("<table class=\"report\" id=\"classResults\">"); out.println(generateTableHeaderForClasses()); out.println("<tbody>"); iter = classes.iterator(); while (iter.hasNext()) { ClassData classData = (ClassData)iter.next(); out.println(generateTableRowForClass(classData)); } 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/cd01654d464661ad4ee16d9e5f0f6e799c0ad9e4/HTMLReport.java/buggy/cobertura/src/net/sourceforge/cobertura/reporting/html/HTMLReport.java
ClassData classData = (ClassData)iter.next(); out.println(generateTableRowForClass(classData));
SourceFileData sourceFileData = (SourceFileData)iter .next(); out .println(generateTableRowForSourceFile(sourceFileData));
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>"); Collection packages; if (packageData == null) { // Output a summary line for all packages out.println(generateTableRowForTotal()); // Get packages packages = projectData.getChildren(); } 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 classes in this package Collection classes; if (packageData == null) { classes = new TreeSet(); if (projectData.getNumberOfClasses() > 0) { iter = projectData.getClasses().iterator(); while (iter.hasNext()) { ClassData classData = (ClassData)iter.next(); if (classData.getPackageName() == null) { classes.add(classData); } } } } else { classes = packageData.getClasses(); } // Output a line for each class if (classes.size() > 0) { out.println("<p>"); out.println("<table class=\"report\" id=\"classResults\">"); out.println(generateTableHeaderForClasses()); out.println("<tbody>"); iter = classes.iterator(); while (iter.hasNext()) { ClassData classData = (ClassData)iter.next(); out.println(generateTableRowForClass(classData)); } 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/cd01654d464661ad4ee16d9e5f0f6e799c0ad9e4/HTMLReport.java/buggy/cobertura/src/net/sourceforge/cobertura/reporting/html/HTMLReport.java
.println("<td nowrap=\"nowrap\"><a href=\"frame-summary.html\" onClick='parent.classList.location.href=\"frame-classes.html\"' target=\"summary\">All</a></td>");
.println("<td nowrap=\"nowrap\"><a href=\"frame-summary.html\" onClick='parent.sourceFileList.location.href=\"frame-sourcefiles.html\"' target=\"summary\">All</a></td>");
private void generatePackageList() throws IOException { File file = new File(destinationDir, "frame-packages.html"); 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("</head>"); out.println("<body>"); out.println("<h5>Packages</h5>"); out.println("<table width=\"100%\">"); out.println("<tr>"); out .println("<td nowrap=\"nowrap\"><a href=\"frame-summary.html\" onClick='parent.classList.location.href=\"frame-classes.html\"' target=\"summary\">All</a></td>"); out.println("</tr>"); SortedSet sortedPackages = new TreeSet(); sortedPackages.addAll(projectData.getChildren()); Iterator iter = sortedPackages.iterator(); while (iter.hasNext()) { PackageData packageData = (PackageData)iter.next(); String url1 = "frame-summary-" + packageData.getName() + ".html"; String url2 = "frame-classes-" + packageData.getName() + ".html"; out.println("<tr>"); out.println("<td nowrap=\"nowrap\"><a href=\"" + url1 + "\" onClick='parent.classList.location.href=\"" + url2 + "\"' target=\"summary\">" + generatePackageName(packageData) + "</a></td>"); out.println("</tr>"); } out.println("</table>"); 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/cd01654d464661ad4ee16d9e5f0f6e799c0ad9e4/HTMLReport.java/buggy/cobertura/src/net/sourceforge/cobertura/reporting/html/HTMLReport.java
String url2 = "frame-classes-" + packageData.getName()
String url2 = "frame-sourcefiles-" + packageData.getName()
private void generatePackageList() throws IOException { File file = new File(destinationDir, "frame-packages.html"); 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("</head>"); out.println("<body>"); out.println("<h5>Packages</h5>"); out.println("<table width=\"100%\">"); out.println("<tr>"); out .println("<td nowrap=\"nowrap\"><a href=\"frame-summary.html\" onClick='parent.classList.location.href=\"frame-classes.html\"' target=\"summary\">All</a></td>"); out.println("</tr>"); SortedSet sortedPackages = new TreeSet(); sortedPackages.addAll(projectData.getChildren()); Iterator iter = sortedPackages.iterator(); while (iter.hasNext()) { PackageData packageData = (PackageData)iter.next(); String url1 = "frame-summary-" + packageData.getName() + ".html"; String url2 = "frame-classes-" + packageData.getName() + ".html"; out.println("<tr>"); out.println("<td nowrap=\"nowrap\"><a href=\"" + url1 + "\" onClick='parent.classList.location.href=\"" + url2 + "\"' target=\"summary\">" + generatePackageName(packageData) + "</a></td>"); out.println("</tr>"); } out.println("</table>"); 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/cd01654d464661ad4ee16d9e5f0f6e799c0ad9e4/HTMLReport.java/buggy/cobertura/src/net/sourceforge/cobertura/reporting/html/HTMLReport.java
out.println("<td nowrap=\"nowrap\"><a href=\"" + url1 + "\" onClick='parent.classList.location.href=\"" + url2 + "\"' target=\"summary\">" + generatePackageName(packageData) + "</a></td>");
out .println("<td nowrap=\"nowrap\"><a href=\"" + url1 + "\" onClick='parent.sourceFileList.location.href=\"" + url2 + "\"' target=\"summary\">" + generatePackageName(packageData) + "</a></td>");
private void generatePackageList() throws IOException { File file = new File(destinationDir, "frame-packages.html"); 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("</head>"); out.println("<body>"); out.println("<h5>Packages</h5>"); out.println("<table width=\"100%\">"); out.println("<tr>"); out .println("<td nowrap=\"nowrap\"><a href=\"frame-summary.html\" onClick='parent.classList.location.href=\"frame-classes.html\"' target=\"summary\">All</a></td>"); out.println("</tr>"); SortedSet sortedPackages = new TreeSet(); sortedPackages.addAll(projectData.getChildren()); Iterator iter = sortedPackages.iterator(); while (iter.hasNext()) { PackageData packageData = (PackageData)iter.next(); String url1 = "frame-summary-" + packageData.getName() + ".html"; String url2 = "frame-classes-" + packageData.getName() + ".html"; out.println("<tr>"); out.println("<td nowrap=\"nowrap\"><a href=\"" + url1 + "\" onClick='parent.classList.location.href=\"" + url2 + "\"' target=\"summary\">" + generatePackageName(packageData) + "</a></td>"); out.println("</tr>"); } out.println("</table>"); 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/cd01654d464661ad4ee16d9e5f0f6e799c0ad9e4/HTMLReport.java/buggy/cobertura/src/net/sourceforge/cobertura/reporting/html/HTMLReport.java
private void generateSourceFile(ClassData classData) throws IOException
private void generateSourceFile(SourceFileData sourceFileData) throws IOException
private void generateSourceFile(ClassData classData) throws IOException { String filename = classData.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("<script type=\"text/javascript\" src=\"js/popup.js\"></script>"); out.println("</head>"); out.println("<body>"); out.print("<h5>Coverage Report - "); String classPackageName = classData.getPackageName(); if ((classPackageName != null) && classPackageName.length() > 0) { out.print(classData.getPackageName() + "."); } out.print(classData.getName()); out.println("</h5>"); // Output the coverage summary for this class out.println("<p>"); out.println("<table class=\"report\">"); out.println(generateTableHeaderForClasses()); out.println(generateTableRowForClass(classData)); out.println("</table>"); out.println("</p>"); // Output this class's source code with syntax and coverage highlighting out.println("<p>"); out .println("<table cellspacing=\"0\" cellpadding=\"0\" class=\"src\">"); BufferedReader br = null; try { File sourceFile = new File(sourceDir, classData .getSourceFileName()); br = new BufferedReader(new FileReader(sourceFile)); String lineStr; JavaToHtml javaToHtml = new JavaToHtml(); int lineNumber = 1; while ((lineStr = br.readLine()) != null) { out.println("<tr>"); if (classData.isValidSourceLineNumber(lineNumber)) { long numberOfHits = classData.getHitCount(lineNumber); out.println(" <td class=\"numLineCover\">&nbsp;" + lineNumber + "</td>"); if (numberOfHits > 0) { out .println(" <td class=\"nbHitsCovered\">&nbsp;" + numberOfHits + "</td>"); out .println(" <td class=\"src\"><pre class=\"src\">&nbsp;" + javaToHtml.process(lineStr) + "</pre></td>"); } else { out .println(" <td class=\"nbHitsUncovered\">&nbsp;" + numberOfHits + "</td>"); out .println(" <td class=\"src\"><pre class=\"src\"><span class=\"srcUncovered\">&nbsp;" + javaToHtml.process(lineStr) + "</span></pre></td>"); } } else { out.println(" <td class=\"numLine\">&nbsp;" + lineNumber + "</td>"); out.println(" <td class=\"nbHits\">&nbsp;</td>"); out .println(" <td class=\"src\"><pre class=\"src\">&nbsp;" + javaToHtml.process(lineStr) + "</pre></td>"); } out.println("</tr>"); lineNumber++; } } finally { if (br != null) { br.close(); } } out.println("</table>"); out.println("</p>"); out.println("<div class=\"footer\">"); out .println("Reports 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/cd01654d464661ad4ee16d9e5f0f6e799c0ad9e4/HTMLReport.java/buggy/cobertura/src/net/sourceforge/cobertura/reporting/html/HTMLReport.java
String filename = classData.getName() + ".html";
String filename = sourceFileData.getNormalizedName() + ".html";
private void generateSourceFile(ClassData classData) throws IOException { String filename = classData.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("<script type=\"text/javascript\" src=\"js/popup.js\"></script>"); out.println("</head>"); out.println("<body>"); out.print("<h5>Coverage Report - "); String classPackageName = classData.getPackageName(); if ((classPackageName != null) && classPackageName.length() > 0) { out.print(classData.getPackageName() + "."); } out.print(classData.getName()); out.println("</h5>"); // Output the coverage summary for this class out.println("<p>"); out.println("<table class=\"report\">"); out.println(generateTableHeaderForClasses()); out.println(generateTableRowForClass(classData)); out.println("</table>"); out.println("</p>"); // Output this class's source code with syntax and coverage highlighting out.println("<p>"); out .println("<table cellspacing=\"0\" cellpadding=\"0\" class=\"src\">"); BufferedReader br = null; try { File sourceFile = new File(sourceDir, classData .getSourceFileName()); br = new BufferedReader(new FileReader(sourceFile)); String lineStr; JavaToHtml javaToHtml = new JavaToHtml(); int lineNumber = 1; while ((lineStr = br.readLine()) != null) { out.println("<tr>"); if (classData.isValidSourceLineNumber(lineNumber)) { long numberOfHits = classData.getHitCount(lineNumber); out.println(" <td class=\"numLineCover\">&nbsp;" + lineNumber + "</td>"); if (numberOfHits > 0) { out .println(" <td class=\"nbHitsCovered\">&nbsp;" + numberOfHits + "</td>"); out .println(" <td class=\"src\"><pre class=\"src\">&nbsp;" + javaToHtml.process(lineStr) + "</pre></td>"); } else { out .println(" <td class=\"nbHitsUncovered\">&nbsp;" + numberOfHits + "</td>"); out .println(" <td class=\"src\"><pre class=\"src\"><span class=\"srcUncovered\">&nbsp;" + javaToHtml.process(lineStr) + "</span></pre></td>"); } } else { out.println(" <td class=\"numLine\">&nbsp;" + lineNumber + "</td>"); out.println(" <td class=\"nbHits\">&nbsp;</td>"); out .println(" <td class=\"src\"><pre class=\"src\">&nbsp;" + javaToHtml.process(lineStr) + "</pre></td>"); } out.println("</tr>"); lineNumber++; } } finally { if (br != null) { br.close(); } } out.println("</table>"); out.println("</p>"); out.println("<div class=\"footer\">"); out .println("Reports 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/cd01654d464661ad4ee16d9e5f0f6e799c0ad9e4/HTMLReport.java/buggy/cobertura/src/net/sourceforge/cobertura/reporting/html/HTMLReport.java
String classPackageName = classData.getPackageName();
String classPackageName = sourceFileData.getPackageName();
private void generateSourceFile(ClassData classData) throws IOException { String filename = classData.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("<script type=\"text/javascript\" src=\"js/popup.js\"></script>"); out.println("</head>"); out.println("<body>"); out.print("<h5>Coverage Report - "); String classPackageName = classData.getPackageName(); if ((classPackageName != null) && classPackageName.length() > 0) { out.print(classData.getPackageName() + "."); } out.print(classData.getName()); out.println("</h5>"); // Output the coverage summary for this class out.println("<p>"); out.println("<table class=\"report\">"); out.println(generateTableHeaderForClasses()); out.println(generateTableRowForClass(classData)); out.println("</table>"); out.println("</p>"); // Output this class's source code with syntax and coverage highlighting out.println("<p>"); out .println("<table cellspacing=\"0\" cellpadding=\"0\" class=\"src\">"); BufferedReader br = null; try { File sourceFile = new File(sourceDir, classData .getSourceFileName()); br = new BufferedReader(new FileReader(sourceFile)); String lineStr; JavaToHtml javaToHtml = new JavaToHtml(); int lineNumber = 1; while ((lineStr = br.readLine()) != null) { out.println("<tr>"); if (classData.isValidSourceLineNumber(lineNumber)) { long numberOfHits = classData.getHitCount(lineNumber); out.println(" <td class=\"numLineCover\">&nbsp;" + lineNumber + "</td>"); if (numberOfHits > 0) { out .println(" <td class=\"nbHitsCovered\">&nbsp;" + numberOfHits + "</td>"); out .println(" <td class=\"src\"><pre class=\"src\">&nbsp;" + javaToHtml.process(lineStr) + "</pre></td>"); } else { out .println(" <td class=\"nbHitsUncovered\">&nbsp;" + numberOfHits + "</td>"); out .println(" <td class=\"src\"><pre class=\"src\"><span class=\"srcUncovered\">&nbsp;" + javaToHtml.process(lineStr) + "</span></pre></td>"); } } else { out.println(" <td class=\"numLine\">&nbsp;" + lineNumber + "</td>"); out.println(" <td class=\"nbHits\">&nbsp;</td>"); out .println(" <td class=\"src\"><pre class=\"src\">&nbsp;" + javaToHtml.process(lineStr) + "</pre></td>"); } out.println("</tr>"); lineNumber++; } } finally { if (br != null) { br.close(); } } out.println("</table>"); out.println("</p>"); out.println("<div class=\"footer\">"); out .println("Reports 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/cd01654d464661ad4ee16d9e5f0f6e799c0ad9e4/HTMLReport.java/buggy/cobertura/src/net/sourceforge/cobertura/reporting/html/HTMLReport.java
out.print(classData.getPackageName() + ".");
out.print(sourceFileData.getPackageName() + ".");
private void generateSourceFile(ClassData classData) throws IOException { String filename = classData.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("<script type=\"text/javascript\" src=\"js/popup.js\"></script>"); out.println("</head>"); out.println("<body>"); out.print("<h5>Coverage Report - "); String classPackageName = classData.getPackageName(); if ((classPackageName != null) && classPackageName.length() > 0) { out.print(classData.getPackageName() + "."); } out.print(classData.getName()); out.println("</h5>"); // Output the coverage summary for this class out.println("<p>"); out.println("<table class=\"report\">"); out.println(generateTableHeaderForClasses()); out.println(generateTableRowForClass(classData)); out.println("</table>"); out.println("</p>"); // Output this class's source code with syntax and coverage highlighting out.println("<p>"); out .println("<table cellspacing=\"0\" cellpadding=\"0\" class=\"src\">"); BufferedReader br = null; try { File sourceFile = new File(sourceDir, classData .getSourceFileName()); br = new BufferedReader(new FileReader(sourceFile)); String lineStr; JavaToHtml javaToHtml = new JavaToHtml(); int lineNumber = 1; while ((lineStr = br.readLine()) != null) { out.println("<tr>"); if (classData.isValidSourceLineNumber(lineNumber)) { long numberOfHits = classData.getHitCount(lineNumber); out.println(" <td class=\"numLineCover\">&nbsp;" + lineNumber + "</td>"); if (numberOfHits > 0) { out .println(" <td class=\"nbHitsCovered\">&nbsp;" + numberOfHits + "</td>"); out .println(" <td class=\"src\"><pre class=\"src\">&nbsp;" + javaToHtml.process(lineStr) + "</pre></td>"); } else { out .println(" <td class=\"nbHitsUncovered\">&nbsp;" + numberOfHits + "</td>"); out .println(" <td class=\"src\"><pre class=\"src\"><span class=\"srcUncovered\">&nbsp;" + javaToHtml.process(lineStr) + "</span></pre></td>"); } } else { out.println(" <td class=\"numLine\">&nbsp;" + lineNumber + "</td>"); out.println(" <td class=\"nbHits\">&nbsp;</td>"); out .println(" <td class=\"src\"><pre class=\"src\">&nbsp;" + javaToHtml.process(lineStr) + "</pre></td>"); } out.println("</tr>"); lineNumber++; } } finally { if (br != null) { br.close(); } } out.println("</table>"); out.println("</p>"); out.println("<div class=\"footer\">"); out .println("Reports 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/cd01654d464661ad4ee16d9e5f0f6e799c0ad9e4/HTMLReport.java/buggy/cobertura/src/net/sourceforge/cobertura/reporting/html/HTMLReport.java
out.print(classData.getName());
out.print(sourceFileData.getBaseName());
private void generateSourceFile(ClassData classData) throws IOException { String filename = classData.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("<script type=\"text/javascript\" src=\"js/popup.js\"></script>"); out.println("</head>"); out.println("<body>"); out.print("<h5>Coverage Report - "); String classPackageName = classData.getPackageName(); if ((classPackageName != null) && classPackageName.length() > 0) { out.print(classData.getPackageName() + "."); } out.print(classData.getName()); out.println("</h5>"); // Output the coverage summary for this class out.println("<p>"); out.println("<table class=\"report\">"); out.println(generateTableHeaderForClasses()); out.println(generateTableRowForClass(classData)); out.println("</table>"); out.println("</p>"); // Output this class's source code with syntax and coverage highlighting out.println("<p>"); out .println("<table cellspacing=\"0\" cellpadding=\"0\" class=\"src\">"); BufferedReader br = null; try { File sourceFile = new File(sourceDir, classData .getSourceFileName()); br = new BufferedReader(new FileReader(sourceFile)); String lineStr; JavaToHtml javaToHtml = new JavaToHtml(); int lineNumber = 1; while ((lineStr = br.readLine()) != null) { out.println("<tr>"); if (classData.isValidSourceLineNumber(lineNumber)) { long numberOfHits = classData.getHitCount(lineNumber); out.println(" <td class=\"numLineCover\">&nbsp;" + lineNumber + "</td>"); if (numberOfHits > 0) { out .println(" <td class=\"nbHitsCovered\">&nbsp;" + numberOfHits + "</td>"); out .println(" <td class=\"src\"><pre class=\"src\">&nbsp;" + javaToHtml.process(lineStr) + "</pre></td>"); } else { out .println(" <td class=\"nbHitsUncovered\">&nbsp;" + numberOfHits + "</td>"); out .println(" <td class=\"src\"><pre class=\"src\"><span class=\"srcUncovered\">&nbsp;" + javaToHtml.process(lineStr) + "</span></pre></td>"); } } else { out.println(" <td class=\"numLine\">&nbsp;" + lineNumber + "</td>"); out.println(" <td class=\"nbHits\">&nbsp;</td>"); out .println(" <td class=\"src\"><pre class=\"src\">&nbsp;" + javaToHtml.process(lineStr) + "</pre></td>"); } out.println("</tr>"); lineNumber++; } } finally { if (br != null) { br.close(); } } out.println("</table>"); out.println("</p>"); out.println("<div class=\"footer\">"); out .println("Reports 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/cd01654d464661ad4ee16d9e5f0f6e799c0ad9e4/HTMLReport.java/buggy/cobertura/src/net/sourceforge/cobertura/reporting/html/HTMLReport.java
out.println(generateTableRowForClass(classData));
out.println(generateTableRowForSourceFile(sourceFileData));
private void generateSourceFile(ClassData classData) throws IOException { String filename = classData.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("<script type=\"text/javascript\" src=\"js/popup.js\"></script>"); out.println("</head>"); out.println("<body>"); out.print("<h5>Coverage Report - "); String classPackageName = classData.getPackageName(); if ((classPackageName != null) && classPackageName.length() > 0) { out.print(classData.getPackageName() + "."); } out.print(classData.getName()); out.println("</h5>"); // Output the coverage summary for this class out.println("<p>"); out.println("<table class=\"report\">"); out.println(generateTableHeaderForClasses()); out.println(generateTableRowForClass(classData)); out.println("</table>"); out.println("</p>"); // Output this class's source code with syntax and coverage highlighting out.println("<p>"); out .println("<table cellspacing=\"0\" cellpadding=\"0\" class=\"src\">"); BufferedReader br = null; try { File sourceFile = new File(sourceDir, classData .getSourceFileName()); br = new BufferedReader(new FileReader(sourceFile)); String lineStr; JavaToHtml javaToHtml = new JavaToHtml(); int lineNumber = 1; while ((lineStr = br.readLine()) != null) { out.println("<tr>"); if (classData.isValidSourceLineNumber(lineNumber)) { long numberOfHits = classData.getHitCount(lineNumber); out.println(" <td class=\"numLineCover\">&nbsp;" + lineNumber + "</td>"); if (numberOfHits > 0) { out .println(" <td class=\"nbHitsCovered\">&nbsp;" + numberOfHits + "</td>"); out .println(" <td class=\"src\"><pre class=\"src\">&nbsp;" + javaToHtml.process(lineStr) + "</pre></td>"); } else { out .println(" <td class=\"nbHitsUncovered\">&nbsp;" + numberOfHits + "</td>"); out .println(" <td class=\"src\"><pre class=\"src\"><span class=\"srcUncovered\">&nbsp;" + javaToHtml.process(lineStr) + "</span></pre></td>"); } } else { out.println(" <td class=\"numLine\">&nbsp;" + lineNumber + "</td>"); out.println(" <td class=\"nbHits\">&nbsp;</td>"); out .println(" <td class=\"src\"><pre class=\"src\">&nbsp;" + javaToHtml.process(lineStr) + "</pre></td>"); } out.println("</tr>"); lineNumber++; } } finally { if (br != null) { br.close(); } } out.println("</table>"); out.println("</p>"); out.println("<div class=\"footer\">"); out .println("Reports 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/cd01654d464661ad4ee16d9e5f0f6e799c0ad9e4/HTMLReport.java/buggy/cobertura/src/net/sourceforge/cobertura/reporting/html/HTMLReport.java
File sourceFile = new File(sourceDir, classData .getSourceFileName());
File sourceFile = new File(sourceDir, sourceFileData .getName());
private void generateSourceFile(ClassData classData) throws IOException { String filename = classData.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("<script type=\"text/javascript\" src=\"js/popup.js\"></script>"); out.println("</head>"); out.println("<body>"); out.print("<h5>Coverage Report - "); String classPackageName = classData.getPackageName(); if ((classPackageName != null) && classPackageName.length() > 0) { out.print(classData.getPackageName() + "."); } out.print(classData.getName()); out.println("</h5>"); // Output the coverage summary for this class out.println("<p>"); out.println("<table class=\"report\">"); out.println(generateTableHeaderForClasses()); out.println(generateTableRowForClass(classData)); out.println("</table>"); out.println("</p>"); // Output this class's source code with syntax and coverage highlighting out.println("<p>"); out .println("<table cellspacing=\"0\" cellpadding=\"0\" class=\"src\">"); BufferedReader br = null; try { File sourceFile = new File(sourceDir, classData .getSourceFileName()); br = new BufferedReader(new FileReader(sourceFile)); String lineStr; JavaToHtml javaToHtml = new JavaToHtml(); int lineNumber = 1; while ((lineStr = br.readLine()) != null) { out.println("<tr>"); if (classData.isValidSourceLineNumber(lineNumber)) { long numberOfHits = classData.getHitCount(lineNumber); out.println(" <td class=\"numLineCover\">&nbsp;" + lineNumber + "</td>"); if (numberOfHits > 0) { out .println(" <td class=\"nbHitsCovered\">&nbsp;" + numberOfHits + "</td>"); out .println(" <td class=\"src\"><pre class=\"src\">&nbsp;" + javaToHtml.process(lineStr) + "</pre></td>"); } else { out .println(" <td class=\"nbHitsUncovered\">&nbsp;" + numberOfHits + "</td>"); out .println(" <td class=\"src\"><pre class=\"src\"><span class=\"srcUncovered\">&nbsp;" + javaToHtml.process(lineStr) + "</span></pre></td>"); } } else { out.println(" <td class=\"numLine\">&nbsp;" + lineNumber + "</td>"); out.println(" <td class=\"nbHits\">&nbsp;</td>"); out .println(" <td class=\"src\"><pre class=\"src\">&nbsp;" + javaToHtml.process(lineStr) + "</pre></td>"); } out.println("</tr>"); lineNumber++; } } finally { if (br != null) { br.close(); } } out.println("</table>"); out.println("</p>"); out.println("<div class=\"footer\">"); out .println("Reports 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/cd01654d464661ad4ee16d9e5f0f6e799c0ad9e4/HTMLReport.java/buggy/cobertura/src/net/sourceforge/cobertura/reporting/html/HTMLReport.java
if (classData.isValidSourceLineNumber(lineNumber))
if (sourceFileData.isValidSourceLineNumber(lineNumber))
private void generateSourceFile(ClassData classData) throws IOException { String filename = classData.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("<script type=\"text/javascript\" src=\"js/popup.js\"></script>"); out.println("</head>"); out.println("<body>"); out.print("<h5>Coverage Report - "); String classPackageName = classData.getPackageName(); if ((classPackageName != null) && classPackageName.length() > 0) { out.print(classData.getPackageName() + "."); } out.print(classData.getName()); out.println("</h5>"); // Output the coverage summary for this class out.println("<p>"); out.println("<table class=\"report\">"); out.println(generateTableHeaderForClasses()); out.println(generateTableRowForClass(classData)); out.println("</table>"); out.println("</p>"); // Output this class's source code with syntax and coverage highlighting out.println("<p>"); out .println("<table cellspacing=\"0\" cellpadding=\"0\" class=\"src\">"); BufferedReader br = null; try { File sourceFile = new File(sourceDir, classData .getSourceFileName()); br = new BufferedReader(new FileReader(sourceFile)); String lineStr; JavaToHtml javaToHtml = new JavaToHtml(); int lineNumber = 1; while ((lineStr = br.readLine()) != null) { out.println("<tr>"); if (classData.isValidSourceLineNumber(lineNumber)) { long numberOfHits = classData.getHitCount(lineNumber); out.println(" <td class=\"numLineCover\">&nbsp;" + lineNumber + "</td>"); if (numberOfHits > 0) { out .println(" <td class=\"nbHitsCovered\">&nbsp;" + numberOfHits + "</td>"); out .println(" <td class=\"src\"><pre class=\"src\">&nbsp;" + javaToHtml.process(lineStr) + "</pre></td>"); } else { out .println(" <td class=\"nbHitsUncovered\">&nbsp;" + numberOfHits + "</td>"); out .println(" <td class=\"src\"><pre class=\"src\"><span class=\"srcUncovered\">&nbsp;" + javaToHtml.process(lineStr) + "</span></pre></td>"); } } else { out.println(" <td class=\"numLine\">&nbsp;" + lineNumber + "</td>"); out.println(" <td class=\"nbHits\">&nbsp;</td>"); out .println(" <td class=\"src\"><pre class=\"src\">&nbsp;" + javaToHtml.process(lineStr) + "</pre></td>"); } out.println("</tr>"); lineNumber++; } } finally { if (br != null) { br.close(); } } out.println("</table>"); out.println("</p>"); out.println("<div class=\"footer\">"); out .println("Reports 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/cd01654d464661ad4ee16d9e5f0f6e799c0ad9e4/HTMLReport.java/buggy/cobertura/src/net/sourceforge/cobertura/reporting/html/HTMLReport.java
long numberOfHits = classData.getHitCount(lineNumber);
long numberOfHits = sourceFileData .getHitCount(lineNumber);
private void generateSourceFile(ClassData classData) throws IOException { String filename = classData.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("<script type=\"text/javascript\" src=\"js/popup.js\"></script>"); out.println("</head>"); out.println("<body>"); out.print("<h5>Coverage Report - "); String classPackageName = classData.getPackageName(); if ((classPackageName != null) && classPackageName.length() > 0) { out.print(classData.getPackageName() + "."); } out.print(classData.getName()); out.println("</h5>"); // Output the coverage summary for this class out.println("<p>"); out.println("<table class=\"report\">"); out.println(generateTableHeaderForClasses()); out.println(generateTableRowForClass(classData)); out.println("</table>"); out.println("</p>"); // Output this class's source code with syntax and coverage highlighting out.println("<p>"); out .println("<table cellspacing=\"0\" cellpadding=\"0\" class=\"src\">"); BufferedReader br = null; try { File sourceFile = new File(sourceDir, classData .getSourceFileName()); br = new BufferedReader(new FileReader(sourceFile)); String lineStr; JavaToHtml javaToHtml = new JavaToHtml(); int lineNumber = 1; while ((lineStr = br.readLine()) != null) { out.println("<tr>"); if (classData.isValidSourceLineNumber(lineNumber)) { long numberOfHits = classData.getHitCount(lineNumber); out.println(" <td class=\"numLineCover\">&nbsp;" + lineNumber + "</td>"); if (numberOfHits > 0) { out .println(" <td class=\"nbHitsCovered\">&nbsp;" + numberOfHits + "</td>"); out .println(" <td class=\"src\"><pre class=\"src\">&nbsp;" + javaToHtml.process(lineStr) + "</pre></td>"); } else { out .println(" <td class=\"nbHitsUncovered\">&nbsp;" + numberOfHits + "</td>"); out .println(" <td class=\"src\"><pre class=\"src\"><span class=\"srcUncovered\">&nbsp;" + javaToHtml.process(lineStr) + "</span></pre></td>"); } } else { out.println(" <td class=\"numLine\">&nbsp;" + lineNumber + "</td>"); out.println(" <td class=\"nbHits\">&nbsp;</td>"); out .println(" <td class=\"src\"><pre class=\"src\">&nbsp;" + javaToHtml.process(lineStr) + "</pre></td>"); } out.println("</tr>"); lineNumber++; } } finally { if (br != null) { br.close(); } } out.println("</table>"); out.println("</p>"); out.println("<div class=\"footer\">"); out .println("Reports 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/cd01654d464661ad4ee16d9e5f0f6e799c0ad9e4/HTMLReport.java/buggy/cobertura/src/net/sourceforge/cobertura/reporting/html/HTMLReport.java
Iterator iter = projectData.getClasses().iterator();
Iterator iter = projectData.getSourceFiles().iterator();
private void generateSourceFiles() { Iterator iter = projectData.getClasses().iterator(); while (iter.hasNext()) { ClassData classData = (ClassData)iter.next(); try { generateSourceFile(classData); } catch (Exception e) { logger.info("Could not generate HTML file for class " + classData.getName()); } } }
50197 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50197/cd01654d464661ad4ee16d9e5f0f6e799c0ad9e4/HTMLReport.java/buggy/cobertura/src/net/sourceforge/cobertura/reporting/html/HTMLReport.java
ClassData classData = (ClassData)iter.next();
SourceFileData sourceFileData = (SourceFileData)iter.next();
private void generateSourceFiles() { Iterator iter = projectData.getClasses().iterator(); while (iter.hasNext()) { ClassData classData = (ClassData)iter.next(); try { generateSourceFile(classData); } catch (Exception e) { logger.info("Could not generate HTML file for class " + classData.getName()); } } }
50197 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50197/cd01654d464661ad4ee16d9e5f0f6e799c0ad9e4/HTMLReport.java/buggy/cobertura/src/net/sourceforge/cobertura/reporting/html/HTMLReport.java
generateSourceFile(classData);
generateSourceFile(sourceFileData);
private void generateSourceFiles() { Iterator iter = projectData.getClasses().iterator(); while (iter.hasNext()) { ClassData classData = (ClassData)iter.next(); try { generateSourceFile(classData); } catch (Exception e) { logger.info("Could not generate HTML file for class " + classData.getName()); } } }
50197 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50197/cd01654d464661ad4ee16d9e5f0f6e799c0ad9e4/HTMLReport.java/buggy/cobertura/src/net/sourceforge/cobertura/reporting/html/HTMLReport.java
logger.info("Could not generate HTML file for class " + classData.getName());
logger.info("Could not generate HTML file for source file " + sourceFileData.getName());
private void generateSourceFiles() { Iterator iter = projectData.getClasses().iterator(); while (iter.hasNext()) { ClassData classData = (ClassData)iter.next(); try { generateSourceFile(classData); } catch (Exception e) { logger.info("Could not generate HTML file for class " + classData.getName()); } } }
50197 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50197/cd01654d464661ad4ee16d9e5f0f6e799c0ad9e4/HTMLReport.java/buggy/cobertura/src/net/sourceforge/cobertura/reporting/html/HTMLReport.java
String url2 = "frame-classes-" + packageData.getName() + ".html";
String url2 = "frame-sourcefiles-" + packageData.getName() + ".html";
private String generateTableRowForPackage(PackageData packageData) { StringBuffer ret = new StringBuffer(); String url1 = "frame-summary-" + packageData.getName() + ".html"; String url2 = "frame-classes-" + packageData.getName() + ".html"; double lineCoverage = -1; double branchCoverage = -1; double ccn = Util.getCCN(new File(sourceDir, packageData .getSourceFileName()), false); if (packageData.getNumberOfValidLines() > 0) lineCoverage = packageData.getLineCoverageRate(); if (packageData.getNumberOfValidBranches() > 0) branchCoverage = packageData.getBranchCoverageRate(); ret.append(" <tr>"); ret.append("<td class=\"text\"><a href=\"" + url1 + "\" onClick='parent.classList.location.href=\"" + url2 + "\"'>" + generatePackageName(packageData) + "</a></td>"); ret.append("<td class=\"value\">" + packageData.getChildren().size() + "</td>"); ret.append(generateTableColumnsFromData(lineCoverage, branchCoverage, ccn)); ret.append("</tr>"); return ret.toString(); }
50197 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50197/cd01654d464661ad4ee16d9e5f0f6e799c0ad9e4/HTMLReport.java/buggy/cobertura/src/net/sourceforge/cobertura/reporting/html/HTMLReport.java
+ "\" onClick='parent.classList.location.href=\"" + url2
+ "\" onClick='parent.sourceFileList.location.href=\"" + url2
private String generateTableRowForPackage(PackageData packageData) { StringBuffer ret = new StringBuffer(); String url1 = "frame-summary-" + packageData.getName() + ".html"; String url2 = "frame-classes-" + packageData.getName() + ".html"; double lineCoverage = -1; double branchCoverage = -1; double ccn = Util.getCCN(new File(sourceDir, packageData .getSourceFileName()), false); if (packageData.getNumberOfValidLines() > 0) lineCoverage = packageData.getLineCoverageRate(); if (packageData.getNumberOfValidBranches() > 0) branchCoverage = packageData.getBranchCoverageRate(); ret.append(" <tr>"); ret.append("<td class=\"text\"><a href=\"" + url1 + "\" onClick='parent.classList.location.href=\"" + url2 + "\"'>" + generatePackageName(packageData) + "</a></td>"); ret.append("<td class=\"value\">" + packageData.getChildren().size() + "</td>"); ret.append(generateTableColumnsFromData(lineCoverage, branchCoverage, ccn)); ret.append("</tr>"); return ret.toString(); }
50197 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50197/cd01654d464661ad4ee16d9e5f0f6e799c0ad9e4/HTMLReport.java/buggy/cobertura/src/net/sourceforge/cobertura/reporting/html/HTMLReport.java
Collection result = new ArrayList(children.size() * 15); for (Iterator it = children.values().iterator(); it.hasNext(); ) { PackageData packageData = (PackageData) it.next(); result.addAll(packageData.getChildren()); } return result;
return this.classes.values();
public Collection getClasses() { Collection result = new ArrayList(children.size() * 15); // just an approximation, no science here for (Iterator it = children.values().iterator(); it.hasNext(); ) { PackageData packageData = (PackageData) it.next(); result.addAll(packageData.getChildren()); } return result; }
50197 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50197/2d04adc2554406c41824d5b965907076ecdceb80/ProjectData.java/buggy/cobertura/src/net/sourceforge/cobertura/coveragedata/ProjectData.java
pack(); }
}
public DataManagerUIF(DataManagerCtrl control, Registry registry) { super("Data Manager", registry.getTaskBar()); this.registry = registry; this.control = control; im = IconManager.getInstance(registry); explPane = new ExplorerPane(control, registry); popupMenu = new TreePopupMenu(control, registry); classifierPopupMenu = new ClassifierPopupMenu(control, registry); imgPane = new ImagesPane(control, registry); classifierPane = new ClassifierPane(control, registry); buildGUI(new ToolBar(control, registry)); pack(); }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/cf83d7e74fdf42d9c4357c3e575c08395991a878/DataManagerUIF.java/buggy/SRC/org/openmicroscopy/shoola/agents/datamng/DataManagerUIF.java
public ImageDimension(Integer attributeId, Float pixelSizeC, Float pixelSizeT, Float pixelSizeX, Float pixelSizeY, Float pixelSizeZ, org.openmicroscopy.omero.model.Image image, org.openmicroscopy.omero.model.ModuleExecution moduleExecution) { this.attributeId = attributeId; this.pixelSizeC = pixelSizeC; this.pixelSizeT = pixelSizeT; this.pixelSizeX = pixelSizeX; this.pixelSizeY = pixelSizeY; this.pixelSizeZ = pixelSizeZ; this.image = image; this.moduleExecution = moduleExecution;
public ImageDimension() {
public ImageDimension(Integer attributeId, Float pixelSizeC, Float pixelSizeT, Float pixelSizeX, Float pixelSizeY, Float pixelSizeZ, org.openmicroscopy.omero.model.Image image, org.openmicroscopy.omero.model.ModuleExecution moduleExecution) { this.attributeId = attributeId; this.pixelSizeC = pixelSizeC; this.pixelSizeT = pixelSizeT; this.pixelSizeX = pixelSizeX; this.pixelSizeY = pixelSizeY; this.pixelSizeZ = pixelSizeZ; this.image = image; this.moduleExecution = moduleExecution; }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/9570ef74198a070d72e77c417c9d25244a942de2/ImageDimension.java/clean/components/common/src/org/openmicroscopy/omero/model/ImageDimension.java
public org.openmicroscopy.omero.model.Image getImage() {
public Image getImage() {
public org.openmicroscopy.omero.model.Image getImage() { return this.image; }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/9570ef74198a070d72e77c417c9d25244a942de2/ImageDimension.java/clean/components/common/src/org/openmicroscopy/omero/model/ImageDimension.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/ImageDimension.java/clean/components/common/src/org/openmicroscopy/omero/model/ImageDimension.java
public void setImage(org.openmicroscopy.omero.model.Image image) {
public void setImage(Image image) {
public void setImage(org.openmicroscopy.omero.model.Image image) { this.image = image; }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/9570ef74198a070d72e77c417c9d25244a942de2/ImageDimension.java/clean/components/common/src/org/openmicroscopy/omero/model/ImageDimension.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/ImageDimension.java/clean/components/common/src/org/openmicroscopy/omero/model/ImageDimension.java
private void addInstrumentation(File file)
private void addInstrumentation(File baseDir, String filename)
private void addInstrumentation(File file) { if (isClass(file)) { addInstrumentationToSingleClass(file); } else if (file.isDirectory()) { File[] contents = file.listFiles(); for (int i = 0; i < contents.length; i++) addInstrumentation(contents[i]); } else if (isArchive(file)) { addInstrumentationToArchive(file); } }
50197 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50197/8d76b07e3d230fcd0d3b233e7ffc80df6ca3ec82/Main.java/buggy/cobertura/src/net/sourceforge/cobertura/instrument/Main.java
if (isClass(file)) { addInstrumentationToSingleClass(file); } else if (file.isDirectory()) { File[] contents = file.listFiles(); for (int i = 0; i < contents.length; i++) addInstrumentation(contents[i]); } else if (isArchive(file)) { addInstrumentationToArchive(file); }
logger.debug("filename: " + filename); File file; if (baseDir == null) file = new File(filename); else file = new File(baseDir, filename); addInstrumentation(file);
private void addInstrumentation(File file) { if (isClass(file)) { addInstrumentationToSingleClass(file); } else if (file.isDirectory()) { File[] contents = file.listFiles(); for (int i = 0; i < contents.length; i++) addInstrumentation(contents[i]); } else if (isArchive(file)) { addInstrumentationToArchive(file); } }
50197 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50197/8d76b07e3d230fcd0d3b233e7ffc80df6ca3ec82/Main.java/buggy/cobertura/src/net/sourceforge/cobertura/instrument/Main.java
private void addInstrumentationToArchive(ZipInputStream archive, ZipOutputStream output) throws Exception
private void addInstrumentationToArchive(File archive)
private void addInstrumentationToArchive(ZipInputStream archive, ZipOutputStream output) throws Exception { ZipEntry entry; while ((entry = archive.getNextEntry()) != null) { try { ZipEntry outputEntry = new ZipEntry(entry.getName()); output.putNextEntry(outputEntry); // Read current entry byte[] entryBytes = IOUtil .createByteArrayFromInputStream(archive); // Check if we have class file if (isClass(entry)) { // Instrument class ClassReader cr = new ClassReader(entryBytes); ClassWriter cw = new ClassWriter(true); ClassInstrumenter cv = new ClassInstrumenter(projectData, cw, ignoreRegex); cr.accept(cv, false); // If class was instrumented, get bytes that define the // class if (cv.isInstrumented()) { logger.debug("Putting instrumeted entry: " + entry.getName()); entryBytes = cw.toByteArray(); } } // Add entry to the output output.write(entryBytes); output.closeEntry(); archive.closeEntry(); } catch (Exception e) { logger.warn("Problems with archive entry: " + entry); throw e; } output.flush(); } }
50197 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50197/8d76b07e3d230fcd0d3b233e7ffc80df6ca3ec82/Main.java/buggy/cobertura/src/net/sourceforge/cobertura/instrument/Main.java
ZipEntry entry; while ((entry = archive.getNextEntry()) != null)
logger.debug("Instrumenting archive " + archive.getAbsolutePath()); File outputFile = null; ZipInputStream input = null; ZipOutputStream output = null; try { try { input = new ZipInputStream(new FileInputStream(archive)); } catch (FileNotFoundException e) { logger.warn("Cannot open archive file: " + archive.getAbsolutePath(), e); return; } try { if (destinationDirectory != null) { outputFile = new File(destinationDirectory, archive .getName()); } else { outputFile = File.createTempFile( "CoberturaInstrumentedArchive", "jar"); outputFile.deleteOnExit(); } output = new ZipOutputStream(new FileOutputStream(outputFile)); } catch (IOException e) { logger.warn("Cannot open file for instrumented archive: " + archive.getAbsolutePath(), e); return; } try { addInstrumentationToArchive(input, output); } catch (Exception e) { logger.warn("Cannot instrument archive: " + archive.getAbsolutePath(), e); return; } } finally { if (input != null) { try { input.close(); } catch (IOException e) { } } if (output != null) { try { output.close(); } catch (IOException e) { } } } if (destinationDirectory == null)
private void addInstrumentationToArchive(ZipInputStream archive, ZipOutputStream output) throws Exception { ZipEntry entry; while ((entry = archive.getNextEntry()) != null) { try { ZipEntry outputEntry = new ZipEntry(entry.getName()); output.putNextEntry(outputEntry); // Read current entry byte[] entryBytes = IOUtil .createByteArrayFromInputStream(archive); // Check if we have class file if (isClass(entry)) { // Instrument class ClassReader cr = new ClassReader(entryBytes); ClassWriter cw = new ClassWriter(true); ClassInstrumenter cv = new ClassInstrumenter(projectData, cw, ignoreRegex); cr.accept(cv, false); // If class was instrumented, get bytes that define the // class if (cv.isInstrumented()) { logger.debug("Putting instrumeted entry: " + entry.getName()); entryBytes = cw.toByteArray(); } } // Add entry to the output output.write(entryBytes); output.closeEntry(); archive.closeEntry(); } catch (Exception e) { logger.warn("Problems with archive entry: " + entry); throw e; } output.flush(); } }
50197 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50197/8d76b07e3d230fcd0d3b233e7ffc80df6ca3ec82/Main.java/buggy/cobertura/src/net/sourceforge/cobertura/instrument/Main.java
ZipEntry outputEntry = new ZipEntry(entry.getName()); output.putNextEntry(outputEntry); byte[] entryBytes = IOUtil .createByteArrayFromInputStream(archive); if (isClass(entry)) { ClassReader cr = new ClassReader(entryBytes); ClassWriter cw = new ClassWriter(true); ClassInstrumenter cv = new ClassInstrumenter(projectData, cw, ignoreRegex); cr.accept(cv, false); if (cv.isInstrumented()) { logger.debug("Putting instrumeted entry: " + entry.getName()); entryBytes = cw.toByteArray(); } } output.write(entryBytes); output.closeEntry(); archive.closeEntry();
IOUtil.moveFile(outputFile, archive);
private void addInstrumentationToArchive(ZipInputStream archive, ZipOutputStream output) throws Exception { ZipEntry entry; while ((entry = archive.getNextEntry()) != null) { try { ZipEntry outputEntry = new ZipEntry(entry.getName()); output.putNextEntry(outputEntry); // Read current entry byte[] entryBytes = IOUtil .createByteArrayFromInputStream(archive); // Check if we have class file if (isClass(entry)) { // Instrument class ClassReader cr = new ClassReader(entryBytes); ClassWriter cw = new ClassWriter(true); ClassInstrumenter cv = new ClassInstrumenter(projectData, cw, ignoreRegex); cr.accept(cv, false); // If class was instrumented, get bytes that define the // class if (cv.isInstrumented()) { logger.debug("Putting instrumeted entry: " + entry.getName()); entryBytes = cw.toByteArray(); } } // Add entry to the output output.write(entryBytes); output.closeEntry(); archive.closeEntry(); } catch (Exception e) { logger.warn("Problems with archive entry: " + entry); throw e; } output.flush(); } }
50197 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50197/8d76b07e3d230fcd0d3b233e7ffc80df6ca3ec82/Main.java/buggy/cobertura/src/net/sourceforge/cobertura/instrument/Main.java
catch (Exception e)
catch (IOException e)
private void addInstrumentationToArchive(ZipInputStream archive, ZipOutputStream output) throws Exception { ZipEntry entry; while ((entry = archive.getNextEntry()) != null) { try { ZipEntry outputEntry = new ZipEntry(entry.getName()); output.putNextEntry(outputEntry); // Read current entry byte[] entryBytes = IOUtil .createByteArrayFromInputStream(archive); // Check if we have class file if (isClass(entry)) { // Instrument class ClassReader cr = new ClassReader(entryBytes); ClassWriter cw = new ClassWriter(true); ClassInstrumenter cv = new ClassInstrumenter(projectData, cw, ignoreRegex); cr.accept(cv, false); // If class was instrumented, get bytes that define the // class if (cv.isInstrumented()) { logger.debug("Putting instrumeted entry: " + entry.getName()); entryBytes = cw.toByteArray(); } } // Add entry to the output output.write(entryBytes); output.closeEntry(); archive.closeEntry(); } catch (Exception e) { logger.warn("Problems with archive entry: " + entry); throw e; } output.flush(); } }
50197 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50197/8d76b07e3d230fcd0d3b233e7ffc80df6ca3ec82/Main.java/buggy/cobertura/src/net/sourceforge/cobertura/instrument/Main.java
logger.warn("Problems with archive entry: " + entry); throw e;
logger.warn("Cannot instrument archive: " + archive.getAbsolutePath(), e); return;
private void addInstrumentationToArchive(ZipInputStream archive, ZipOutputStream output) throws Exception { ZipEntry entry; while ((entry = archive.getNextEntry()) != null) { try { ZipEntry outputEntry = new ZipEntry(entry.getName()); output.putNextEntry(outputEntry); // Read current entry byte[] entryBytes = IOUtil .createByteArrayFromInputStream(archive); // Check if we have class file if (isClass(entry)) { // Instrument class ClassReader cr = new ClassReader(entryBytes); ClassWriter cw = new ClassWriter(true); ClassInstrumenter cv = new ClassInstrumenter(projectData, cw, ignoreRegex); cr.accept(cv, false); // If class was instrumented, get bytes that define the // class if (cv.isInstrumented()) { logger.debug("Putting instrumeted entry: " + entry.getName()); entryBytes = cw.toByteArray(); } } // Add entry to the output output.write(entryBytes); output.closeEntry(); archive.closeEntry(); } catch (Exception e) { logger.warn("Problems with archive entry: " + entry); throw e; } output.flush(); } }
50197 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50197/8d76b07e3d230fcd0d3b233e7ffc80df6ca3ec82/Main.java/buggy/cobertura/src/net/sourceforge/cobertura/instrument/Main.java
output.flush();
private void addInstrumentationToArchive(ZipInputStream archive, ZipOutputStream output) throws Exception { ZipEntry entry; while ((entry = archive.getNextEntry()) != null) { try { ZipEntry outputEntry = new ZipEntry(entry.getName()); output.putNextEntry(outputEntry); // Read current entry byte[] entryBytes = IOUtil .createByteArrayFromInputStream(archive); // Check if we have class file if (isClass(entry)) { // Instrument class ClassReader cr = new ClassReader(entryBytes); ClassWriter cw = new ClassWriter(true); ClassInstrumenter cv = new ClassInstrumenter(projectData, cw, ignoreRegex); cr.accept(cv, false); // If class was instrumented, get bytes that define the // class if (cv.isInstrumented()) { logger.debug("Putting instrumeted entry: " + entry.getName()); entryBytes = cw.toByteArray(); } } // Add entry to the output output.write(entryBytes); output.closeEntry(); archive.closeEntry(); } catch (Exception e) { logger.warn("Problems with archive entry: " + entry); throw e; } output.flush(); } }
50197 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50197/8d76b07e3d230fcd0d3b233e7ffc80df6ca3ec82/Main.java/buggy/cobertura/src/net/sourceforge/cobertura/instrument/Main.java
cv = new ClassInstrumenter(projectData, cw, ignoreRegex);
cv = new ClassInstrumenter(this.projectData, cw, this.ignoreRegexs);
private void addInstrumentationToSingleClass(File file) { logger.debug("Instrumenting class " + file.getAbsolutePath()); InputStream inputStream = null; ClassWriter cw; ClassInstrumenter cv; try { inputStream = new FileInputStream(file); ClassReader cr = new ClassReader(inputStream); cw = new ClassWriter(true); cv = new ClassInstrumenter(projectData, cw, ignoreRegex); cr.accept(cv, false); } catch (Throwable t) { logger.warn("Unable to instrument file " + file.getAbsolutePath(), t); return; } finally { if (inputStream != null) { try { inputStream.close(); } catch (IOException e) { } } } OutputStream outputStream = null; try { if (cv.isInstrumented()) { // If destinationDirectory is null, then overwrite // the original, uninstrumented file. File outputFile; if (destinationDirectory == null) outputFile = file; else outputFile = new File(destinationDirectory, cv .getClassName().replace('.', File.separatorChar) + ".class"); File parentFile = outputFile.getParentFile(); if (parentFile != null) { parentFile.mkdirs(); } byte[] instrumentedClass = cw.toByteArray(); outputStream = new FileOutputStream(outputFile); outputStream.write(instrumentedClass); } } catch (IOException e) { logger.warn("Unable to instrument file " + file.getAbsolutePath(), e); return; } finally { if (outputStream != null) { try { outputStream.close(); } catch (IOException e) { } } } }
50197 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50197/8d76b07e3d230fcd0d3b233e7ffc80df6ca3ec82/Main.java/buggy/cobertura/src/net/sourceforge/cobertura/instrument/Main.java
Main main = new Main();
public static void main(String[] args) { long startTime = System.currentTimeMillis(); Main main = new Main(); boolean hasCommandsFile = false; String commandsFileName = null; for (int i = 0; i < args.length; i++) { if (args[i].equals("--commandsfile")) { hasCommandsFile = true; commandsFileName = args[++i]; } } if (hasCommandsFile) { List arglist = new ArrayList(); BufferedReader bufferedReader = null; try { bufferedReader = new BufferedReader(new FileReader( commandsFileName)); String line; while ((line = bufferedReader.readLine()) != null) arglist.add(line); } catch (IOException e) { logger.fatal("Unable to read temporary commands file " + commandsFileName + "."); logger.info(e); } finally { if (bufferedReader != null) { try { bufferedReader.close(); } catch (IOException e) { } } } args = (String[])arglist.toArray(new String[arglist.size()]); } main.parseArguments(args); long stopTime = System.currentTimeMillis(); System.out.println("Instrument time: " + (stopTime - startTime) + "ms"); }
50197 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50197/8d76b07e3d230fcd0d3b233e7ffc80df6ca3ec82/Main.java/buggy/cobertura/src/net/sourceforge/cobertura/instrument/Main.java
main.parseArguments(args);
new Main(args);
public static void main(String[] args) { long startTime = System.currentTimeMillis(); Main main = new Main(); boolean hasCommandsFile = false; String commandsFileName = null; for (int i = 0; i < args.length; i++) { if (args[i].equals("--commandsfile")) { hasCommandsFile = true; commandsFileName = args[++i]; } } if (hasCommandsFile) { List arglist = new ArrayList(); BufferedReader bufferedReader = null; try { bufferedReader = new BufferedReader(new FileReader( commandsFileName)); String line; while ((line = bufferedReader.readLine()) != null) arglist.add(line); } catch (IOException e) { logger.fatal("Unable to read temporary commands file " + commandsFileName + "."); logger.info(e); } finally { if (bufferedReader != null) { try { bufferedReader.close(); } catch (IOException e) { } } } args = (String[])arglist.toArray(new String[arglist.size()]); } main.parseArguments(args); long stopTime = System.currentTimeMillis(); System.out.println("Instrument time: " + (stopTime - startTime) + "ms"); }
50197 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50197/8d76b07e3d230fcd0d3b233e7ffc80df6ca3ec82/Main.java/buggy/cobertura/src/net/sourceforge/cobertura/instrument/Main.java
charWidth = getFontMetrics(getFont()).charWidth('m');
BrowserCanvas(BrowserModel model, BrowserUI view) { if (model == null) throw new NullPointerException("No model."); if (view == null) throw new NullPointerException("No view."); this.model = model; this.view = view; charWidth = getFontMetrics(getFont()).charWidth('m'); setDoubleBuffered(true); }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/cdaae4674bb262e43b643e36193cc75af1d00eb5/BrowserCanvas.java/buggy/SRC/org/openmicroscopy/shoola/agents/imviewer/browser/BrowserCanvas.java
if (Math.ceil(v) == c) value = ""+(int) c; else value = ""+c;
if ((c-Math.floor(c)) > 0) value = ""+Math.round(c*100)/100f; else value = ""+(int) c;
public void paintComponent(Graphics g) { super.paintComponent(g); Graphics2D g2D = (Graphics2D) g; g2D.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g2D.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY); g2D.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR); BufferedImage img = model.getDisplayedImage(); if (img == null) return; //paintXYFrame(g2D); g2D.drawImage(img, null, 0, 0); double v = model.getPixelsSizeX()/model.getZoomFactor(); v *= model.getUnitBarSize(); String value; double c = v; if (Math.ceil(v) == c) value = ""+(int) c; else value = ""+c; int size = (int) model.getUnitBarSize(); if (v > 0 && model.isUnitBar()) { paintScaleBar(g2D, img.getWidth()-size-5, img.getHeight()-10, size, value); } }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/cdaae4674bb262e43b643e36193cc75af1d00eb5/BrowserCanvas.java/buggy/SRC/org/openmicroscopy/shoola/agents/imviewer/browser/BrowserCanvas.java
paintScaleBar(g2D, img.getWidth()-size-5,
paintScaleBar(g2D, img.getWidth()-size-10,
public void paintComponent(Graphics g) { super.paintComponent(g); Graphics2D g2D = (Graphics2D) g; g2D.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g2D.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY); g2D.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR); BufferedImage img = model.getDisplayedImage(); if (img == null) return; //paintXYFrame(g2D); g2D.drawImage(img, null, 0, 0); double v = model.getPixelsSizeX()/model.getZoomFactor(); v *= model.getUnitBarSize(); String value; double c = v; if (Math.ceil(v) == c) value = ""+(int) c; else value = ""+c; int size = (int) model.getUnitBarSize(); if (v > 0 && model.isUnitBar()) { paintScaleBar(g2D, img.getWidth()-size-5, img.getHeight()-10, size, value); } }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/cdaae4674bb262e43b643e36193cc75af1d00eb5/BrowserCanvas.java/buggy/SRC/org/openmicroscopy/shoola/agents/imviewer/browser/BrowserCanvas.java
} else { System.out.println( "The block was passed to the thread constructor");
protected static RubyThread startThread( final Ruby ruby, RubyObject recv, final RubyObject[] args, boolean callInit) { if (!ruby.isBlockGiven()) { System.out.println("No block given to thread!"); } else { System.out.println( "The block was passed to the thread constructor"); } RubyThread result = new RubyThread(ruby, (RubyClass) recv); if (callInit) { result.callInit(args); } final RubyProc proc = RubyProc.newProc(ruby, ruby.getClasses().getProcClass()); //result.jvmThread = new Thread(result.new RubyThreadRunner(ruby, args)); result.jvmThread = new Thread(new Runnable() { public void run() { if (ruby.isBlockGiven()) { System.out.println("THE BLOCK HAS PROPOGATED!"); /* ruby.yield( RubyArray.newArray( ruby, new ArrayList(Arrays.asList(args)))); */ proc.call(args); } else { System.out.println("The block did not propogate"); } } }); result.threads.put(result.jvmThread, result); result.locals = new HashMap(); result.jvmThread.start(); return result; }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/8db42974495981011f558bcce15e2dfc28681a76/RubyThread.java/clean/org/jruby/RubyThread.java
if (ruby.isBlockGiven()) { System.out.println("THE BLOCK HAS PROPOGATED!");
ruby.getFrameStack().push(currentFrame); ruby.getBlockStack().setCurrent(currentBlock);
protected static RubyThread startThread( final Ruby ruby, RubyObject recv, final RubyObject[] args, boolean callInit) { if (!ruby.isBlockGiven()) { System.out.println("No block given to thread!"); } else { System.out.println( "The block was passed to the thread constructor"); } RubyThread result = new RubyThread(ruby, (RubyClass) recv); if (callInit) { result.callInit(args); } final RubyProc proc = RubyProc.newProc(ruby, ruby.getClasses().getProcClass()); //result.jvmThread = new Thread(result.new RubyThreadRunner(ruby, args)); result.jvmThread = new Thread(new Runnable() { public void run() { if (ruby.isBlockGiven()) { System.out.println("THE BLOCK HAS PROPOGATED!"); /* ruby.yield( RubyArray.newArray( ruby, new ArrayList(Arrays.asList(args)))); */ proc.call(args); } else { System.out.println("The block did not propogate"); } } }); result.threads.put(result.jvmThread, result); result.locals = new HashMap(); result.jvmThread.start(); return result; }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/8db42974495981011f558bcce15e2dfc28681a76/RubyThread.java/clean/org/jruby/RubyThread.java
/* ruby.yield( RubyArray.newArray( ruby, new ArrayList(Arrays.asList(args)))); */ proc.call(args); } else { System.out.println("The block did not propogate"); }
proc.call(args);
protected static RubyThread startThread( final Ruby ruby, RubyObject recv, final RubyObject[] args, boolean callInit) { if (!ruby.isBlockGiven()) { System.out.println("No block given to thread!"); } else { System.out.println( "The block was passed to the thread constructor"); } RubyThread result = new RubyThread(ruby, (RubyClass) recv); if (callInit) { result.callInit(args); } final RubyProc proc = RubyProc.newProc(ruby, ruby.getClasses().getProcClass()); //result.jvmThread = new Thread(result.new RubyThreadRunner(ruby, args)); result.jvmThread = new Thread(new Runnable() { public void run() { if (ruby.isBlockGiven()) { System.out.println("THE BLOCK HAS PROPOGATED!"); /* ruby.yield( RubyArray.newArray( ruby, new ArrayList(Arrays.asList(args)))); */ proc.call(args); } else { System.out.println("The block did not propogate"); } } }); result.threads.put(result.jvmThread, result); result.locals = new HashMap(); result.jvmThread.start(); return result; }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/8db42974495981011f558bcce15e2dfc28681a76/RubyThread.java/clean/org/jruby/RubyThread.java
if (ruby.isBlockGiven()) { System.out.println("THE BLOCK HAS PROPOGATED!");
ruby.getFrameStack().push(currentFrame); ruby.getBlockStack().setCurrent(currentBlock);
public void run() { if (ruby.isBlockGiven()) { System.out.println("THE BLOCK HAS PROPOGATED!"); /* ruby.yield( RubyArray.newArray( ruby, new ArrayList(Arrays.asList(args)))); */ proc.call(args); } else { System.out.println("The block did not propogate"); } }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/8db42974495981011f558bcce15e2dfc28681a76/RubyThread.java/clean/org/jruby/RubyThread.java
/* ruby.yield( RubyArray.newArray( ruby, new ArrayList(Arrays.asList(args)))); */ proc.call(args); } else { System.out.println("The block did not propogate"); }
proc.call(args);
public void run() { if (ruby.isBlockGiven()) { System.out.println("THE BLOCK HAS PROPOGATED!"); /* ruby.yield( RubyArray.newArray( ruby, new ArrayList(Arrays.asList(args)))); */ proc.call(args); } else { System.out.println("The block did not propogate"); } }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/8db42974495981011f558bcce15e2dfc28681a76/RubyThread.java/clean/org/jruby/RubyThread.java
setSortable(true);
public RoomList() { super(new String[]{" ", "Name", "Address", "Occupants"}); getColumnModel().setColumnMargin(0); getColumnModel().getColumn(0).setMaxWidth(30); getColumnModel().getColumn(3).setMaxWidth(80); setSelectionBackground(Table.SELECTION_COLOR); setSelectionMode(ListSelectionModel.SINGLE_SELECTION); setRowSelectionAllowed(true); setSortable(true); addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent e) { if (e.getClickCount() == 2) { enterRoom(); } } public void mouseReleased(MouseEvent e) { checkPopup(e); } public void mousePressed(MouseEvent e) { checkPopup(e); } }); }
52006 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/52006/712fdfb49afeea632e6ad9f6cbcce5827d978676/ConferenceRooms.java/clean/src/java/org/jivesoftware/spark/ui/conferences/ConferenceRooms.java
password = passwordDialog.getPassword("Password Required", "This group chat room requires a password to enter.", SparkRes.getImageIcon(SparkRes.LOCK_16x16), SparkManager.getMainWindow());
password = passwordDialog.getPassword("Password Required", "This group chat room requires a password to enter.", SparkRes.getImageIcon(SparkRes.LOCK_16x16), SparkManager.getFocusedComponent());
public static void autoJoinConferenceRoom(final String roomName, String roomJID, String password) { ChatManager chatManager = SparkManager.getChatManager(); final MultiUserChat groupChat = new MultiUserChat(SparkManager.getConnection(), roomJID); LocalPreferences pref = SettingsManager.getLocalPreferences(); final String nickname = pref.getNickname().trim(); try { GroupChatRoom chatRoom = (GroupChatRoom)chatManager.getChatContainer().getChatRoom(roomJID); MultiUserChat muc = chatRoom.getMultiUserChat(); if (!muc.isJoined()) { joinRoom(muc, nickname, password); } chatManager.getChatContainer().activateChatRoom(chatRoom); return; } catch (ChatRoomNotFoundException e) { } final GroupChatRoom room = new GroupChatRoom(groupChat); room.setTabTitle(roomName); if (requiresPassword(roomJID) && password == null) { final PasswordDialog passwordDialog = new PasswordDialog(); password = passwordDialog.getPassword("Password Required", "This group chat room requires a password to enter.", SparkRes.getImageIcon(SparkRes.LOCK_16x16), SparkManager.getMainWindow()); if (!ModelUtil.hasLength(password)) { return; } } final List errors = new ArrayList(); final String userPassword = password; final SwingWorker startChat = new SwingWorker() { public Object construct() { if (!groupChat.isJoined()) { int groupChatCounter = 0; while (true) { groupChatCounter++; String joinName = nickname; if (groupChatCounter > 1) { joinName = joinName + groupChatCounter; } if (groupChatCounter < 10) { try { if (ModelUtil.hasLength(userPassword)) { groupChat.join(joinName, userPassword); } else { groupChat.join(joinName); } break; } catch (XMPPException ex) { int code = 0; if (ex.getXMPPError() != null) { code = ex.getXMPPError().getCode(); } if (code == 0) { errors.add("No response from server."); } else if (code == 401) { errors.add("The password did not match the rooms password."); } else if (code == 403) { errors.add("You have been banned from this room."); } else if (code == 404) { errors.add("The room you are trying to enter does not exist."); } else if (code == 407) { errors.add("You are not a member of this room.\nThis room requires you to be a member to join."); } else if (code != 409) { break; } } } else { break; } } } return "ok"; } public void finished() { if (errors.size() > 0) { String error = (String)errors.get(0); JOptionPane.showMessageDialog(SparkManager.getMainWindow(), error, "Unable to join the room at this time.", JOptionPane.ERROR_MESSAGE); return; } else if (groupChat.isJoined()) { ChatManager chatManager = SparkManager.getChatManager(); chatManager.getChatContainer().addChatRoom(room); chatManager.getChatContainer().activateChatRoom(room); } else { JOptionPane.showMessageDialog(SparkManager.getMainWindow(), "Unable to join the room.", "Error", JOptionPane.ERROR_MESSAGE); return; } } }; startChat.start(); }
52006 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/52006/028cde13fc23ea5cbdaa0191963cf1624ef656d0/ConferenceUtils.java/buggy/src/java/org/jivesoftware/spark/ui/conferences/ConferenceUtils.java
Pixels p = new Pixels(1l);
Pixels p = new Pixels(); p.setId(1l);
public void testDirectConstruction() throws Exception { Pixels p = new Pixels(1l); p.setSizeX(new Integer(64)); p.setSizeY(new Integer(64)); p.setSizeZ(new Integer(64)); p.setSizeC(new Integer(64)); p.setSizeT(new Integer(64)); RenderingDef def = new RenderingDef(1l); def.setDefaultT(new Integer(1)); // etc RenderingBean re = new RenderingBean(); re.usePixels(p); re.useRenderDefintion(def); re.load(); { // now it's ready PlaneDef pd = new PlaneDef(PlaneDef.XY,1); re.render(pd); } // re.release(); not yet needed }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/7a91ecfa8b58758aa74e9304df4cb37064637dfb/ExampleUsageTest.java/clean/components/omero-ejb/test/ome/ejb/itests/ExampleUsageTest.java
RenderingDef def = new RenderingDef(1l);
RenderingDef def = new RenderingDef(); def.setId(1l);
public void testDirectConstruction() throws Exception { Pixels p = new Pixels(1l); p.setSizeX(new Integer(64)); p.setSizeY(new Integer(64)); p.setSizeZ(new Integer(64)); p.setSizeC(new Integer(64)); p.setSizeT(new Integer(64)); RenderingDef def = new RenderingDef(1l); def.setDefaultT(new Integer(1)); // etc RenderingBean re = new RenderingBean(); re.usePixels(p); re.useRenderDefintion(def); re.load(); { // now it's ready PlaneDef pd = new PlaneDef(PlaneDef.XY,1); re.render(pd); } // re.release(); not yet needed }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/7a91ecfa8b58758aa74e9304df4cb37064637dfb/ExampleUsageTest.java/clean/components/omero-ejb/test/ome/ejb/itests/ExampleUsageTest.java
pushRubyClass(bindingBlock.getKlass());
pushRubyClass((RubyModule) bindingBlock.getCRef().getValue());
public void preEvalWithBinding(RubyBinding binding) { Block bindingBlock = binding.getBlock(); pushFrame(bindingBlock.getFrame()); setCRef(bindingBlock.getCRef()); getCurrentFrame().setScope(bindingBlock.getScope()); dynamicVarsStack.push(bindingBlock.getDynamicVariables()); pushRubyClass(bindingBlock.getKlass()); iterStack.push(bindingBlock.getIter()); }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/9d3d790f078f9eaf21cafa0dbb57154bafb08d59/ThreadContext.java/buggy/src/org/jruby/runtime/ThreadContext.java
((RubyIO) value).setAsRubyErrorStream();
public void set(RubyObject value, String id, RubyObject data, RubyGlobalEntry entry) { if (value == data) { return; } else if (!(value instanceof RubyIO)) { entry.setData(value); return; } else { ((RubyIO) value).checkWriteable(); // ((RubyIO)value).f= 0; entry.setData(value); ((RubyIO) value).setAsRubyErrorStream(); } }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/d31a76ee29d5978a9bec41e3ac9134cee024bcab/RubyGlobal.java/buggy/org/jruby/RubyGlobal.java
((RubyIO) value).setAsRubyInputStream();
public void set(RubyObject value, String id, RubyObject data, RubyGlobalEntry entry) { if (value == data) { return; } else if (!(value instanceof RubyIO)) { entry.setData(value); return; } else { ((RubyIO) value).checkReadable(); // ((RubyIO)value).fileno = 0; entry.setData(value); ((RubyIO) value).setAsRubyInputStream(); } }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/d31a76ee29d5978a9bec41e3ac9134cee024bcab/RubyGlobal.java/buggy/org/jruby/RubyGlobal.java
public void set(RubyObject value, String id, RubyObject data, RubyGlobalEntry entry) { if (value == data) { return; } else if (!(value instanceof RubyIO)) { entry.setData(value); return; } else { ((RubyIO) value).checkWriteable(); // ((RubyIO)value).fileno = 0; entry.setData(value); //set the ruby outputstream to match ((RubyIO) value).setAsRubyOutputStream(); } }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/d31a76ee29d5978a9bec41e3ac9134cee024bcab/RubyGlobal.java/buggy/org/jruby/RubyGlobal.java
((RubyIO) value).setAsRubyOutputStream();
public void set(RubyObject value, String id, RubyObject data, RubyGlobalEntry entry) { if (value == data) { return; } else if (!(value instanceof RubyIO)) { entry.setData(value); return; } else { ((RubyIO) value).checkWriteable(); // ((RubyIO)value).fileno = 0; entry.setData(value); //set the ruby outputstream to match ((RubyIO) value).setAsRubyOutputStream(); } }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/d31a76ee29d5978a9bec41e3ac9134cee024bcab/RubyGlobal.java/buggy/org/jruby/RubyGlobal.java
RubyObject stdin = RubyIO.stdin(ruby, ruby.getClasses().getIoClass()); RubyObject stdout = RubyIO.stdout(ruby, ruby.getClasses().getIoClass()); RubyObject stderr = RubyIO.stderr(ruby, ruby.getClasses().getIoClass());
RubyObject stdin = RubyIO.stdin(ruby, ruby.getClasses().getIoClass(), System.in); RubyObject stdout = RubyIO.stdout(ruby, ruby.getClasses().getIoClass(), System.out); RubyObject stderr = RubyIO.stderr(ruby, ruby.getClasses().getIoClass(), System.err);
public static void createGlobals(Ruby ruby) { StringSetter stringSetter = new StringSetter(); LastlineAccessor lastlineAccessor = new LastlineAccessor(); SafeAccessor safeAccessor = new SafeAccessor(); ruby.defineHookedVariable("$/", RubyString.newString(ruby, "\n"), null, stringSetter); ruby.defineHookedVariable("$\\", ruby.getNil(), null, stringSetter); ruby.defineHookedVariable("$,", ruby.getNil(), null, stringSetter); ruby.defineHookedVariable("$.", RubyFixnum.one(ruby), null, new LineNumberSetter()); ruby.defineVirtualVariable("$_", lastlineAccessor, lastlineAccessor); ruby.defineHookedVariable("$!", ruby.getNil(), null, new ErrorInfoSetter()); ruby.defineVirtualVariable("$SAFE", safeAccessor, safeAccessor); RubyObject stdin = RubyIO.stdin(ruby, ruby.getClasses().getIoClass()); RubyObject stdout = RubyIO.stdout(ruby, ruby.getClasses().getIoClass()); RubyObject stderr = RubyIO.stderr(ruby, ruby.getClasses().getIoClass()); ruby.defineHookedVariable("$stdin", stdin, null, new StdInSetter()); ruby.defineHookedVariable("$stdout", stdout, null, new StdOutSetter()); ruby.defineHookedVariable("$stderr", stderr, null, new StdErrSetter()); ruby.defineHookedVariable("$>", stdout, null, new DefSetter()); ruby.defineHookedVariable("$defout", stdout, null, new DefSetter()); ruby.defineGlobalConstant("STDIN", stdin); ruby.defineGlobalConstant("STDOUT", stdout); ruby.defineGlobalConstant("STDERR", stderr); // ARGF, $< object RubyArgsFile argsFile = new RubyArgsFile(ruby); argsFile.initArgsFile(); // Global functions // IO, $_ String ruby.defineGlobalFunction("open", CallbackFactory.getOptSingletonMethod(RubyGlobal.class, "open")); ruby.defineGlobalFunction("format", CallbackFactory.getOptSingletonMethod(RubyGlobal.class, "sprintf")); ruby.defineGlobalFunction("gets", CallbackFactory.getOptSingletonMethod(RubyGlobal.class, "gets")); ruby.defineGlobalFunction("p", CallbackFactory.getOptSingletonMethod(RubyGlobal.class, "p")); ruby.defineGlobalFunction("print", CallbackFactory.getOptSingletonMethod(RubyGlobal.class, "print")); ruby.defineGlobalFunction("printf", CallbackFactory.getOptSingletonMethod(RubyGlobal.class, "printf")); ruby.defineGlobalFunction("puts", CallbackFactory.getOptSingletonMethod(RubyGlobal.class, "puts")); ruby.defineGlobalFunction("readline", CallbackFactory.getOptSingletonMethod(RubyGlobal.class, "readline")); ruby.defineGlobalFunction("readlines", CallbackFactory.getOptSingletonMethod(RubyGlobal.class, "readlines")); ruby.defineGlobalFunction("sprintf", CallbackFactory.getOptSingletonMethod(RubyGlobal.class, "sprintf")); ruby.defineGlobalFunction("gsub!", CallbackFactory.getOptSingletonMethod(RubyGlobal.class, "gsub_bang")); ruby.defineGlobalFunction("gsub", CallbackFactory.getOptSingletonMethod(RubyGlobal.class, "gsub")); ruby.defineGlobalFunction("sub!", CallbackFactory.getOptSingletonMethod(RubyGlobal.class, "sub_bang")); ruby.defineGlobalFunction("sub", CallbackFactory.getOptSingletonMethod(RubyGlobal.class, "sub")); ruby.defineGlobalFunction("chop!", CallbackFactory.getSingletonMethod(RubyGlobal.class, "chop_bang")); ruby.defineGlobalFunction("chop", CallbackFactory.getSingletonMethod(RubyGlobal.class, "chop")); ruby.defineGlobalFunction("chomp!", CallbackFactory.getOptSingletonMethod(RubyGlobal.class, "chomp_bang")); ruby.defineGlobalFunction("chomp", CallbackFactory.getOptSingletonMethod(RubyGlobal.class, "chomp")); ruby.defineGlobalFunction("split", CallbackFactory.getOptSingletonMethod(RubyGlobal.class, "split")); ruby.defineGlobalFunction("scan", CallbackFactory.getSingletonMethod(RubyGlobal.class, "scan", RubyObject.class)); ruby.defineGlobalFunction("load", CallbackFactory.getSingletonMethod(RubyGlobal.class, "load", RubyString.class)); //FIXME autoload method needs to be implemented //ruby.defineGlobalFunction("autoload", CallbackFactory.getSingletonMethod(RubyGlobal.class, "autoload", RubyString.class)); ruby.defineGlobalFunction("raise", CallbackFactory.getOptSingletonMethod(RubyGlobal.class, "raise")); ruby.defineGlobalFunction("require", CallbackFactory.getSingletonMethod(RubyGlobal.class, "require", RubyString.class)); ruby.defineGlobalFunction("global_variables", CallbackFactory.getSingletonMethod(RubyGlobal.class, "global_variables")); ruby.defineGlobalFunction("local_variables", CallbackFactory.getSingletonMethod(RubyGlobal.class, "local_variables")); ruby.defineGlobalFunction("block_given?", CallbackFactory.getSingletonMethod(RubyGlobal.class, "block_given")); ruby.defineGlobalFunction("iterator?", CallbackFactory.getSingletonMethod(RubyGlobal.class, "block_given")); ruby.defineGlobalFunction("lambda", CallbackFactory.getSingletonMethod(RubyGlobal.class, "lambda")); ruby.defineGlobalFunction("proc", CallbackFactory.getSingletonMethod(RubyGlobal.class, "proc")); ruby.defineGlobalFunction("loop", CallbackFactory.getSingletonMethod(RubyGlobal.class, "loop")); ruby.defineGlobalFunction("eval", CallbackFactory.getOptSingletonMethod(RubyGlobal.class, "eval", RubyString.class)); ruby.defineGlobalFunction("caller", CallbackFactory.getOptSingletonMethod(RubyGlobal.class, "caller")); ruby.defineGlobalFunction("catch", CallbackFactory.getSingletonMethod(RubyGlobal.class, "rbCatch", RubyObject.class)); ruby.defineGlobalFunction("throw", CallbackFactory.getOptSingletonMethod(RubyGlobal.class, "rbThrow", RubyObject.class)); ruby.defineGlobalFunction("singleton_method_added", CallbackFactory.getNilMethod()); }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/d31a76ee29d5978a9bec41e3ac9134cee024bcab/RubyGlobal.java/buggy/org/jruby/RubyGlobal.java
nameArea.addKeyListener(new KeyAdapter() { /** Finds the phrase. */ public void keyPressed(KeyEvent e) { if ((e.getKeyCode() == KeyEvent.VK_ENTER)) { Object source = e.getSource(); if (source instanceof JTextField) { JTextField field = (JTextField) source; if (field.getText() != null && field.getText().length() > 0) view.finish(); } } } });
private void initComponents() { tabbedPane = new JTabbedPane(); nameArea = new JTextField(); UIUtilities.setTextAreaDefault(nameArea); descriptionArea = new MultilineLabel(); UIUtilities.setTextAreaDefault(descriptionArea); if (model.getEditorType() == Editor.PROPERTIES_EDITOR) { nameArea.setText(model.getDataObjectName()); descriptionArea.setText(model.getDataObjectDescription()); boolean b = model.isWritable(); nameArea.setEnabled(b); descriptionArea.setEnabled(b); descriptionArea.getDocument().addDocumentListener( new DocumentListener() { /** Handles text insertion. */ public void insertUpdate(DocumentEvent de) { view.handleDescriptionAreaInsert(); } /** Handles text insertion. */ public void removeUpdate(DocumentEvent de) { view.handleDescriptionAreaInsert(); } /** * Required by I/F but no-op implementation in our case. * @see DocumentListener#removeUpdate(DocumentEvent) */ public void changedUpdate(DocumentEvent de) {} }); if (model.isAnnotatable()) { annotator = new DOAnnotation(view, model); IconManager im = IconManager.getInstance(); //tabbedPane.ins tabbedPane.addTab(ANNOTATION, im.getIcon(IconManager.ANNOTATION), annotator); } if (model.isClassified()) { classifier = new DOClassification(model, controller); tabbedPane.addTab(CLASSIFICATION, IconManager.getInstance().getIcon(IconManager.CATEGORY), classifier); } } nameAreaListener = new DocumentListener() { /** * Updates the editor's controls when some text is inserted. * @see DocumentListener#insertUpdate(DocumentEvent) */ public void insertUpdate(DocumentEvent de) { view.handleNameAreaInsert(); } /** * Displays an error message when the data object has no name. * @see DocumentListener#removeUpdate(DocumentEvent) */ public void removeUpdate(DocumentEvent de) { view.handleNameAreaRemove(de.getDocument().getLength()); } /** * Required by I/F but no-op implementation in our case. * @see DocumentListener#changedUpdate(DocumentEvent) */ public void changedUpdate(DocumentEvent de) {} }; nameArea.getDocument().addDocumentListener(nameAreaListener); }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/c3e0df27168af6ddebdb1c3476bb00aa3cf2fc92/DOBasic.java/clean/SRC/org/openmicroscopy/shoola/agents/treeviewer/editors/DOBasic.java
if (annotations == null) return;
void showAnnotations() { ExperimenterData userDetails = model.getUserDetails(); if (userDetails == null) return; Map annotations = model.getAnnotations(); String[] owners = new String[annotations.size()]; Iterator i = annotations.keySet().iterator(); Long id; int index = 0; ownersMap = new HashMap(); List list; ExperimenterData data; while (i.hasNext()) { id = (Long) i.next(); list = (List) annotations.get(id); data = ((AnnotationData) list.get(0)).getOwner(); if (userDetails.getId() == id.intValue()) userIndex = index; owners[index] = data.getLastName(); ownersMap.put(new Integer(index), id); index++; } //No annotation for the current user, so allow creation. if (userIndex != -1) annotatedByList.setSelectedIndex(userIndex); setComponentsEnabled(true); formatUsersList(owners); annotatedByList.clearSelection(); annotatedByList.setSelectedIndex(userIndex); showSingleAnnotation(); }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/0f24af159634bdc4228febad328548fbedecdb1d/DOAnnotation.java/buggy/SRC/org/openmicroscopy/shoola/agents/treeviewer/editors/DOAnnotation.java
result.defineMethod("print", CallbackFactory.getOptSingletonMethod(RubyIO.class, "print")); result.defineMethod("printf", CallbackFactory.getOptSingletonMethod(RubyIO.class, "printf")); result.defineMethod("puts", CallbackFactory.getOptSingletonMethod(RubyIO.class, "puts"));
public static RubyClass createIOClass(Ruby ruby) { RubyClass result = new IODefinition(ruby).getType(); result.defineMethod("lineno=", CallbackFactory.getMethod(RubyIO.class, "lineno_set", RubyFixnum.class)); result.defineMethod("sync=", CallbackFactory.getMethod(RubyIO.class, "sync_set", RubyBoolean.class)); result.defineSingletonMethod("foreach", CallbackFactory.getOptSingletonMethod(RubyIO.class, "foreach", IRubyObject.class)); result.defineSingletonMethod("readlines", CallbackFactory.getOptSingletonMethod(RubyIO.class, "readlines")); return result; }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/5858c541b148aad867b8e88b52fb524c0827a6a3/RubyIO.java/buggy/src/org/jruby/RubyIO.java
getContentPane().add(buildToolBar(), BorderLayout.NORTH); getContentPane().add(new JScrollPane(layeredPane), BorderLayout.CENTER);
Container c = getContentPane(); c.add(buildToolBar(), BorderLayout.NORTH); c.add(new JScrollPane(layeredPane), BorderLayout.CENTER);
private void buildGUI() { getContentPane().add(buildToolBar(), BorderLayout.NORTH); getContentPane().add(new JScrollPane(layeredPane), BorderLayout.CENTER); }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/3b273af3a5320ab0a054540f14a3c299ff01de69/ImgSaverPreviewer.java/clean/SRC/org/openmicroscopy/shoola/agents/imviewer/util/saver/ImgSaverPreviewer.java
JToolBar bar = new JToolBar(); bar.setFloatable(false); bar.setRollover(true);
JPanel bar = new JPanel();
private JPanel buildToolBar() { JToolBar bar = new JToolBar(); bar.setFloatable(false); bar.setRollover(true); bar.add(cancelButton); bar.add(saveButton); return UIUtilities.buildComponentPanelRight(bar); }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/3b273af3a5320ab0a054540f14a3c299ff01de69/ImgSaverPreviewer.java/clean/SRC/org/openmicroscopy/shoola/agents/imviewer/util/saver/ImgSaverPreviewer.java
IconManager icons = IconManager.getInstance(); saveButton = new JButton(icons.getIcon(IconManager.SAVE)); saveButton.setText("Save As");
saveButton = new JButton("Save As");
private void initComponents() { IconManager icons = IconManager.getInstance(); saveButton = new JButton(icons.getIcon(IconManager.SAVE)); saveButton.setText("Save As"); saveButton.setToolTipText( UIUtilities.formatToolTipText("Save the preview image.")); cancelButton = new JButton(icons.getIcon(IconManager.CANCEL)); cancelButton.setText("Cancel"); cancelButton.setToolTipText( UIUtilities.formatToolTipText("Close without saving.")); canvas = new ImgSaverPreviewerCanvas(this); layeredPane = new JLayeredPane(); layeredPane.add(canvas, new Integer(0)); }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/3b273af3a5320ab0a054540f14a3c299ff01de69/ImgSaverPreviewer.java/clean/SRC/org/openmicroscopy/shoola/agents/imviewer/util/saver/ImgSaverPreviewer.java
cancelButton = new JButton(icons.getIcon(IconManager.CANCEL)); cancelButton.setText("Cancel");
cancelButton = new JButton("Cancel");
private void initComponents() { IconManager icons = IconManager.getInstance(); saveButton = new JButton(icons.getIcon(IconManager.SAVE)); saveButton.setText("Save As"); saveButton.setToolTipText( UIUtilities.formatToolTipText("Save the preview image.")); cancelButton = new JButton(icons.getIcon(IconManager.CANCEL)); cancelButton.setText("Cancel"); cancelButton.setToolTipText( UIUtilities.formatToolTipText("Close without saving.")); canvas = new ImgSaverPreviewerCanvas(this); layeredPane = new JLayeredPane(); layeredPane.add(canvas, new Integer(0)); }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/3b273af3a5320ab0a054540f14a3c299ff01de69/ImgSaverPreviewer.java/clean/SRC/org/openmicroscopy/shoola/agents/imviewer/util/saver/ImgSaverPreviewer.java
ImagePaintingFactory.paintScaleBar(g2, width-s-10, h-10, s, v);
ImagePaintingFactory.paintScaleBar(g2, x+width-s-10, h-10, s, v);
void saveImage() { //Builds the image to display. boolean unitBar = model.isUnitBar(); String v = model.getUnitBarValue(); int s = (int) model.getUnitBarSize(); if (imageComponents == null) { int width = mainImage.getWidth(); int h = mainImage.getHeight(); BufferedImage newImage = new BufferedImage(width, h, BufferedImage.TYPE_INT_RGB); Graphics2D g2 = (Graphics2D) newImage.getGraphics(); g2.setColor(Color.WHITE); ImagePaintingFactory.setGraphicRenderingSettings(g2); //Paint the original image. g2.drawImage(mainImage, null, 0, 0); if (unitBar && v != null) ImagePaintingFactory.paintScaleBar(g2, width-s-10, h-10, s, v); writeImage(newImage, name); } else { int width = mainImage.getWidth(); int h = mainImage.getHeight(); int n = imageComponents.size(); int w = width*(n+1)+ImgSaverPreviewer.SPACE*(n-1); BufferedImage newImage = new BufferedImage(w, h, BufferedImage.TYPE_INT_RGB); Graphics2D g2 = (Graphics2D) newImage.getGraphics(); g2.setColor(Color.WHITE); ImagePaintingFactory.setGraphicRenderingSettings(g2); //Paint the original image. Iterator i = imageComponents.iterator(); int x = 0; while (i.hasNext()) { g2.drawImage((BufferedImage) i.next(), null, x, 0); if (unitBar && v != null) ImagePaintingFactory.paintScaleBar(g2, width-s-10, h-10, s, v); x += width; g2.fillRect(x, 0, ImgSaverPreviewer.SPACE, h); x += ImgSaverPreviewer.SPACE; } g2.drawImage(mainImage, null, x, 0); if (unitBar && v != null) ImagePaintingFactory.paintScaleBar(g2, width-s-10, h-10, s, v); writeImage(newImage, name); } }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/43f8c678f03aa7cac6a19865461c28a00cf7eb2b/ImgSaver.java/buggy/SRC/org/openmicroscopy/shoola/agents/imviewer/util/saver/ImgSaver.java
ImagePaintingFactory.paintScaleBar(g2, width-s-10, h-10, s, v);
ImagePaintingFactory.paintScaleBar(g2, x+width-s-10, h-10, s, v);
void saveImage() { //Builds the image to display. boolean unitBar = model.isUnitBar(); String v = model.getUnitBarValue(); int s = (int) model.getUnitBarSize(); if (imageComponents == null) { int width = mainImage.getWidth(); int h = mainImage.getHeight(); BufferedImage newImage = new BufferedImage(width, h, BufferedImage.TYPE_INT_RGB); Graphics2D g2 = (Graphics2D) newImage.getGraphics(); g2.setColor(Color.WHITE); ImagePaintingFactory.setGraphicRenderingSettings(g2); //Paint the original image. g2.drawImage(mainImage, null, 0, 0); if (unitBar && v != null) ImagePaintingFactory.paintScaleBar(g2, width-s-10, h-10, s, v); writeImage(newImage, name); } else { int width = mainImage.getWidth(); int h = mainImage.getHeight(); int n = imageComponents.size(); int w = width*(n+1)+ImgSaverPreviewer.SPACE*(n-1); BufferedImage newImage = new BufferedImage(w, h, BufferedImage.TYPE_INT_RGB); Graphics2D g2 = (Graphics2D) newImage.getGraphics(); g2.setColor(Color.WHITE); ImagePaintingFactory.setGraphicRenderingSettings(g2); //Paint the original image. Iterator i = imageComponents.iterator(); int x = 0; while (i.hasNext()) { g2.drawImage((BufferedImage) i.next(), null, x, 0); if (unitBar && v != null) ImagePaintingFactory.paintScaleBar(g2, width-s-10, h-10, s, v); x += width; g2.fillRect(x, 0, ImgSaverPreviewer.SPACE, h); x += ImgSaverPreviewer.SPACE; } g2.drawImage(mainImage, null, x, 0); if (unitBar && v != null) ImagePaintingFactory.paintScaleBar(g2, width-s-10, h-10, s, v); writeImage(newImage, name); } }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/43f8c678f03aa7cac6a19865461c28a00cf7eb2b/ImgSaver.java/buggy/SRC/org/openmicroscopy/shoola/agents/imviewer/util/saver/ImgSaver.java
exceptionClass.defineSingletonMethod( "exception", CallbackFactory.getOptSingletonMethod(RubyException.class, "newInstance"));
exceptionClass.defineSingletonMethod("exception", CallbackFactory.getOptSingletonMethod(RubyException.class, "newInstance")); exceptionClass.defineSingletonMethod("new", CallbackFactory.getOptSingletonMethod(RubyException.class, "newInstance"));
public static RubyClass createExceptionClass(Ruby ruby) { RubyClass exceptionClass = ruby.defineClass("Exception", ruby.getClasses().getObjectClass()); exceptionClass.defineSingletonMethod( "exception", CallbackFactory.getOptSingletonMethod(RubyException.class, "newInstance")); exceptionClass.defineMethod("initialize", CallbackFactory.getOptMethod(RubyException.class, "initialize")); exceptionClass.defineMethod("exception", CallbackFactory.getOptMethod(RubyException.class, "exception")); exceptionClass.defineMethod("to_s", CallbackFactory.getMethod(RubyException.class, "to_s")); exceptionClass.defineMethod("to_str", CallbackFactory.getMethod(RubyException.class, "to_s")); exceptionClass.defineMethod("message", CallbackFactory.getMethod(RubyException.class, "to_s")); exceptionClass.defineMethod("inspect", CallbackFactory.getMethod(RubyException.class, "inspect")); exceptionClass.defineMethod("backtrace", CallbackFactory.getMethod(RubyException.class, "backtrace")); exceptionClass.defineMethod( "set_backtrace", CallbackFactory.getMethod(RubyException.class, "set_backtrace", RubyArray.class)); return exceptionClass; }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/8adb5153eae22c0f6dba4d97072deb88f2715e8a/RubyException.java/buggy/org/jruby/RubyException.java
return new FileBuffer(file, "rw");
return new FileBuffer(getFilesPath(file.getId()),file, "rw");
public FileBuffer createFileBuffer(OriginalFile file) throws FileNotFoundException { return new FileBuffer(file, "rw"); }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/ae0b01fad17fcacba3ec0999ca1ad645f389b5f9/OriginalFilesService.java/clean/components/omeio-nio/src/ome/io/nio/OriginalFilesService.java
return new FileBuffer(file, "r");
return new FileBuffer(getFilesPath(file.getId()),file, "r");
public FileBuffer getReadOnlyFileBuffer(OriginalFile file) throws FileNotFoundException { return new FileBuffer(file, "r"); }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/ae0b01fad17fcacba3ec0999ca1ad645f389b5f9/OriginalFilesService.java/clean/components/omeio-nio/src/ome/io/nio/OriginalFilesService.java
return new FileBuffer(file, "rw");
return new FileBuffer(getFilesPath(file.getId()),file, "rw");
public FileBuffer getReadWriteFileBuffer(OriginalFile file) throws FileNotFoundException { return new FileBuffer(file, "rw"); }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/ae0b01fad17fcacba3ec0999ca1ad645f389b5f9/OriginalFilesService.java/clean/components/omeio-nio/src/ome/io/nio/OriginalFilesService.java
log.info("Using root path: '" + path + "'");
public AbstractFileSystemService(String path) { this.root = path; File rootDirectory = new File(this.root); if ( ! rootDirectory.isDirectory() || ! rootDirectory.canRead() || ! rootDirectory.canWrite() ) throw new IllegalArgumentException("Invalid directory specified for file system service."); }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/4190152881c7f58e1a3f87c9e6736e403a241c86/AbstractFileSystemService.java/buggy/components/omeio-nio/src/ome/io/nio/AbstractFileSystemService.java
FileBuffer (OriginalFile file, String mode)
FileBuffer (String path, OriginalFile file, String mode)
FileBuffer (OriginalFile file, String mode) throws FileNotFoundException { this.file = file; this.path = Helper.getFilesPath(file.getId()); delegate = new RandomAccessFile(path, mode); }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/ae0b01fad17fcacba3ec0999ca1ad645f389b5f9/FileBuffer.java/buggy/components/omeio-nio/src/ome/io/nio/FileBuffer.java
this.path = Helper.getFilesPath(file.getId());
FileBuffer (OriginalFile file, String mode) throws FileNotFoundException { this.file = file; this.path = Helper.getFilesPath(file.getId()); delegate = new RandomAccessFile(path, mode); }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/ae0b01fad17fcacba3ec0999ca1ad645f389b5f9/FileBuffer.java/buggy/components/omeio-nio/src/ome/io/nio/FileBuffer.java
boolean selected = treeNode.isSelected(); treeNode.dispose(); if (holder instanceof DisplayedNote) { this.treeNode = tree.addTreeNode(((DisplayedNote) holder).treeNode, this); } else { this.treeNode = tree.addRootNode(this); } treeNode.setSelected(selected);
moveTreeNode(newHolder, tree); treeNode.setSelected(true);
public void move(DisplayedNoteHolder newHolder, NoteTree tree, int index) { // Move DisplayedNote holder.removeDisplayedNote(this); holder = newHolder; holder.addDisplayedNote(this, index); // Move Note note.move(newHolder.getNoteHolder(), index); // Move Tree Node boolean selected = treeNode.isSelected(); treeNode.dispose(); if (holder instanceof DisplayedNote) { this.treeNode = tree.addTreeNode(((DisplayedNote) holder).treeNode, this); } else { this.treeNode = tree.addRootNode(this); } treeNode.setSelected(selected); }
57508 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57508/76991c1ba98ed76872aa37de20d08bb9f061978c/DisplayedNote.java/clean/trunk/src/de/berlios/koalanotes/display/DisplayedNote.java
if ( params == null ) { params = new Parameters(); }
public IObject findByQuery(@NotNull String queryName, Parameters params) throws ValidationException { // specify that we should only return a single value if possible params.getFilter().unique(); Query<IObject> q = queryFactory.lookup( queryName, params ); IObject result = null; try { result = execute(q); } catch (ClassCastException cce) { throw new ApiUsageException( "Query named:\n\t"+queryName+"\n" + "has returned an Object of type "+cce.getMessage()+"\n" + "Queries must return IObjects when using findByQuery. \n" + "Please try findAllByQuery for queries which return Lists." ); } catch (NonUniqueResultException nure) { throw new ApiUsageException( "Query named:\n\t"+queryName+"\n" + "has returned more than one Object\n" + "findByQuery must return a single value.\n" + "Please try findAllByQuery for queries which return Lists." ); } return result; }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/3864c8c11efe7bccd0dbccc72a0bc558e8261b3c/QueryImpl.java/clean/components/server/src/ome/logic/QueryImpl.java
return "TODO";
return ClassHelper.getPackageName(className).replace('.', '/') + '/' + instrumentation.getSourceFileName();
private String getFileName(String className, CoverageData instrumentation) { // TODO: Find a better way to get this return "TODO"; //return ClassHelper.getPackageName(className).replace('.', '/') + '/' + instrumentation.getSourceFileName(); }
50197 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50197/c3e69d3840be2f7780aae7b00ec462c4b4ba5d92/XMLReport.java/clean/cobertura/src/net/sourceforge/cobertura/reporting/xml/XMLReport.java
for (RubyModule p = this; p != null; p = p.getSuperClass()) { if (p.getMethods() == moduleMethods) { return; } }
if (getMethods() == moduleMethods) { return; }
public synchronized void includeModule(IRubyObject arg) { testFrozen("module"); if (!isTaint()) { getRuntime().secure(4); } if (!(arg instanceof RubyModule)) { throw getRuntime().newTypeError("Wrong argument type " + arg.getMetaClass().getName() + " (expected Module)."); } RubyModule module = (RubyModule) arg; Map moduleMethods = module.getMethods(); // Make sure the module we include does not already exist for (RubyModule p = this; p != null; p = p.getSuperClass()) { // XXXEnebo - Lame equality check (cause: IncludedModule?) if (p.getMethods() == moduleMethods) { return; } } // Invalidate cache for all methods in the new included module in case a base class method // of the same name has already been cached. for (Iterator iter = moduleMethods.keySet().iterator(); iter.hasNext();) { String methodName = (String) iter.next(); getRuntime().getCacheMap().remove(methodName, searchMethod(methodName)); } // Include new module setSuperClass(module.newIncludeClass(getSuperClass())); // cnutter: removed iterative inclusion of module's superclasses, because it included them in reverse order // see RubyModule.newIncludeClass for replacement module.callMethod("included", this); }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/03eb64fbb08410a46f7ac9a30bd7029840410c7f/RubyModule.java/clean/src/org/jruby/RubyModule.java
SoftwareUpdateDialog(JFrame owner)
SoftwareUpdateDialog(JFrame owner, String aboutMessage)
SoftwareUpdateDialog(JFrame owner) { super(owner); setModal(true); setResizable(false); initComponents(); buildGUI(); pack(); }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/bbd964029121f2811ba2b7cf47a392087032888c/SoftwareUpdateDialog.java/buggy/SRC/org/openmicroscopy/shoola/env/ui/SoftwareUpdateDialog.java
setModal(true); setResizable(false);
setWindowProperties();
SoftwareUpdateDialog(JFrame owner) { super(owner); setModal(true); setResizable(false); initComponents(); buildGUI(); pack(); }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/bbd964029121f2811ba2b7cf47a392087032888c/SoftwareUpdateDialog.java/buggy/SRC/org/openmicroscopy/shoola/env/ui/SoftwareUpdateDialog.java
buildGUI();
buildGUI(aboutMessage);
SoftwareUpdateDialog(JFrame owner) { super(owner); setModal(true); setResizable(false); initComponents(); buildGUI(); pack(); }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/bbd964029121f2811ba2b7cf47a392087032888c/SoftwareUpdateDialog.java/buggy/SRC/org/openmicroscopy/shoola/env/ui/SoftwareUpdateDialog.java
private void buildGUI()
private void buildGUI(String aboutMessage)
private void buildGUI() { getContentPane().add(buildContentPanel(), BorderLayout.CENTER); JPanel p = UIUtilities.buildComponentPanelRight(buildToolBar()); p.setBorder(BorderFactory.createEtchedBorder()); p.setOpaque(true); getContentPane().add(p, BorderLayout.SOUTH); }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/bbd964029121f2811ba2b7cf47a392087032888c/SoftwareUpdateDialog.java/buggy/SRC/org/openmicroscopy/shoola/env/ui/SoftwareUpdateDialog.java
getContentPane().add(buildContentPanel(), BorderLayout.CENTER);
Container c = getContentPane(); c.add(buildAbout(aboutMessage), BorderLayout.NORTH); c.add(buildContentPanel(), BorderLayout.CENTER);
private void buildGUI() { getContentPane().add(buildContentPanel(), BorderLayout.CENTER); JPanel p = UIUtilities.buildComponentPanelRight(buildToolBar()); p.setBorder(BorderFactory.createEtchedBorder()); p.setOpaque(true); getContentPane().add(p, BorderLayout.SOUTH); }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/bbd964029121f2811ba2b7cf47a392087032888c/SoftwareUpdateDialog.java/buggy/SRC/org/openmicroscopy/shoola/env/ui/SoftwareUpdateDialog.java
getContentPane().add(p, BorderLayout.SOUTH);
c.add(p, BorderLayout.SOUTH);
private void buildGUI() { getContentPane().add(buildContentPanel(), BorderLayout.CENTER); JPanel p = UIUtilities.buildComponentPanelRight(buildToolBar()); p.setBorder(BorderFactory.createEtchedBorder()); p.setOpaque(true); getContentPane().add(p, BorderLayout.SOUTH); }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/bbd964029121f2811ba2b7cf47a392087032888c/SoftwareUpdateDialog.java/buggy/SRC/org/openmicroscopy/shoola/env/ui/SoftwareUpdateDialog.java
public static RubyClass createFixnumClass(Ruby runtime) { return new FixnumDefinition(runtime).getType();
public static RubyClass createFixnumClass(Ruby ruby) { RubyClass fixnumClass = ruby.defineClass("Fixnum", ruby.getClasses().getIntegerClass()); CallbackFactory callbackFactory = ruby.callbackFactory(); fixnumClass.defineMethod("to_f", callbackFactory.getMethod(RubyFixnum.class, "to_f")); fixnumClass.defineMethod("to_i", callbackFactory.getMethod(RubyFixnum.class, "to_i")); fixnumClass.defineMethod("to_s", callbackFactory.getMethod(RubyFixnum.class, "to_s")); fixnumClass.defineMethod("to_str", callbackFactory.getMethod(RubyFixnum.class, "to_s")); fixnumClass.defineMethod("taint", callbackFactory.getMethod(RubyFixnum.class, "taint")); fixnumClass.defineMethod("freeze", callbackFactory.getMethod(RubyFixnum.class, "freeze")); fixnumClass.defineMethod("<<", callbackFactory.getMethod(RubyFixnum.class, "op_lshift", IRubyObject.class)); fixnumClass.defineMethod(">>", callbackFactory.getMethod(RubyFixnum.class, "op_rshift", IRubyObject.class)); fixnumClass.defineMethod("+", callbackFactory.getMethod(RubyFixnum.class, "op_plus", IRubyObject.class)); fixnumClass.defineMethod("-", callbackFactory.getMethod(RubyFixnum.class, "op_minus", IRubyObject.class)); fixnumClass.defineMethod("*", callbackFactory.getMethod(RubyFixnum.class, "op_mul", IRubyObject.class)); fixnumClass.defineMethod("/", callbackFactory.getMethod(RubyFixnum.class, "op_div", IRubyObject.class)); fixnumClass.defineMethod("%", callbackFactory.getMethod(RubyFixnum.class, "op_mod", IRubyObject.class)); fixnumClass.defineMethod("**", callbackFactory.getMethod(RubyFixnum.class, "op_pow", IRubyObject.class)); fixnumClass.defineMethod("==", callbackFactory.getMethod(RubyFixnum.class, "equal", IRubyObject.class)); fixnumClass.defineMethod("eql?", callbackFactory.getMethod(RubyFixnum.class, "veryEqual", IRubyObject.class)); fixnumClass.defineMethod("equal?", callbackFactory.getMethod(RubyFixnum.class, "veryEqual", IRubyObject.class)); fixnumClass.defineMethod("<=>", callbackFactory.getMethod(RubyFixnum.class, "op_cmp", IRubyObject.class)); fixnumClass.defineMethod(">", callbackFactory.getMethod(RubyFixnum.class, "op_gt", IRubyObject.class)); fixnumClass.defineMethod(">=", callbackFactory.getMethod(RubyFixnum.class, "op_ge", IRubyObject.class)); fixnumClass.defineMethod("<", callbackFactory.getMethod(RubyFixnum.class, "op_lt", IRubyObject.class)); fixnumClass.defineMethod("<=", callbackFactory.getMethod(RubyFixnum.class, "op_le", IRubyObject.class)); fixnumClass.defineMethod("&", callbackFactory.getMethod(RubyFixnum.class, "op_and", IRubyObject.class)); fixnumClass.defineMethod("|", callbackFactory.getMethod(RubyFixnum.class, "op_or", IRubyObject.class)); fixnumClass.defineMethod("^", callbackFactory.getMethod(RubyFixnum.class, "op_xor", IRubyObject.class)); fixnumClass.defineMethod("size", callbackFactory.getMethod(RubyFixnum.class, "size")); fixnumClass.defineMethod("[]", callbackFactory.getMethod(RubyFixnum.class, "aref", IRubyObject.class)); fixnumClass.defineMethod("hash", callbackFactory.getMethod(RubyFixnum.class, "hash")); fixnumClass.defineMethod("id2name", callbackFactory.getMethod(RubyFixnum.class, "id2name")); fixnumClass.defineMethod("~", callbackFactory.getMethod(RubyFixnum.class, "invert")); fixnumClass.defineMethod("id", callbackFactory.getMethod(RubyFixnum.class, "id")); fixnumClass.defineSingletonMethod("induced_from", callbackFactory.getSingletonMethod(RubyFixnum.class, "induced_from", IRubyObject.class)); return fixnumClass;
public static RubyClass createFixnumClass(Ruby runtime) { return new FixnumDefinition(runtime).getType(); }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/651f03fe10cef5077eff9a351142dc1d4b6ae79a/RubyFixnum.java/buggy/src/org/jruby/RubyFixnum.java
Map cache = new HashMap();
Map cache = newCache();
static public Set adaptFoundCGCIHierarchies(Set result) { Set dataObjects = new HashSet(); Map cache = new HashMap(); for (Iterator i = result.iterator(); i.hasNext();) { Object obj = i.next(); if (obj instanceof CategoryGroup) { CategoryGroup cg = (CategoryGroup) obj; dataObjects.add(AdapterUtils.go(cg,cache)); } else if (obj instanceof Category) { Category ca = (Category) obj; dataObjects.add(AdapterUtils.go(ca,cache)); } else if (obj instanceof Image) { Image img = (Image) obj; dataObjects.add(AdapterUtils.go(img,cache)); } else { throw new RuntimeException("Method returned unexpected value type:" + obj.getClass() ); } } return dataObjects; }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/5e29e25bb21b2a51d4b44f9fd80b5b876b782887/AdapterUtils.java/clean/components/shoola-adapter/src/org/openmicroscopy/omero/shoolaadapter/AdapterUtils.java
Map cache = new HashMap();
Map cache = newCache();
static public Map adaptFoundDatasetAnnotations(Map result) { Map dataObjects = new HashMap(); Map cache = new HashMap(); for (Iterator i = result.keySet().iterator(); i.hasNext();) { Object key = i.next(); Set value = (Set) result.get(key); dataObjects.put(key,new HashSet()); for (Iterator j = value.iterator(); j.hasNext();) { DatasetAnnotation ann = (DatasetAnnotation) j.next(); ((Set) dataObjects.get(key)).add(AdapterUtils.go(ann,cache)); } } return dataObjects; }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/5e29e25bb21b2a51d4b44f9fd80b5b876b782887/AdapterUtils.java/clean/components/shoola-adapter/src/org/openmicroscopy/omero/shoolaadapter/AdapterUtils.java
Map cache = new HashMap();
Map cache = newCache();
static public Map adaptFoundImageAnnotations(Map result) { Map dataObjects = new HashMap(); Map cache = new HashMap(); for (Iterator i = result.keySet().iterator(); i.hasNext();) { Object key = i.next(); Set value = (Set) result.get(key); dataObjects.put(key,new HashSet()); for (Iterator j = value.iterator(); j.hasNext();) { ImageAnnotation ann = (ImageAnnotation) j.next(); ((Set) dataObjects.get(key)).add(AdapterUtils.go(ann,cache)); } } return dataObjects; }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/5e29e25bb21b2a51d4b44f9fd80b5b876b782887/AdapterUtils.java/clean/components/shoola-adapter/src/org/openmicroscopy/omero/shoolaadapter/AdapterUtils.java
Map cache = new HashMap();
Map cache = newCache();
static public Set adaptFoundPDIHierarchies(Set result) { Set dataObjects = new HashSet(); Map cache = new HashMap(); for (Iterator i = result.iterator(); i.hasNext();) { Object obj = i.next(); if (obj instanceof Project) { Project prj = (Project) obj; dataObjects.add(AdapterUtils.go(prj,cache)); } else if (obj instanceof Dataset) { Dataset ds = (Dataset) obj; dataObjects.add(AdapterUtils.go(ds,cache)); } else if (obj instanceof Image) { Image img = (Image) obj; dataObjects.add(AdapterUtils.go(img,cache)); } else { throw new RuntimeException("Method returned unexpected value type:" + obj.getClass() ); } } return dataObjects; }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/5e29e25bb21b2a51d4b44f9fd80b5b876b782887/AdapterUtils.java/clean/components/shoola-adapter/src/org/openmicroscopy/omero/shoolaadapter/AdapterUtils.java