StringBuffer sb = new StringBuffer("Tests run: "); sb.append(suite.runCount()); sb.append(", Failures: "); sb.append(suite.failureCount()); sb.append(", Errors: "); sb.append(suite.errorCount()); sb.append(", Time elapsed: "); sb.append(nf.format(suite.getRunTime() / 1000.0)); sb.append(" sec"); sb.append(StringUtils.LINE_SEP); // append the err and output streams to the log if (systemOutput != null && systemOutput.length() > 0) { sb.append("------------- Standard Output ---------------") .append(StringUtils.LINE_SEP) .append(systemOutput) .append("------------- ---------------- ---------------") .append(StringUtils.LINE_SEP); } if (systemError != null && systemError.length() > 0) { sb.append("------------- Standard Error -----------------") .append(StringUtils.LINE_SEP) .append(systemError) .append("------------- ---------------- ---------------") .append(StringUtils.LINE_SEP); } sb.append(StringUtils.LINE_SEP); if (out != null) { try { out.write(sb.toString().getBytes()); wri.close(); out.write(inner.toString().getBytes()); out.flush(); } catch (IOException ioex) { throw new BuildException("Unable to write output", ioex); } finally { if (out != System.out && out != System.err) { FileUtils.close(out); } } }
StringBuffer sb = new StringBuffer("Tests run: "); sb.append(suite.runCount()); sb.append(", Failures: "); sb.append(suite.failureCount()); sb.append(", Errors: "); sb.append(suite.errorCount()); sb.append(", Time elapsed: "); sb.append(numberFormat.format(suite.getRunTime() / 1000.0)); sb.append(" sec"); sb.append(StringUtils.LINE_SEP); sb.append(StringUtils.LINE_SEP); // append the err and output streams to the log if (systemOutput != null && systemOutput.length() > 0) { sb.append("------------- Standard Output ---------------") .append(StringUtils.LINE_SEP) .append(systemOutput) .append("------------- ---------------- ---------------") .append(StringUtils.LINE_SEP); } if (systemError != null && systemError.length() > 0) { sb.append("------------- Standard Error -----------------") .append(StringUtils.LINE_SEP) .append(systemError) .append("------------- ---------------- ---------------") .append(StringUtils.LINE_SEP); } if (output != null) { try { output.write(sb.toString()); resultWriter.close(); output.write(results.toString()); output.flush(); } finally { if (out != System.out && out != System.err) { FileUtils.close(out); } } }
Clone fragments detected by clone detection tool
File path: /apache-ant-1.7.0/src/org/apache/tools/ant/taskdefs/optional/junit/PlainJUnitResultFormatter.java File path: /apache-ant-1.7.0/src/org/apache/tools/ant/taskdefs/optional/junit/BriefJUnitResultFormatter.java
Method name: void endTestSuite(JUnitTest) Method name: void endTestSuite(JUnitTest)
Number of AST nodes: 21 Number of AST nodes: 21
1
StringBuffer sb = new StringBuffer("Tests run: ");
1
StringBuffer sb = new StringBuffer("Tests run: ");
2
        sb.append(suite.runCount());
2
        sb.append(suite.runCount());
3
        sb.append(", Failures: ");
3
        sb.append(", Failures: ");
4
        sb.append(suite.failureCount());
4
        sb.append(suite.failureCount());
5
        sb.append(", Errors: ");
5
        sb.append(", Errors: ");
6
        sb.append(suite.errorCount());
6
        sb.append(suite.errorCount());
7
        sb.append(", Time elapsed: ");
7
        sb.append(", Time elapsed: ");
8
        sb.append(nf.format(suite.getRunTime() / 1000.0));
8
        sb.append(numberFormat.format(suite.getRunTime() / 1000.0));
9
        sb.append(" sec");
9
        sb.append(" sec");
10
        sb.append(StringUtils.LINE_SEP);
10
        sb.append(StringUtils.LINE_SEP);
11
        sb.append(StringUtils.LINE_SEP);
11
        // append the err and output streams to the log
12
        // append the err and output streams to the log
12
        if (systemOutput != null && systemOutput.length() > 0) {
13
        if (systemOutput != null && systemOutput.length() > 0) {
13
            sb.append("------------- Standard Output ---------------")
14
            sb.append("------------- Standard Output ---------------")
14
                .append(StringUtils.LINE_SEP)
15
                    .append(StringUtils.LINE_SEP)
15
                .append(systemOutput)
16
                    .append(systemOutput)
16
                .append("------------- ---------------- ---------------")
17
                    .append("------------- ---------------- ---------------")
17
                .append(StringUtils.LINE_SEP);
18
                    .append(StringUtils.LINE_SEP);
18
        }
19
        }
19
        if (systemError != null && systemError.length() > 0) {
20
        if (systemError != null && systemError.length() > 0) {
20
            sb.append("------------- Standard Error -----------------")
21
            sb.append("------------- Standard Error -----------------")
21
                .append(StringUtils.LINE_SEP)
22
                    .append(StringUtils.LINE_SEP)
22
                .append(systemError)
23
                    .append(systemError)
23
                .append("------------- ---------------- ---------------")
24
                    .append("------------- ---------------- ---------------")
24
                .append(StringUtils.LINE_SEP);
25
                    .append(StringUtils.LINE_SEP);
25
        }
26
        }
26
        sb.append(StringUtils.LINE_SEP);
27
        if (out != null) {
27
        if (output != null) {
28
            try {
28
            try {
29
                out.write(sb.toString().getBytes());
29
                output.write(sb.toString());
30
                wri.close();
30
                resultWriter.close();
31
                out.write(inner.toString().getBytes());
31
                output.write(results.toString());
32
                out.flush();
32
                output.flush();
33
            } catch (IOException ioex) {
34
                throw new BuildException("Unable to write output", ioex);
35
            } finally {
33
            } finally {
36
                if (out != System.out && out != System.err) {
34
                if (out != System.out && out != System.err) {
37
                    FileUtils.close(out);
35
                    FileUtils.close(out);
38
                }
36
                }
39
            }
37
            }
40
        }
38
        }
Summary
Number of common nesting structure subtrees0
Number of refactorable cases0
Number of non-refactorable cases0
Time elapsed for finding largest common nesting structure subtrees (ms)0.9
Clones locationClones are in different classes
Number of node comparisons1