funcTitles = new HashMap(20); String compref = "../xdocs/usermanual/functions.xml"; SAXBuilder bldr = new SAXBuilder(); Document doc; doc = bldr.build(compref); Element root = doc.getRootElement(); Element body = root.getChild("body"); Element section = body.getChild("section"); List sections = section.getChildren("subsection"); for (int i = 0; i < sections.size(); i++) { List components = ((Element) sections.get(i)).getChildren("component"); for (int j = 0; j < components.size(); j++) { Element comp = (Element) components.get(j); funcTitles.put(comp.getAttributeValue("name"), Boolean.FALSE); } }
guiTags = new HashMap(90); String compref = "../xdocs/usermanual/component_reference.xml"; SAXBuilder bldr = new SAXBuilder(); Document doc; doc = bldr.build(compref); Element root = doc.getRootElement(); Element body = root.getChild("body"); List sections = body.getChildren("section"); for (int i = 0; i < sections.size(); i++) { List components = ((Element) sections.get(i)).getChildren("component"); for (int j = 0; j < components.size(); j++) { Element comp = (Element) components.get(j); guiTags.put(comp.getAttributeValue("tag"), Boolean.FALSE); } }
Clone fragments detected by clone detection tool
File path: /jakarta-jmeter-2.3.2/test/src/org/apache/jmeter/junit/JMeterTest.java File path: /jakarta-jmeter-2.3.2/test/src/org/apache/jmeter/junit/JMeterTest.java
Method name: void createFunctionSet() Method name: void createTagSet()
Number of AST nodes: 14 Number of AST nodes: 13
1
funcTitles = new HashMap(20);
1
guiTags = new HashMap(90);
2
		String compref = "../xdocs/usermanual/functions.xml";
2
		String compref = "../xdocs/usermanual/component_reference.xml";
3
		SAXBuilder bldr = new SAXBuilder();
3
		SAXBuilder bldr = new SAXBuilder();
4
		Document doc;
4
		Document doc;
5
		doc = bldr.build(compref);
5
		doc = bldr.build(compref);
6
		Element root = doc.getRootElement();
6
		Element root = doc.getRootElement();
7
		Element body = root.getChild("body");
7
		Element body = root.getChild("body");
8
		Element section = body.getChild("section");
8
		
9
		List sections = section.getChildren("subsection");
9
List sections = body.getChildren("section");
10
		for (int i = 0; i < sections.size(); i++) {
10
		for (int i = 0; i < sections.size(); i++) {
11
			List components = ((Element) sections.get(i)).getChildren("component");
11
			List components = ((Element) sections.get(i)).getChildren("component");
12
			for (int j = 0; j < components.size(); j++) {
12
			for (int j = 0; j < components.size(); j++) {
13
				Element comp = (Element) components.get(j);
13
				Element comp = (Element) components.get(j);
14
				funcTitles.put(comp.getAttributeValue("name"), Boolean.FALSE);
14
				guiTags.put(comp.getAttributeValue("tag"), Boolean.FALSE);
15
			}
15
			}
16
		}
16
		}
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.4
Clones locationClones are declared in the same class
Number of node comparisons59
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements13
    Number of unmapped statements in the first code fragment1
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)4.7
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
    1
    funcTitles = new HashMap(20);
    1
    funcTitles = new HashMap(20);
    1
    guiTags = new HashMap(90);
    Differences
    Expression1Expression2Difference
    funcTitlesguiTagsVARIABLE_NAME_MISMATCH
    2090LITERAL_VALUE_MISMATCH
    Preondition Violations
    Expression funcTitles is a field being modified, and thus it cannot be parameterized
    Expression guiTags is a field being modified, and thus it cannot be parameterized
    1
    guiTags = new HashMap(90);
    2
    String compref = "../xdocs/usermanual/functions.xml";
    2
    String compref = "../xdocs/usermanual/functions.xml";
    2
    String compref = "../xdocs/usermanual/component_reference.xml";
    Differences
    Expression1Expression2Difference
    "../xdocs/usermanual/functions.xml""../xdocs/usermanual/component_reference.xml"LITERAL_VALUE_MISMATCH
    2
    String compref = "../xdocs/usermanual/component_reference.xml";
    3
    SAXBuilder bldr = new SAXBuilder();
    3
    SAXBuilder bldr = new SAXBuilder();
    4
    Document doc;
    4
    Document doc;
    5
    doc = bldr.build(compref);
    5
    doc = bldr.build(compref);
    6
    Element root = doc.getRootElement();
    6
    Element root = doc.getRootElement();
    7
    Element body = root.getChild("body");
    7
    Element body = root.getChild("body");
    8
    Element section = body.getChild("section");
    8
    Element section = body.getChild("section");
    Preondition Violations
    Unmatched statement Element section=body.getChild("section"); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                            
    9
    List sections = section.getChildren("subsection");
    9
    List sections = section.getChildren("subsection");
    8
    List sections = body.getChildren("section");
    Differences
    Expression1Expression2Difference
    "subsection""section"LITERAL_VALUE_MISMATCH
    sectionbodyVARIABLE_NAME_MISMATCH
    Preondition Violations
    Expression body cannot be parameterized, because it has dependencies to/from statements that will be extracted
    8
    List sections = body.getChildren("section");
    10
    for (int i = 0; i < sections.size(); i++)
    9
    for (int i = 0; i < sections.size(); i++)
    11
    List components = ((Element)sections.get(i)).getChildren("component");
    10
    List components = ((Element)sections.get(i)).getChildren("component");
    12
    for (int j = 0; j < components.size(); j++)
    11
    for (int j = 0; j < components.size(); j++)
    13
    Element comp = (Element)components.get(j);
    12
    Element comp = (Element)components.get(j);
    14
    funcTitles.put(comp.getAttributeValue("name"), Boolean.FALSE);
    14
    funcTitles.put(comp.getAttributeValue("name"), Boolean.FALSE);
    13
    guiTags.put(comp.getAttributeValue("tag"), Boolean.FALSE);
    Differences
    Expression1Expression2Difference
    "name""tag"LITERAL_VALUE_MISMATCH
    funcTitlesguiTagsVARIABLE_NAME_MISMATCH
    Preondition Violations
    Expression funcTitles cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression guiTags cannot be parameterized, because it has dependencies to/from statements that will be extracted
    13
    guiTags.put(comp.getAttributeValue("tag"), Boolean.FALSE);
    Precondition Violations (7)
    Row Violation
    1Expression funcTitles is a field being modified, and thus it cannot be parameterized
    2Expression guiTags is a field being modified, and thus it cannot be parameterized
    3Unmatched statement Element section=body.getChild("section"); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    4Expression body cannot be parameterized, because it has dependencies to/from statements that will be extracted
    5Expression funcTitles cannot be parameterized, because it has dependencies to/from statements that will be extracted
    6Expression guiTags cannot be parameterized, because it has dependencies to/from statements that will be extracted
    7Clone fragment #1 returns variables body , while Clone fragment #2 returns variables