try { Source result = catalog.resolve(uri, null); assertNotNull(result); assertEquals(toURLString(xmlFile), result.getSystemId()); } catch (Exception e) { fail("resolve() failed!" + e.toString()); }
try { InputSource result = catalog1.resolveEntity(publicId, "nap:chemical+brothers"); assertNotNull(result); assertEquals(toURLString(dtdFile), result.getSystemId()); } catch (Exception e) { fail("resolveEntity() failed!" + e.toString()); }
Clone fragments detected by clone detection tool
File path: /apache-ant-1.7.0/src/tests/junit/org/apache/tools/ant/types/XMLCatalogTest.java File path: /apache-ant-1.7.0/src/tests/junit/org/apache/tools/ant/types/XMLCatalogTest.java
Method name: void testEntryReference() Method name: void testNestedCatalog()
Number of AST nodes: 4 Number of AST nodes: 4
1
try {
1
try {
2
            Source result = catalog.resolve(uri, null
2
            InputSource result = catalog1.resolveEntity(publicId,
3
);
3
                                                        "nap:chemical+brothers");
4
            assertNotNull(result);
4
            assertNotNull(result);
5
            assertEquals(toURLString(xmlFile),
5
            assertEquals(toURLString(dtdFile),
6
                         result.getSystemId());
6
                         result.getSystemId());
7
        } catch (Exception e) {
7
        } catch (Exception e) {
8
            fail("resolve() failed!" + e.toString());
8
            fail("resolveEntity() failed!" + e.toString());
9
        }
9
        }
Summary
Number of common nesting structure subtrees1
Number of refactorable cases0
Number of non-refactorable cases1
Time elapsed for finding largest common nesting structure subtrees (ms)0.2
Clones locationClones are declared in the same class
Number of node comparisons16
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements3
    Number of unmapped statements in the first code fragment1
    Number of unmapped statements in the second code fragment1
    Time elapsed for statement mapping (ms)0.8
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    26
    try
    26
    try
    17
    try
    Differences
    Expression1Expression2Difference
    "resolve() failed!""resolveEntity() failed!"LITERAL_VALUE_MISMATCH
    17
    try
                                                                                                                                                                    
    18
    InputSource result = catalog1.resolveEntity(publicId, "nap:chemical+brothers");
    Preondition Violations
    Unmatched statement InputSource result=catalog1.resolveEntity(publicId,"nap:chemical+brothers"); cannot be moved before or after the extracted code, because it throws exception(s) that should be caught by a try block that will be extracted
    18
    InputSource result = catalog1.resolveEntity(publicId, "nap:chemical+brothers");
    27
    Source result = catalog.resolve(uri, null);
    27
    Source result = catalog.resolve(uri, null);
    Preondition Violations
    Unmatched statement Source result=catalog.resolve(uri,null); cannot be moved before or after the extracted code, because it throws exception(s) that should be caught by a try block that will be extracted
                                                                                            
    28
    assertNotNull(result);
    28
    assertNotNull(result);
    19
    assertNotNull(result);
    Differences
    Expression1Expression2Difference
    javax.xml.transform.Sourceorg.xml.sax.InputSourceVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type javax.xml.transform.Source of variable result does not match with type org.xml.sax.InputSource of variable result
    • Make classes javax.xml.transform.Source and org.xml.sax.InputSource extend a common superclass
    19
    assertNotNull(result);
    29
    assertEquals(toURLString(xmlFile), result.getSystemId());
    29
    assertEquals(toURLString(xmlFile), result.getSystemId());
    20
    assertEquals(toURLString(dtdFile), result.getSystemId());
    Differences
    Expression1Expression2Difference
    xmlFiledtdFileVARIABLE_NAME_MISMATCH
    javax.xml.transform.Sourceorg.xml.sax.InputSourceVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type javax.xml.transform.Source of variable result does not match with type org.xml.sax.InputSource of variable result
    • Make classes javax.xml.transform.Source and org.xml.sax.InputSource extend a common superclass
    20
    assertEquals(toURLString(dtdFile), result.getSystemId());
    Precondition Violations (4)
    Row Violation
    1Unmatched statement InputSource result=catalog1.resolveEntity(publicId,"nap:chemical+brothers"); cannot be moved before or after the extracted code, because it throws exception(s) that should be caught by a try block that will be extracted
    2Unmatched statement Source result=catalog.resolve(uri,null); cannot be moved before or after the extracted code, because it throws exception(s) that should be caught by a try block that will be extracted
    3Type javax.xml.transform.Source of variable result does not match with type org.xml.sax.InputSource of variable result
    4Type javax.xml.transform.Source of variable result does not match with type org.xml.sax.InputSource of variable result