Object[] rowData = new Object[getColumnCount()]; for (int i = 0; i < rowData.length; i++) { rowData[i] = model.getColumnValue(i, row); } return rowData;
String[] items = new String[choiceList.getItemCount()]; for (int i = 0; i < items.length; i++) { items[i] = (String) choiceList.getItemAt(i); } return items;
Clone fragments detected by clone detection tool
File path: /jakarta-jmeter-2.3.2/src/org/apache/jmeter/gui/util/PowerTableModel.java File path: /jakarta-jmeter-2.3.2/src/org/apache/jorphan/gui/JLabeledChoice.java
Method name: Object[] getRowData(int) Method name: String[] getItems()
Number of AST nodes: 4 Number of AST nodes: 4
1
Object[] rowData = new Object[getColumnCount()];
1
String[] items = new String[choiceList.getItemCount()];
2
		for (int i = 0; i < rowData.length; i++) {
2
		for (int i = 0; i < items.length; i++) {
3
			rowData[i] = model.getColumnValue(i, row);
3
			items[i] = (String) choiceList.getItemAt(i);
4
		}
4
		}
5
		return rowData;
5
		return items;
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 comparisons8
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements1
    Number of unmapped statements in the first code fragment3
    Number of unmapped statements in the second code fragment3
    Time elapsed for statement mapping (ms)0.5
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
                                                                                                                    
    1
    String[] items = new String[choiceList.getItemCount()];
    1
    Object[] rowData = new Object[getColumnCount()];
                                                                                                      
    2
    for (int i = 0; i < rowData.length; i++)
    2
    for (int i = 0; i < rowData.length; i++)
    2
    for (int i = 0; i < items.length; i++)
    Differences
    Expression1Expression2Difference
    rowDataitemsVARIABLE_NAME_MISMATCH
    java.lang.Object[]java.lang.String[]VARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.lang.Object[] of variable rowData does not match with type java.lang.String[] of variable items
    • Make classes java.lang.Object[] and java.lang.String[] extend a common superclass
    2
    for (int i = 0; i < items.length; i++)
                                                                                            
    3
    items[i] = (String)choiceList.getItemAt(i);
    Preondition Violations
    Unmatched statement items[i]=(String)choiceList.getItemAt(i); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    3
    items[i] = (String)choiceList.getItemAt(i);
    3
    rowData[i] = model.getColumnValue(i, row);
    3
    rowData[i] = model.getColumnValue(i, row);
    Preondition Violations
    Unmatched statement rowData[i]=model.getColumnValue(i,row); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                        
                                    
    4
    return items;
    Preondition Violations
    Unmatched return items;
    4
    return items;
    4
    return rowData;
    4
    return rowData;
    Preondition Violations
    Unmatched return rowData;
                                        
    Precondition Violations (5)
    Row Violation
    1Type java.lang.Object[] of variable rowData does not match with type java.lang.String[] of variable items
    2Unmatched statement items[i]=(String)choiceList.getItemAt(i); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    3Unmatched statement rowData[i]=model.getColumnValue(i,row); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    4Unmatched return items;
    5Unmatched return rowData;