ResourceLocation dtd = new ResourceLocation(); dtd.setPublicId("-//stevo//DTD doc 1.0//EN"); String sysid = System.getProperty("root") + File.separator + "src/etc/testcases/taskdefs/optional/xml/doc.dtd"; dtd.setLocation(sysid); catalog.addDTD(dtd); File dtdFile = project.resolveFile(sysid); try { InputSource result = catalog.resolveEntity("-//stevo//DTD doc 1.0//EN", "nap:chemical+brothers"); assertNotNull(result); assertEquals(toURLString(dtdFile), result.getSystemId()); } catch (Exception e) { fail("resolveEntity() failed!" + e.toString()); }
ResourceLocation dtd = new ResourceLocation(); dtd.setPublicId("-//stevo//DTD doc 1.0//EN"); String sysid = "src/etc/testcases/taskdefs/optional/xml/doc.dtd"; dtd.setLocation(sysid); catalog.addDTD(dtd); File dtdFile = project.resolveFile(sysid); try { InputSource result = catalog.resolveEntity("-//stevo//DTD doc 1.0//EN", "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 testAbsolutePath() Method name: void testSimpleEntry()
Number of AST nodes: 10 Number of AST nodes: 10
1
ResourceLocation dtd = new ResourceLocation();
1
ResourceLocation dtd = new ResourceLocation();
2
        dtd.setPublicId("-//stevo//DTD doc 1.0//EN");
2
        dtd.setPublicId("-//stevo//DTD doc 1.0//EN");
3
        String sysid = System.getProperty("root") + File.separator + "src/etc/testcases/taskdefs/optional/xml/doc.dtd";
3
        String sysid = "src/etc/testcases/taskdefs/optional/xml/doc.dtd";
4
        dtd.setLocation(sysid);
4
        dtd.setLocation(sysid);
5
        catalog.addDTD(dtd);
5
        catalog.addDTD(dtd);
6
        File dtdFile = project.resolveFile(sysid);
6
        File dtdFile = project.resolveFile(sysid);
7
        try {
7
        try {
8
            InputSource result = catalog.resolveEntity("-//stevo//DTD doc 1.0//EN",
8
            InputSource result = catalog.resolveEntity("-//stevo//DTD doc 1.0//EN",
9
                                                       "nap:chemical+brothers");
9
                                                       "nap:chemical+brothers");
10
            assertNotNull(result);
10
            assertNotNull(result);
11
            assertEquals(toURLString(dtdFile),
11
            assertEquals(toURLString(dtdFile),
12
                         result.getSystemId());
12
                         result.getSystemId());
13
        } catch (Exception e) {
13
        } catch (Exception e) {
14
            fail("resolveEntity() failed!" + e.toString());
14
            fail("resolveEntity() failed!" + e.toString());
15
        }
15
        }
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.4
Clones locationClones are declared in the same class
Number of node comparisons34
  1. {Refactorable}
    Mapping Summary
    Number of mapped statements10
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)1.8
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    ResourceLocation dtd = new ResourceLocation();
    1
    ResourceLocation dtd = new ResourceLocation();
    2
    dtd.setPublicId("-//stevo//DTD doc 1.0//EN");
    2
    dtd.setPublicId("-//stevo//DTD doc 1.0//EN");
    3
    String sysid = System.getProperty("root") + File.separator + "src/etc/testcases/taskdefs/optional/xml/doc.dtd";
    3
    String sysid = System.getProperty("root") + File.separator + "src/etc/testcases/taskdefs/optional/xml/doc.dtd";
    3
    String sysid = "src/etc/testcases/taskdefs/optional/xml/doc.dtd";
    Differences
    Expression1Expression2Difference
    System.getProperty("root") + File.separator + "src/etc/testcases/taskdefs/optional/xml/doc.dtd""src/etc/testcases/taskdefs/optional/xml/doc.dtd"TYPE_COMPATIBLE_REPLACEMENT
    3
    String sysid = "src/etc/testcases/taskdefs/optional/xml/doc.dtd";
    4
    dtd.setLocation(sysid);
    4
    dtd.setLocation(sysid);
    5
    catalog.addDTD(dtd);
    5
    catalog.addDTD(dtd);
    6
    File dtdFile = project.resolveFile(sysid);
    6
    File dtdFile = project.resolveFile(sysid);
    7
    try
    7
    try
    8
    InputSource result = catalog.resolveEntity("-//stevo//DTD doc 1.0//EN", "nap:chemical+brothers");
    8
    InputSource result = catalog.resolveEntity("-//stevo//DTD doc 1.0//EN", "nap:chemical+brothers");
    9
    assertNotNull(result);
    9
    assertNotNull(result);
    10
    assertEquals(toURLString(dtdFile), result.getSystemId());
    10
    assertEquals(toURLString(dtdFile), result.getSystemId());
    Precondition Violations (0)
    Row Violation