if (items[i].getName().equals("testelement")) { // $NON-NLS-1$ coll.add(new TestElementProperty(items[i].getAttribute("name", ""), createTestElement(items[i]))); // $NON-NLS-1$ // $NON-NLS-2$ } else if (items[i].getName().equals("collection")) { // $NON-NLS-1$ coll.add(new CollectionProperty(items[i].getAttribute("name", ""), // $NON-NLS-1$ // $NON-NLS-2$ createCollection(items[i], testClass))); } else if (items[i].getName().equals("string")) { // $NON-NLS-1$ JMeterProperty prop = createProperty(items[i], testClass); if (prop!=null) { coll.add(prop); } } else if (items[i].getName().equals("map")) { // $NON-NLS-1$ coll.add(new MapProperty(items[i].getAttribute("name", ""), createMap(items[i], testClass))); // $NON-NLS-1$ // $NON-NLS-2$ }
if (items[i].getName().equals("property")) { // $NON-NLS-1$ JMeterProperty prop = createProperty(items[i], testClass); if (prop!=null) { map.put(prop.getName(), prop); } } else if (items[i].getName().equals("testelement")) { // $NON-NLS-1$ map.put(items[i].getAttribute("name", ""), new TestElementProperty(items[i].getAttribute("name", ""), // $NON-NLS-1$ // $NON-NLS-2$ createTestElement(items[i]))); } else if (items[i].getName().equals("collection")) { // $NON-NLS-1$ map.put(items[i].getAttribute("name"), // $NON-NLS-1$ new CollectionProperty(items[i].getAttribute("name", ""), // $NON-NLS-1$ // $NON-NLS-2$ createCollection(items[i], testClass))); } else if (items[i].getName().equals("map")) { // $NON-NLS-1$ map.put(items[i].getAttribute("name", ""), // $NON-NLS-1$ // $NON-NLS-2$ new MapProperty(items[i].getAttribute("name", ""), // $NON-NLS-1$ // $NON-NLS-2$ createMap(items[i], testClass))); }
Clone fragments detected by clone detection tool
File path: /jakarta-jmeter-2.3.2/src/org/apache/jmeter/save/OldSaveService.java File path: /jakarta-jmeter-2.3.2/src/org/apache/jmeter/save/OldSaveService.java
Method name: Collection createCollection(Configuration, String) Method name: Map createMap(Configuration, String)
Number of AST nodes: 10 Number of AST nodes: 10
1
if (items[i].getName().equals("testelement")) { // $NON-NLS-1$ 
1
if (items[i].getName().equals("property")) { // $NON-NLS-1$ 
2
				coll.add(new T
2
				JMeterProperty prop = createProperty(items[i], testClass);
3
				if (prop!=null) {
4
				    map.put(prop.getName(), prop);
5
				}
3
estElementProperty
6
			} else if (items[i].getName().equals("testelement")) { // $NON-NLS-1$ 
4
(items[i].getAttribute("name", ""), createTestElement(items[i]))); // $NON-NLS-1$ // $NON-NLS-2$
7
				map.put(items[i].getAttribute("name", ""), new TestElementProperty(items[i].getAttribute("name", ""), // $NON-NLS-1$ // $NON-NLS-2$
5
			
8
						createTestElement(items[i])));
6
} else if (items[i].getName().equals("collection")) { // $NON-NLS-1$ 
9
			} else if (items[i].getName().equals("collection")) { // $NON-NLS-1$ 
7
				coll.add(
10
				map.put(items[i].getAttribute("name"),  // $NON-NLS-1$ 
8
new CollectionProperty(items[i].getAttribute("name", ""), // $NON-NLS-1$ // $NON-NLS-2$
11
						new CollectionProperty(items[i].getAttribute("name", ""), // $NON-NLS-1$ // $NON-NLS-2$
9
						createCollection(items[i], testClass)));
12
						createCollection(items[i], testClass)));
10
			} else if (items[i].getName().equals("string")) { // $NON-NLS-1$ 
13
			} else if (items[i].getName().equals("map")) { // $NON-NLS-1$ 
11
                JMeterProperty prop = createProperty(items[i], testClass);
12
				if (prop!=null) {
13
				    coll.add(prop);
14
				}
15
			} else if (items[i].getName().equals("map")) { // $NON-NLS-1$ 
16
				coll.add(
14
				map.put(items[i].getAttribute("name", ""),  // $NON-NLS-1$ // $NON-NLS-2$
17
new MapProperty(items[i].getAttribute("name", ""), 
15
						new MapProperty(items[i].getAttribute("name", ""), // $NON-NLS-1$ // $NON-NLS-2$
18
createMap(items[i], testClass))); // $NON-NLS-1$ // $NON-NLS-2$
16
						createMap(items[i], testClass)));
19
			}
17
			}
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)1.6
Clones locationClones are declared in the same class
Number of node comparisons36
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements6
    Number of unmapped statements in the first code fragment4
    Number of unmapped statements in the second code fragment4
    Time elapsed for statement mapping (ms)4.2
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    8
    else if (items[i].getName().equals("testelement"))
    8
    else if (items[i].getName().equals("testelement"))
                                                                                                                                                                                                                                                                          
    9
    map.put(items[i].getAttribute("name", ""), new TestElementProperty(items[i].getAttribute("name", ""), createTestElement(items[i])));
    9
    coll.add(new TestElementProperty(items[i].getAttribute("name", ""), createTestElement(items[i])));
                                                                                                                                                                                                          
    10
    else if (items[i].getName().equals("collection"))
    10
    else if (items[i].getName().equals("collection"))
                                                                                                                                                                                                                                                                                      
    11
    map.put(items[i].getAttribute("name"), new CollectionProperty(items[i].getAttribute("name", ""), createCollection(items[i], testClass)));
    11
    coll.add(new CollectionProperty(items[i].getAttribute("name", ""), createCollection(items[i], testClass)));
                                                                                                                                                                                                                            
    16
    else if (items[i].getName().equals("map"))
    12
    else if (items[i].getName().equals("map"))
                                                                                                                                                                                                                                                                
    13
    map.put(items[i].getAttribute("name", ""), new MapProperty(items[i].getAttribute("name", ""), createMap(items[i], testClass)));
    17
    coll.add(new MapProperty(items[i].getAttribute("name", ""), createMap(items[i], testClass)));
                                                                                                                                                                                                
    12
    if (items[i].getName().equals("string"))
    12
    if (items[i].getName().equals("string"))
    4
    if (items[i].getName().equals("property"))
    Differences
    Expression1Expression2Difference
    "string""property"LITERAL_VALUE_MISMATCH
    4
    if (items[i].getName().equals("property"))
    13
    JMeterProperty prop = createProperty(items[i], testClass);
    5
    JMeterProperty prop = createProperty(items[i], testClass);
    14
    if (prop != null)
    6
    if (prop != null)
                                                                    
    7
    map.put(prop.getName(), prop);
    Preondition Violations
    Unmatched statement map.put(prop.getName(),prop); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    7
    map.put(prop.getName(), prop);
    15
    coll.add(prop);
    15
    coll.add(prop);
    Preondition Violations
    Unmatched statement coll.add(prop); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                          
    Precondition Violations (2)
    Row Violation
    1Unmatched statement map.put(prop.getName(),prop); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    2Unmatched statement coll.add(prop); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted