for (int i = 0; i < properties.length; i++) { if (properties[i].getName().equals(name)) { return properties[i]; } }
for (int i = 0; i < m_optionDescriptors.length; i++) { if (m_optionDescriptors[i].getName().equals(name)) { return m_optionDescriptors[i]; } }
Clone fragments detected by clone detection tool
File path: /jakarta-jmeter-2.3.2/src/org/apache/jmeter/testbeans/BeanInfoSupport.java File path: /jakarta-jmeter-2.3.2/src/org/apache/commons/cli/avalon/CLArgsParser.java
Method name: PropertyDescriptor property(String) Method name: CLOptionDescriptor getDescriptorFor(String)
Number of AST nodes: 3 Number of AST nodes: 3
1
for (int i = 0; i < properties.length; i++) {
1
for (int i = 0; i < m_optionDescriptors.length; i++) {
2
			if (properties[i].getName().equals(name)) {
2
			if (m_optionDescriptors[i].getName().equals(name)) {
3
				return properties[i];
3
				return m_optionDescriptors[i];
4
			}
4
			}
5
		}
5
		}
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 in different classes
Number of node comparisons5
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements2
    Number of unmapped statements in the first code fragment1
    Number of unmapped statements in the second code fragment1
    Time elapsed for statement mapping (ms)0.9
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    2
    for (int i = 0; i < properties.length; i++)
    2
    for (int i = 0; i < properties.length; i++)
    1
    for (int i = 0; i < m_optionDescriptors.length; i++)
    Differences
    Expression1Expression2Difference
    propertiesm_optionDescriptorsVARIABLE_NAME_MISMATCH
    java.beans.PropertyDescriptor[]org.apache.commons.cli.avalon.CLOptionDescriptor[]VARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type int of variable properties.length does not match with type int of variable m_optionDescriptors.length
    • Make classes java.beans.PropertyDescriptor[] and org.apache.commons.cli.avalon.CLOptionDescriptor[] extend a common superclass
    1
    for (int i = 0; i < m_optionDescriptors.length; i++)
    3
    if (properties[i].getName().equals(name))
    3
    if (properties[i].getName().equals(name))
    2
    if (m_optionDescriptors[i].getName().equals(name))
    Differences
    Expression1Expression2Difference
    propertiesm_optionDescriptorsVARIABLE_NAME_MISMATCH
    java.beans.PropertyDescriptor[]org.apache.commons.cli.avalon.CLOptionDescriptor[]VARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.beans.PropertyDescriptor[] of variable properties does not match with type org.apache.commons.cli.avalon.CLOptionDescriptor[] of variable m_optionDescriptors
    • Make classes java.beans.PropertyDescriptor[] and org.apache.commons.cli.avalon.CLOptionDescriptor[] extend a common superclass
    2
    if (m_optionDescriptors[i].getName().equals(name))
                                                                      
    3
    return m_optionDescriptors[i];
    Preondition Violations
    Unmatched statement return m_optionDescriptors[i]; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    Unmatched return m_optionDescriptors[i];
    3
    return m_optionDescriptors[i];
    4
    return properties[i];
    4
    return properties[i];
    Preondition Violations
    Unmatched statement return properties[i]; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    Unmatched return properties[i];
                                                    
    Precondition Violations (6)
    Row Violation
    1Type int of variable properties.length does not match with type int of variable m_optionDescriptors.length
    2Type java.beans.PropertyDescriptor[] of variable properties does not match with type org.apache.commons.cli.avalon.CLOptionDescriptor[] of variable m_optionDescriptors
    3Unmatched statement return m_optionDescriptors[i]; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    4Unmatched return m_optionDescriptors[i];
    5Unmatched statement return properties[i]; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    6Unmatched return properties[i];