File[] list = file.listFiles(); for (int i = 0; i < list.length; i++) { list[i].delete(); } // delete folder file.delete();
File[] pluginFolders = PluginFinder.searchPlugins(); for (int i = 0; i < pluginFolders.length; i++) { System.out.println("plugin-directory=" + pluginFolders[i]); }
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/core/src/test/java/org/columba/core/plugin/PluginFinderTest.java
Method name: void tearDown() Method name: void test()
Number of AST nodes: 4 Number of AST nodes: 3
1
File[] list = file.listFiles();
1
File[] pluginFolders = PluginFinder.searchPlugins();
2
		for (int i = 0; i < list.length; i++) {
2
		for (int i = 0; i < pluginFolders.length; i++) {
3
			list[i].delete();
3
			
4
		}
5
		// delete folder
6
		file.delete();
4
System.out.println("plugin-directory=" + pluginFolders[i]);
5
		}
Summary
Number of common nesting structure subtrees1
Number of refactorable cases1
Number of non-refactorable cases0
Time elapsed for finding largest common nesting structure subtrees (ms)0.2
Clones locationClones are in different classes having the same super class
Number of node comparisons6
  1. {Refactorable}
    Mapping Summary
    Number of mapped statements2
    Number of unmapped statements in the first code fragment2
    Number of unmapped statements in the second code fragment1
    Time elapsed for statement mapping (ms)4.2
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
    1
    File[] list = file.listFiles();
    1
    File[] list = file.listFiles();
    1
    File[] pluginFolders = PluginFinder.searchPlugins();
    Differences
    Expression1Expression2Difference
    listpluginFoldersVARIABLE_NAME_MISMATCH
    file.listFiles()PluginFinder.searchPlugins()TYPE_COMPATIBLE_REPLACEMENT
    Preondition Violations
    Expression file.listFiles() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    1
    File[] pluginFolders = PluginFinder.searchPlugins();
    2
    for (int i = 0; i < list.length; i++)
    2
    for (int i = 0; i < list.length; i++)
    2
    for (int i = 0; i < pluginFolders.length; i++)
    Differences
    Expression1Expression2Difference
    listpluginFoldersVARIABLE_NAME_MISMATCH
    2
    for (int i = 0; i < pluginFolders.length; i++)
                                                                                                                                
    3
    System.out.println("plugin-directory=" + pluginFolders[i]);
    Preondition Violations
    Unmatched statement System.out.println("plugin-directory=" + pluginFolders[i]); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    3
    System.out.println("plugin-directory=" + pluginFolders[i]);
    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
                                            
    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 (4)
    Row Violation
    1Expression file.listFiles() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Unmatched statement System.out.println("plugin-directory=" + pluginFolders[i]); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    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 file.delete(); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted