File[] list = file.listFiles(); for (int i = 0; i < list.length; i++) { list[i].delete(); } // delete folder file.delete();
Object[] array = bccList.getSelectedValues(); for (int j = 0; j < array.length; j++) { dialogAddressbookListModel[2] .removeElement((IHeaderItem) array[j]); }
Clone fragments detected by clone detection tool
File path: /columba-1.4-src/calendar/src/test/java/org/columba/calendar/store/LocalXMLFileStoreTest.java File path: /columba-1.4-src/mail/src/main/java/org/columba/mail/gui/composer/contact/SelectAddressDialog.java
Method name: void tearDown() Method name: void actionPerformed(ActionEvent)
Number of AST nodes: 4 Number of AST nodes: 3
1
File[] list = file.listFiles();
1
Object[] array = bccList.getSelectedValues();
2
		for (int i = 0; i < list.length; i++) {
2
			for (int j = 0; j < array.length; j++) {
3
			list[i].delete();
3
			
4
		}
5
		// delete folder
6
		file.delete();
4
	dialogAddressbookListModel[2]
5
						.removeElement((IHeaderItem) array[j]);
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.3
Clones locationClones are in different classes
Number of node comparisons6
  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 fragment2
    Time elapsed for statement mapping (ms)2.0
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
    1
    File[] list = file.listFiles();
    1
    File[] list = file.listFiles();
    Preondition Violations
    Unmatched statement File[] list=file.listFiles(); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
                                                                    
                                                                                                  
    37
    Object[] array = bccList.getSelectedValues();
    2
    for (int i = 0; i < list.length; i++)
    2
    for (int i = 0; i < list.length; i++)
    38
    for (int j = 0; j < array.length; j++)
    Differences
    Expression1Expression2Difference
    ijVARIABLE_NAME_MISMATCH
    ijVARIABLE_NAME_MISMATCH
    listarrayVARIABLE_NAME_MISMATCH
    java.io.File[]java.lang.Object[]VARIABLE_TYPE_MISMATCH
    ijVARIABLE_NAME_MISMATCH
    Preondition Violations
    Type int of variable list.length does not match with type int of variable array.length
    • Make classes java.io.File[] and java.lang.Object[] extend a common superclass
    38
    for (int j = 0; j < array.length; j++)
    3
    list[i].delete();
    3
    list[i].delete();
    Preondition Violations
    Unmatched statement list[i].delete(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                            
                                                                                                                                                  
    39
    dialogAddressbookListModel[2].removeElement((IHeaderItem)array[j]);
    Preondition Violations
    Unmatched statement dialogAddressbookListModel[2].removeElement((IHeaderItem)array[j]); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    39
    dialogAddressbookListModel[2].removeElement((IHeaderItem)array[j]);
    4
    file.delete();
    4
    file.delete();
    Preondition Violations
    Unmatched statement file.delete(); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
                                      
    Precondition Violations (6)
    Row Violation
    1Unmatched statement File[] list=file.listFiles(); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    2Type int of variable list.length does not match with type int of variable array.length
    3Unmatched statement list[i].delete(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    4Unmatched statement dialogAddressbookListModel[2].removeElement((IHeaderItem)array[j]); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    5Unmatched statement file.delete(); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    6The refactoring of the clones is infeasible, because the number of macthed statements is equal to zero