while (args.hasNext()) { HTTPArgument arg = (HTTPArgument) args.next().getObjectValue(); String value; if (haveContentEncoding){ value = arg.getEncodedValue(contentEncoding); } else { value = arg.getEncodedValue(); } postBody.append(value); }
while (args.hasNext()) { HTTPArgument arg = (HTTPArgument) args.next().getObjectValue(); String value = null; if (haveContentEncoding){ value = arg.getEncodedValue(contentEncoding); } else { value = arg.getEncodedValue(); } putBodyContent.append(value); }
Clone fragments detected by clone detection tool
File path: /jakarta-jmeter-2.3.2/src/org/apache/jmeter/protocol/http/sampler/HTTPSampler2.java File path: /jakarta-jmeter-2.3.2/src/org/apache/jmeter/protocol/http/sampler/HTTPSampler2.java
Method name: String sendPostData(PostMethod) Method name: String sendPutData(PutMethod)
Number of AST nodes: 7 Number of AST nodes: 7
1
while (args.hasNext()) {
1
while (args.hasNext()) {
2
                        HTTPArgument arg = (HTTPArgument) args.next().getObjectValue();
2
                HTTPArgument arg = (HTTPArgument) args.next().getObjectValue();
3
                        String value;
3
                String value
4
        
4
 = null;
5
                if (haveContentEncoding){
5
                if (haveContentEncoding){
6
                        	value = arg.getEncodedValue(contentEncoding);
6
                    value = arg.getEncodedValue(contentEncoding);
7
                        } else {
7
                } else {
8
                        	value = arg.getEncodedValue();
8
                    value = arg.getEncodedValue();
9
                        }
9
                
10
						postBody
10
}
11
.append(value);
11
                putBodyContent.append(value);
12
                    }
12
            }
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 declared in the same class
Number of node comparisons26
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements6
    Number of unmapped statements in the first code fragment1
    Number of unmapped statements in the second code fragment1
    Time elapsed for statement mapping (ms)9.2
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    65
    while (args.hasNext())
    20
    while (args.hasNext())
    66
    HTTPArgument arg = (HTTPArgument)args.next().getObjectValue();
    21
    HTTPArgument arg = (HTTPArgument)args.next().getObjectValue();
                                                
    22
    String value = null;
    Preondition Violations
    Unmatched statement String value=null; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    22
    String value = null;
    67
    String value;
    67
    String value;
    Preondition Violations
    Unmatched statement String value; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                      
    68
    if (haveContentEncoding)
    23
    if (haveContentEncoding)
    69
    value = arg.getEncodedValue(contentEncoding);
    24
    value = arg.getEncodedValue(contentEncoding);
    else
    else
    70
    value = arg.getEncodedValue();
    25
    value = arg.getEncodedValue();
    71
    postBody.append(value);
    71
    postBody.append(value);
    26
    putBodyContent.append(value);
    Differences
    Expression1Expression2Difference
    postBodyputBodyContentVARIABLE_NAME_MISMATCH
    26
    putBodyContent.append(value);
    Precondition Violations (2)
    Row Violation
    1Unmatched statement String value=null; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    2Unmatched statement String value; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted