FileFilter[] filters = jfc.getChoosableFileFilters(); for (int x = 0; x < filters.length; x++) { jfc.removeChoosableFileFilter(filters[x]); }
if (listenerSet != null && listenerSet.size() > 0) { Object[] listeners = listenerSet.toArray(); for (int i = 0; i < listeners.length; i++) { ((ActionListener) listeners[i]).actionPerformed(e); } }
Clone fragments detected by clone detection tool
File path: /jakarta-jmeter-2.3.2/src/org/apache/jmeter/gui/util/FileDialoger.java File path: /jakarta-jmeter-2.3.2/src/org/apache/jmeter/report/gui/action/ReportActionRouter.java
Method name: void clearFileFilters() Method name: void preActionPerformed(Class, ActionEvent)
Number of AST nodes: 3 Number of AST nodes: 4
1
FileFilter[] filters = jfc.getChoosableFileFilters
1
if (listenerSet != null && listenerSet.size() > 0) {
2
();
2
				Object[] listeners = listenerSet.toArray();
3
		for (int x = 0; x < filters.length; x++) {
3
				for (int i = 0; i < listeners.length; i++) {
4
			jfc.removeChoosableFileFilter(filters[x]);
4
			
5
		((ActionListener) listeners[i]).actionPerformed(e);
6
				}
5
		}
7
			}
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 comparisons5
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements1
    Number of unmapped statements in the first code fragment2
    Number of unmapped statements in the second code fragment2
    Time elapsed for statement mapping (ms)1.2
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    FileFilter[] filters = jfc.getChoosableFileFilters();
                                                                                                                
                                                                                            
    4
    Object[] listeners = listenerSet.toArray();
    Preondition Violations
    Unmatched statement Object[] listeners=listenerSet.toArray(); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    4
    Object[] listeners = listenerSet.toArray();
    2
    for (int x = 0; x < filters.length; x++)
    2
    for (int x = 0; x < filters.length; x++)
    5
    for (int i = 0; i < listeners.length; i++)
    Differences
    Expression1Expression2Difference
    xiVARIABLE_NAME_MISMATCH
    xiVARIABLE_NAME_MISMATCH
    filterslistenersVARIABLE_NAME_MISMATCH
    javax.swing.filechooser.FileFilter[]java.lang.Object[]VARIABLE_TYPE_MISMATCH
    xiVARIABLE_NAME_MISMATCH
    Preondition Violations
    Type int of variable filters.length does not match with type int of variable listeners.length
    • Make classes javax.swing.filechooser.FileFilter[] and java.lang.Object[] extend a common superclass
    5
    for (int i = 0; i < listeners.length; i++)
    3
    jfc.removeChoosableFileFilter(filters[x]);
    3
    jfc.removeChoosableFileFilter(filters[x]);
    Preondition Violations
    Unmatched statement jfc.removeChoosableFileFilter(filters[x]); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                              
                                                                                                              
    6
    ((ActionListener)listeners[i]).actionPerformed(e);
    Preondition Violations
    Unmatched statement ((ActionListener)listeners[i]).actionPerformed(e); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    6
    ((ActionListener)listeners[i]).actionPerformed(e);
    Precondition Violations (5)
    Row Violation
    1Unmatched statement Object[] listeners=listenerSet.toArray(); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    2Type int of variable filters.length does not match with type int of variable listeners.length
    3Unmatched statement jfc.removeChoosableFileFilter(filters[x]); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    4Unmatched statement ((ActionListener)listeners[i]).actionPerformed(e); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    5The refactoring of the clones is infeasible, because the number of macthed statements is equal to zero