if (listenerSet != null && listenerSet.size() > 0) { Object[] listeners = listenerSet.toArray(); for (int i = 0; i < listeners.length; i++) { ((ActionListener) listeners[i]).actionPerformed(e); } }
FileFilter[] filters = jfc.getChoosableFileFilters(); for (int x = 0; x < filters.length; x++) { jfc.removeChoosableFileFilter(filters[x]); }
Clone fragments detected by clone detection tool
File path: /jakarta-jmeter-2.3.2/src/org/apache/jmeter/gui/action/ActionRouter.java File path: /jakarta-jmeter-2.3.2/src/org/apache/jmeter/gui/util/ReportFileDialoger.java
Method name: void postActionPerformed(Class, ActionEvent) Method name: void clearFileFilters()
Number of AST nodes: 4 Number of AST nodes: 3
1
if (listenerSet != null && listenerSet.size() > 0) {
2
				Object[] listeners = listenerSet.toArray();
1
FileFilter[] filters = jfc.getChoosableFileFilters();
3
				for (int i = 0; i < listeners.length; i++) {
2
		for (int x = 0; x < filters.length; x++) {
4
					((ActionListener) listeners[i]).actionPerformed(e);
3
			jfc.removeChoosableFileFilter(filters[x])
5
				}
6
	
4
;
7
		}
5
		}
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();
    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
                                                                                            
    5
    for (int i = 0; i < listeners.length; i++)
    5
    for (int i = 0; i < listeners.length; i++)
    2
    for (int x = 0; x < filters.length; x++)
    Differences
    Expression1Expression2Difference
    ixVARIABLE_NAME_MISMATCH
    ixVARIABLE_NAME_MISMATCH
    listenersfiltersVARIABLE_NAME_MISMATCH
    java.lang.Object[]javax.swing.filechooser.FileFilter[]VARIABLE_TYPE_MISMATCH
    ixVARIABLE_NAME_MISMATCH
    Preondition Violations
    Type int of variable listeners.length does not match with type int of variable filters.length
    • Make classes java.lang.Object[] and javax.swing.filechooser.FileFilter[] extend a common superclass
    2
    for (int x = 0; x < filters.length; 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
    3
    jfc.removeChoosableFileFilter(filters[x]);
    6
    ((ActionListener)listeners[i]).actionPerformed(e);
    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
                                                                                                              
    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 listeners.length does not match with type int of variable filters.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