try { // we don't expect to find this loader.findClass("fubar"); fail("Did not expect to find fubar class"); } catch (ClassNotFoundException e) { // ignore expected } catch (NullPointerException e) { fail("loader should not fail even if cleaned up"); } // tell the build it is finished p.fireBuildFinished(null);
try { // we don't expect to find this loader.findClass("fubar"); fail("Did not expect to find fubar class"); } catch (ClassNotFoundException e) { // ignore expected } catch (NullPointerException e) { fail("loader should not fail even if project finished"); }
Clone fragments detected by clone detection tool
File path: /apache-ant-1.7.0/src/tests/junit/org/apache/tools/ant/AntClassLoaderTest.java File path: /apache-ant-1.7.0/src/tests/junit/org/apache/tools/ant/AntClassLoaderTest.java
Method name: void testCleanup() Method name: void testCleanup()
Number of AST nodes: 4 Number of AST nodes: 3
1
try {
1
try {
2
            // we don't expect to find this
2
            // we don't expect to find this
3
            loader.findClass("fubar");
3
            loader.findClass("fubar");
4
            fail("Did not expect to find fubar class");
4
            fail("Did not expect to find fubar class");
5
        } catch (ClassNotFoundException e) {
5
        } catch (ClassNotFoundException e) {
6
            // ignore expected
6
            // ignore expected
7
        } catch (NullPointerException e) {
7
        } catch (NullPointerException e) {
8
            fail("loader should not fail even if cleaned up");
8
            fail("loader should not fail even if 
9
        }
10
        // tell the build it is finished
9
project finished");
11
        p.fireBuildFinished(null);
10
        }
Summary
Number of common nesting structure subtrees1
Number of refactorable cases1
Number of non-refactorable cases0
Time elapsed for finding largest common nesting structure subtrees (ms)0.2
Clones locationClones are in the same method
Number of node comparisons9
  1. {Refactorable}
    Mapping Summary
    Number of mapped statements3
    Number of unmapped statements in the first code fragment1
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)0.7
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
    7
    try
    7
    try
    11
    try
    Differences
    Expression1Expression2Difference
    "loader should not fail even if cleaned up""loader should not fail even if project finished"LITERAL_VALUE_MISMATCH
    11
    try
    8
    loader.findClass("fubar");
    12
    loader.findClass("fubar");
    9
    fail("Did not expect to find fubar class");
    13
    fail("Did not expect to find fubar class");
    10
    p.fireBuildFinished(null);
                                                                
    Precondition Violations (0)
    Row Violation