String publicId = "-//stevo//DTD doc 1.0//EN"; String sysid = "src/etc/testcases/taskdefs/optional/xml/doc.dtd"; // catalog2 --> catalog1 --> catalog ResourceLocation dtd = new ResourceLocation(); dtd.setPublicId(publicId); dtd.setLocation(sysid); catalog.addDTD(dtd); File dtdFile = project.resolveFile(sysid); String uri = "http://foo.com/bar/blah.xml"; String uriLoc = "src/etc/testcases/taskdefs/optional/xml/about.xml"; ResourceLocation entity = new ResourceLocation(); entity.setPublicId(uri); entity.setLocation(uriLoc); catalog.addEntity(entity); File xmlFile = project.resolveFile(uriLoc);
String publicId = "-//stevo//DTD doc 1.0//EN"; String dtdLoc = "src/etc/testcases/taskdefs/optional/xml/doc.dtd"; ResourceLocation dtd = new ResourceLocation(); dtd.setPublicId(publicId); dtd.setLocation(dtdLoc); catalog.addDTD(dtd); File dtdFile = project.resolveFile(dtdLoc); String uri = "http://foo.com/bar/blah.xml"; String uriLoc = "src/etc/testcases/taskdefs/optional/xml/about.xml"; ResourceLocation entity = new ResourceLocation(); entity.setPublicId(uri); entity.setLocation(uriLoc); catalog.addEntity(entity); File xmlFile = project.resolveFile(uriLoc);
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: 14 Number of AST nodes: 14
1
String publicId = "-//stevo//DTD doc 1.0//EN";
1
String publicId = "-//stevo//DTD doc 1.0//EN";
2
        String sysid = "src/etc/testcases/taskdefs/optional/xml/doc.dtd";
2
        String dtdLoc = "src/etc/testcases/taskdefs/optional/xml/doc.dtd";
3
        // catalog2 --> catalog1 --> catalog
4
        ResourceLocation dtd = new ResourceLocation();
3
        ResourceLocation dtd = new ResourceLocation();
5
        dtd.setPublicId(publicId);
4
        dtd.setPublicId(publicId);
6
        dtd.setLocation(sysid);
5
        dtd.setLocation(dtdLoc);
7
        catalog.addDTD(dtd);
6
        catalog.addDTD(dtd);
8
        File dtdFile = project.resolveFile(sysid);
7
        File dtdFile = project.resolveFile(dtdLoc);
9
        String uri = "http://foo.com/bar/blah.xml";
8
        String uri = "http://foo.com/bar/blah.xml";
10
        String uriLoc = "src/etc/testcases/taskdefs/optional/xml/about.xml";
9
        String uriLoc = "src/etc/testcases/taskdefs/optional/xml/about.xml";
11
        ResourceLocation entity = new ResourceLocation();
10
        ResourceLocation entity = new ResourceLocation();
12
        entity.setPublicId(uri);
11
        entity.setPublicId(uri);
13
        entity.setLocation(uriLoc);
12
        entity.setLocation(uriLoc);
14
        catalog.addEntity(entity);
13
        catalog.addEntity(entity);
15
        File xmlFile = project.resolveFile(uriLoc);
14
        File xmlFile = project.resolveFile(uriLoc);
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.0
Clones locationClones are declared in the same class
Number of node comparisons91
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements14
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)0.0
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    String publicId = "-//stevo//DTD doc 1.0//EN";
    1
    String publicId = "-//stevo//DTD doc 1.0//EN";
    2
    String sysid = "src/etc/testcases/taskdefs/optional/xml/doc.dtd";
    2
    String sysid = "src/etc/testcases/taskdefs/optional/xml/doc.dtd";
    2
    String dtdLoc = "src/etc/testcases/taskdefs/optional/xml/doc.dtd";
    Differences
    Expression1Expression2Difference
    sysiddtdLocVARIABLE_NAME_MISMATCH
    2
    String dtdLoc = "src/etc/testcases/taskdefs/optional/xml/doc.dtd";
    3
    ResourceLocation dtd = new ResourceLocation();
    3
    ResourceLocation dtd = new ResourceLocation();
    4
    dtd.setPublicId(publicId);
    4
    dtd.setPublicId(publicId);
    5
    dtd.setLocation(sysid);
    5
    dtd.setLocation(sysid);
    5
    dtd.setLocation(dtdLoc);
    Differences
    Expression1Expression2Difference
    sysiddtdLocVARIABLE_NAME_MISMATCH
    5
    dtd.setLocation(dtdLoc);
    6
    catalog.addDTD(dtd);
    6
    catalog.addDTD(dtd);
    7
    File dtdFile = project.resolveFile(sysid);
    7
    File dtdFile = project.resolveFile(sysid);
    7
    File dtdFile = project.resolveFile(dtdLoc);
    Differences
    Expression1Expression2Difference
    sysiddtdLocVARIABLE_NAME_MISMATCH
    7
    File dtdFile = project.resolveFile(dtdLoc);
    8
    String uri = "http://foo.com/bar/blah.xml";
    8
    String uri = "http://foo.com/bar/blah.xml";
    9
    String uriLoc = "src/etc/testcases/taskdefs/optional/xml/about.xml";
    9
    String uriLoc = "src/etc/testcases/taskdefs/optional/xml/about.xml";
    10
    ResourceLocation entity = new ResourceLocation();
    10
    ResourceLocation entity = new ResourceLocation();
    11
    entity.setPublicId(uri);
    11
    entity.setPublicId(uri);
    12
    entity.setLocation(uriLoc);
    12
    entity.setLocation(uriLoc);
    13
    catalog.addEntity(entity);
    13
    catalog.addEntity(entity);
    14
    File xmlFile = project.resolveFile(uriLoc);
    14
    File xmlFile = project.resolveFile(uriLoc);
    Precondition Violations (1)
    Row Violation
    1Clone fragment #1 returns variables publicId, dtdFile, uri, xmlFile , while Clone fragment #2 returns variables publicId, dtdFile, uri, xmlFile