Vector v = new Vector(); Enumeration names = properties.keys(); while (names.hasMoreElements()) { String prop = (String) names.nextElement(); if (prop.startsWith(name)) { v.addElement(properties.getProperty(prop)); } } return v;
Hashtable t = new Hashtable(); Enumeration names = properties.keys(); while (names.hasMoreElements()) { String prop = (String) names.nextElement(); if (prop.startsWith(name)) { t.put(prop.substring(name.length()), properties.getProperty(prop)); } } return t;
Clone fragments detected by clone detection tool
File path: /jakarta-jmeter-2.3.2/src/org/apache/jmeter/util/JMeterUtils.java File path: /jakarta-jmeter-2.3.2/src/org/apache/jmeter/util/JMeterUtils.java
Method name: Vector getVector(Properties, String) Method name: Hashtable getHashtable(Properties, String)
Number of AST nodes: 7 Number of AST nodes: 7
1
Vector v = new Vector();
1
Hashtable t = new Hashtable();
2
		Enumeration names = properties.keys();
2
		Enumeration names = properties.keys();
3
		while (names.hasMoreElements()) {
3
		while (names.hasMoreElements()) {
4
			String prop = (String) names.nextElement();
4
			String prop = (String) names.nextElement();
5
			if (prop.startsWith(name)) {
5
			if (prop.startsWith(name)) {
6
				v.addElement(properties.getProperty(prop));
6
				t.put(prop.substring(name.length()), properties.getProperty(prop));
7
			}
7
			}
8
		}
8
		}
9
		return v;
9
		return t;
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 declared in the same class
Number of node comparisons17
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements4
    Number of unmapped statements in the first code fragment3
    Number of unmapped statements in the second code fragment3
    Time elapsed for statement mapping (ms)3.6
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
                                                                  
    1
    Hashtable t = new Hashtable();
    1
    Vector v = new Vector();
                                                      
    2
    Enumeration names = properties.keys();
    2
    Enumeration names = properties.keys();
    3
    while (names.hasMoreElements())
    3
    while (names.hasMoreElements())
    4
    String prop = (String)names.nextElement();
    4
    String prop = (String)names.nextElement();
    5
    if (prop.startsWith(name))
    5
    if (prop.startsWith(name))
                                                                                                                                              
    6
    t.put(prop.substring(name.length()), properties.getProperty(prop));
    Preondition Violations
    Unmatched statement t.put(prop.substring(name.length()),properties.getProperty(prop)); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    6
    t.put(prop.substring(name.length()), properties.getProperty(prop));
    6
    v.addElement(properties.getProperty(prop));
    6
    v.addElement(properties.getProperty(prop));
    Preondition Violations
    Unmatched statement v.addElement(properties.getProperty(prop)); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                                
                            
    7
    return t;
    Preondition Violations
    Unmatched return t;
    7
    return t;
    7
    return v;
    7
    return v;
    Preondition Violations
    Unmatched return v;
                            
    Precondition Violations (4)
    Row Violation
    1Unmatched statement t.put(prop.substring(name.length()),properties.getProperty(prop)); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    2Unmatched statement v.addElement(properties.getProperty(prop)); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    3Unmatched return t;
    4Unmatched return v;