String[] dataArray = p_model.getData().getColumn(colName); List list = new LinkedList(); for (int i = 0; i < dataArray.length; i++) { list.add(dataArray[i]); } return list;
if (save.saveAssertions()) { AssertionResult[] assertionResults = res.getAssertionResults(); for (int i = 0; i < assertionResults.length; i++) { writeItem(assertionResults[i], context, writer); } }
Clone fragments detected by clone detection tool
File path: /jakarta-jmeter-2.3.2/src/org/apache/jmeter/protocol/http/proxy/gui/ProxyControlGui.java File path: /jakarta-jmeter-2.3.2/src/org/apache/jmeter/save/converters/SampleResultConverter.java
Method name: List getDataList(PowerTableModel, String) Method name: void saveAssertions(HierarchicalStreamWriter, MarshallingContext, SampleResult, SampleSaveConfiguration)
Number of AST nodes: 5 Number of AST nodes: 4
1
String[] dataArray = p_model.getData().getColumn(colName);
2
		List list = new LinkedList
1
if (save.saveAssertions()) {
3
();
2
			AssertionResult[] assertionResults = res.getAssertionResults();
4
		for (int i = 0; i < dataArray.length; i++) {
3
			for (int i = 0; i < assertionResults.length; i++) {
5
			list.add(dataArray[i]);
4
				writeItem(assertionResults[i], context, writer);
6
		}
5
			}
7
		return list;
6
		}
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 in different classes
Number of node comparisons7
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements1
    Number of unmapped statements in the first code fragment4
    Number of unmapped statements in the second code fragment2
    Time elapsed for statement mapping (ms)0.6
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
    1
    String[] dataArray = p_model.getData().getColumn(colName);
                                                                                                                          
                                                                                                                                    
    2
    AssertionResult[] assertionResults = res.getAssertionResults();
    2
    List list = new LinkedList();
                                                                
    3
    for (int i = 0; i < dataArray.length; i++)
    3
    for (int i = 0; i < dataArray.length; i++)
    3
    for (int i = 0; i < assertionResults.length; i++)
    Differences
    Expression1Expression2Difference
    dataArrayassertionResultsVARIABLE_NAME_MISMATCH
    java.lang.String[]org.apache.jmeter.assertions.AssertionResult[]VARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.lang.String[] of variable dataArray does not match with type org.apache.jmeter.assertions.AssertionResult[] of variable assertionResults
    • Make classes java.lang.String[] and org.apache.jmeter.assertions.AssertionResult[] extend a common superclass
    3
    for (int i = 0; i < assertionResults.length; i++)
                                                                                                      
    4
    writeItem(assertionResults[i], context, writer);
    Preondition Violations
    Unmatched statement writeItem(assertionResults[i],context,writer); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    4
    writeItem(assertionResults[i], context, writer);
    4
    list.add(dataArray[i]);
    4
    list.add(dataArray[i]);
    Preondition Violations
    Unmatched statement list.add(dataArray[i]); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                        
    5
    return list;
    5
    return list;
    Preondition Violations
    Unmatched return list;
                                  
    Precondition Violations (4)
    Row Violation
    1Type java.lang.String[] of variable dataArray does not match with type org.apache.jmeter.assertions.AssertionResult[] of variable assertionResults
    2Unmatched statement writeItem(assertionResults[i],context,writer); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    3Unmatched statement list.add(dataArray[i]); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    4Unmatched return list;