try { InputSource result = catalog.resolveEntity(publicId, "nap:chemical+brothers"); assertNotNull(result); String resultStr = new URL(result.getSystemId()).getFile(); assertTrue(toURLString(dtdFile).endsWith(resultStr)); } catch (Exception e) { fail("resolveEntity() failed!" + e.toString()); }
try { Source result = catalog.resolve(uri, null); assertNotNull(result); String resultStr = new URL(result.getSystemId()).getFile(); assertTrue(toURLString(xmlFile).endsWith(resultStr)); } catch (Exception e) { fail("resolve() 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 testClasspath() Method name: void testClasspath()
Number of AST nodes: 5 Number of AST nodes: 5
1
try {
1
try {
2
            InputSource result = catalog.resolveEntity(publicId,
2
            Source result = catalog.resolve
3
                                                       "nap:chemical+brothers");
3
(uri, null);
4
            assertNotNull(result);
4
            assertNotNull(result);
5
            String resultStr = new URL(result.getSystemId()).getFile();
5
            String resultStr = new URL(result.getSystemId()).getFile();
6
            assertTrue(toURLString(dtdFile).endsWith(resultStr));
6
            assertTrue(toURLString(xmlFile).endsWith(resultStr));
7
        } catch (Exception e) {
7
        } catch (Exception e) {
8
            fail("resolveEntity() failed!" + e.toString());
8
            fail("resolve() 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 in the same method
Number of node comparisons25
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements4
    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.9
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    20
    try
    20
    try
    25
    try
    Differences
    Expression1Expression2Difference
    "resolveEntity() failed!""resolve() failed!"LITERAL_VALUE_MISMATCH
    25
    try
    21
    InputSource result = catalog.resolveEntity(publicId, "nap:chemical+brothers");
    21
    InputSource result = catalog.resolveEntity(publicId, "nap:chemical+brothers");
    Preondition Violations
    Unmatched statement InputSource result=catalog.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
                                                                                                                                                                  
                                                                                            
    26
    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
    26
    Source result = catalog.resolve(uri, null);
    22
    assertNotNull(result);
    22
    assertNotNull(result);
    27
    assertNotNull(result);
    Differences
    Expression1Expression2Difference
    org.xml.sax.InputSourcejavax.xml.transform.SourceVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.xml.sax.InputSource of variable result does not match with type javax.xml.transform.Source of variable result
    • Make classes org.xml.sax.InputSource and javax.xml.transform.Source extend a common superclass
    27
    assertNotNull(result);
    23
    String resultStr = new URL(result.getSystemId()).getFile();
    23
    String resultStr = new URL(result.getSystemId()).getFile();
    28
    String resultStr = new URL(result.getSystemId()).getFile();
    Differences
    Expression1Expression2Difference
    org.xml.sax.InputSourcejavax.xml.transform.SourceVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.xml.sax.InputSource of variable result does not match with type javax.xml.transform.Source of variable result
    • Make classes org.xml.sax.InputSource and javax.xml.transform.Source extend a common superclass
    28
    String resultStr = new URL(result.getSystemId()).getFile();
    24
    assertTrue(toURLString(dtdFile).endsWith(resultStr));
    24
    assertTrue(toURLString(dtdFile).endsWith(resultStr));
    29
    assertTrue(toURLString(xmlFile).endsWith(resultStr));
    Differences
    Expression1Expression2Difference
    dtdFilexmlFileVARIABLE_NAME_MISMATCH
    29
    assertTrue(toURLString(xmlFile).endsWith(resultStr));
    Precondition Violations (4)
    Row Violation
    1Unmatched statement InputSource result=catalog.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 org.xml.sax.InputSource of variable result does not match with type javax.xml.transform.Source of variable result
    4Type org.xml.sax.InputSource of variable result does not match with type javax.xml.transform.Source of variable result