for (int idx = 0; idx < attributes.getLength(); idx++) { String attr = attributes.getQName(idx); if (attr.equals(Constants.ATTRIBUTE_NAME)) { connector.setName(attributes.getValue(idx)); } }
for (int idx = 0; idx < headerSize; idx++) { Header hd = mngr.getHeader(idx); if (HEADER_CONTENT_LENGTH.equalsIgnoreCase(hd.getName())) {// Use this to override file length length = Integer.parseInt(hd.getValue()); } // All the other headers are set up by HTTPSampler2.setupConnection() }
Clone fragments detected by clone detection tool
File path: /jakarta-jmeter-2.3.2/src/org/apache/jmeter/monitor/parser/MonitorHandler.java File path: /jakarta-jmeter-2.3.2/src/org/apache/jmeter/protocol/http/sampler/SoapSampler.java
Method name: void startElement(String, String, String, Attributes) Method name: int setPostHeaders(PostMethod)
Number of AST nodes: 4 Number of AST nodes: 4
1
for (int idx = 0; idx < attributes.getLength(); idx++) {
1
for (int idx = 0; idx < 
2
						String attr = attributes.getQName(idx);
3
						if (attr.equals(Constants.ATTRIBUTE_NAME)) {
4
							connector.setName(attributes
2
headerSize; idx++) {
3
                Header hd = mngr.getHeader(idx);
4
                if (HEADER_CONTENT_LENGTH.equalsIgnoreCase(hd.getName())) {// Use this to override file length
5
.getValue(idx));
5
                	length = Integer.parseInt(hd.getValue());
6
						}
7
					
6
                }
7
                // All the other headers are set up by HTTPSampler2.setupConnection()
8
}
8
            }
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 comparisons9
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements2
    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.0
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    29
    for (int idx = 0; idx < attributes.getLength(); idx++)
    29
    for (int idx = 0; idx < attributes.getLength(); idx++)
    5
    for (int idx = 0; idx < headerSize; idx++)
    Differences
    Expression1Expression2Difference
    attributes.getLength()headerSizeTYPE_COMPATIBLE_REPLACEMENT
    5
    for (int idx = 0; idx < headerSize; idx++)
                                                                      
    6
    Header hd = mngr.getHeader(idx);
    Preondition Violations
    Unmatched statement Header hd=mngr.getHeader(idx); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    6
    Header hd = mngr.getHeader(idx);
    30
    String attr = attributes.getQName(idx);
    30
    String attr = attributes.getQName(idx);
    Preondition Violations
    Unmatched statement String attr=attributes.getQName(idx); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                      
    31
    if (attr.equals(Constants.ATTRIBUTE_NAME))
    31
    if (attr.equals(Constants.ATTRIBUTE_NAME))
    7
    if (HEADER_CONTENT_LENGTH.equalsIgnoreCase(hd.getName()))
    Differences
    Expression1Expression2Difference
    equalsequalsIgnoreCaseMETHOD_INVOCATION_NAME_MISMATCH
    Constants.ATTRIBUTE_NAMEhd.getName()TYPE_COMPATIBLE_REPLACEMENT
    attrHEADER_CONTENT_LENGTHVARIABLE_NAME_MISMATCH
    7
    if (HEADER_CONTENT_LENGTH.equalsIgnoreCase(hd.getName()))
                                                                                        
    8
    length = Integer.parseInt(hd.getValue());
    Preondition Violations
    Unmatched statement length=Integer.parseInt(hd.getValue()); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    8
    length = Integer.parseInt(hd.getValue());
    32
    connector.setName(attributes.getValue(idx));
    32
    connector.setName(attributes.getValue(idx));
    Preondition Violations
    Unmatched statement connector.setName(attributes.getValue(idx)); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                                    
    Precondition Violations (4)
    Row Violation
    1Unmatched statement Header hd=mngr.getHeader(idx); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    2Unmatched statement String attr=attributes.getQName(idx); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    3Unmatched statement length=Integer.parseInt(hd.getValue()); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    4Unmatched statement connector.setName(attributes.getValue(idx)); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted