FileFilter[] filters = jfc.getChoosableFileFilters(); for (int x = 0; x < filters.length; x++) { jfc.removeChoosableFileFilter(filters[x]); }
if (save.saveAssertions()) { AssertionResult[] assertionResults = res.getAssertionResults(); for (int i = 0; i < assertionResults.length; i++) { writeItem(assertionResults[i], context, writer); } }
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/save/converters/SampleResultConverter.java
Method name: void clearFileFilters() Method name: void saveAssertions(HierarchicalStreamWriter, MarshallingContext, SampleResult, SampleSaveConfiguration)
Number of AST nodes: 3 Number of AST nodes: 4
1
FileFilter[] filter
1
if (save.saveAssertions()) {
2
s = jfc.getChoosableFileFilters();
2
			AssertionResult[] assertionResults = res.getAssertionResults();
3
		for (int x = 0; x < filters.length; x++) {
3
			for (int i = 0; i < assertionResults.length; i++) {
4
			jfc.removeChoosableFileFilter(filters[x]);
4
				writeItem(assertionResults[i], context, writer);
5
			}
5
		}
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 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.3
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    FileFilter[] filters = jfc.getChoosableFileFilters();
                                                                                                                
                                                                                                                                    
    2
    AssertionResult[] assertionResults = res.getAssertionResults();
    2
    for (int x = 0; x < filters.length; x++)
    2
    for (int x = 0; x < filters.length; x++)
    3
    for (int i = 0; i < assertionResults.length; i++)
    Differences
    Expression1Expression2Difference
    xiVARIABLE_NAME_MISMATCH
    xiVARIABLE_NAME_MISMATCH
    filtersassertionResultsVARIABLE_NAME_MISMATCH
    javax.swing.filechooser.FileFilter[]org.apache.jmeter.assertions.AssertionResult[]VARIABLE_TYPE_MISMATCH
    xiVARIABLE_NAME_MISMATCH
    Preondition Violations
    Type int of variable filters.length does not match with type int of variable assertionResults.length
    • Make classes javax.swing.filechooser.FileFilter[] and org.apache.jmeter.assertions.AssertionResult[] extend a common superclass
    3
    for (int i = 0; i < assertionResults.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
                                                                                              
                                                                                                      
    4
    writeItem(assertionResults[i], context, writer);
    Preondition Violations
    Unmatched statement writeItem(assertionResults[i],context,writer); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    4
    writeItem(assertionResults[i], context, writer);
    Precondition Violations (4)
    Row Violation
    1Type int of variable filters.length does not match with type int of variable assertionResults.length
    2Unmatched 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
    3Unmatched statement writeItem(assertionResults[i],context,writer); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    4The refactoring of the clones is infeasible, because the number of macthed statements is equal to zero