HTTPSamplerBase sampler = HTTPSamplerFactory.newInstance();// create default sampler modifyTestElement(sampler); return sampler;
while (i.hasNext()) { JavaSampler sampler = (JavaSampler) i.next(); sampler.releaseJavaClient(); i.remove(); }
Clone fragments detected by clone detection tool
File path: /jakarta-jmeter-2.3.2/src/org/apache/jmeter/protocol/http/control/gui/HttpTestSampleGui.java File path: /jakarta-jmeter-2.3.2/src/org/apache/jmeter/protocol/java/sampler/JavaSampler.java
Method name: TestElement createTestElement() Method name: void testEnded()
Number of AST nodes: 3 Number of AST nodes: 4
1
HTTP
1
while (i.hasNext()) {
2
SamplerBase sampler = HTTPSamplerFactory.newInstance();// create default sampler
2
				JavaSampler sampler = (JavaSampler
3
		modifyTestElement(sampler);
4
		return sampler;
3
) i.next();
4
				sampler.releaseJavaClient();
5
				i.remove();
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.0
Clones locationClones are in different classes
Number of node comparisons9
  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)0.0
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    HTTPSamplerBase sampler = HTTPSamplerFactory.newInstance();
    1
    HTTPSamplerBase sampler = HTTPSamplerFactory.newInstance();
    5
    JavaSampler sampler = (JavaSampler)i.next();
    Differences
    Expression1Expression2Difference
    org.apache.jmeter.protocol.http.sampler.HTTPSamplerBaseorg.apache.jmeter.protocol.java.sampler.JavaSamplerSUBCLASS_TYPE_MISMATCH
    org.apache.jmeter.protocol.http.sampler.HTTPSamplerBaseorg.apache.jmeter.protocol.java.sampler.JavaSamplerSUBCLASS_TYPE_MISMATCH
    org.apache.jmeter.protocol.http.sampler.HTTPSamplerBaseorg.apache.jmeter.protocol.java.sampler.JavaSamplerSUBCLASS_TYPE_MISMATCH
    HTTPSamplerFactory.newInstance()(JavaSampler)i.next()TYPE_COMPATIBLE_REPLACEMENT
    Preondition Violations
    Expression (JavaSampler)i.next() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    5
    JavaSampler sampler = (JavaSampler)i.next();
    2
    modifyTestElement(sampler);
    2
    modifyTestElement(sampler);
    Preondition Violations
    Unmatched statement modifyTestElement(sampler); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                
    3
    return sampler;
    3
    return sampler;
    Preondition Violations
    Unmatched statement return sampler; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    Unmatched return sampler;
                                        
                                                                  
    6
    sampler.releaseJavaClient();
    Preondition Violations
    Unmatched statement sampler.releaseJavaClient(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    6
    sampler.releaseJavaClient();
                                
    7
    i.remove();
    Precondition Violations (6)
    Row Violation
    1Expression (JavaSampler)i.next() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Unmatched statement modifyTestElement(sampler); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    3Unmatched statement return sampler; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    4Unmatched return sampler;
    5Unmatched statement sampler.releaseJavaClient(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    6Clone fragment #1 returns variable sampler with type org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase , while Clone fragment #2 returns variable sampler with type org.apache.jmeter.protocol.java.sampler.JavaSampler