String regularExpression = headerName + "\\s*:\\s*(.*)$"; //$NON-NLS-1$ Perl5Matcher localMatcher = JMeterUtils.getMatcher(); Pattern pattern = JMeterUtils.getPattern(regularExpression, Perl5Compiler.READ_ONLY_MASK | Perl5Compiler.CASE_INSENSITIVE_MASK | Perl5Compiler.MULTILINE_MASK); if(localMatcher.contains(multiPart, pattern)) { return localMatcher.getMatch().group(1).trim(); } else { return null; }
Perl5Matcher localMatcher = JMeterUtils.getMatcher(); String regularExpression = "^" + HTTPSamplerBase.HEADER_CONTENT_TYPE + ": multipart/form-data; boundary=(.+)$"; Pattern pattern = JMeterUtils.getPattern(regularExpression, Perl5Compiler.READ_ONLY_MASK | Perl5Compiler.CASE_INSENSITIVE_MASK | Perl5Compiler.MULTILINE_MASK); if(localMatcher.contains(requestHeaders, pattern)) { MatchResult match = localMatcher.getMatch(); return match.group(1); } else { return null; }
Clone fragments detected by clone detection tool
File path: /jakarta-jmeter-2.3.2/src/org/apache/jmeter/protocol/http/config/MultipartUrlConfig.java File path: /jakarta-jmeter-2.3.2/test/src/org/apache/jmeter/protocol/http/sampler/TestHTTPSamplersAgainstHttpMirrorServer.java
Method name: String getHeaderValue(String, String) Method name: String getBoundaryStringFromContentType(String)
Number of AST nodes: 6 Number of AST nodes: 7
1
String regularExpression = headerName + "\\s*:\\s*(.*)$"; //$NON-NLS-1$
2
        Perl5Matcher localMatcher = JMeterUtils.getMatcher();
1
Perl5Matcher localMatcher = JMeterUtils.getMatcher();
2
        String regularExpression = "^" + HTTPSamplerBase.HEADER_CONTENT_TYPE + ": multipart/form-data; boundary=(.+)$"; 
3
        Pattern pattern = JMeterUtils.getPattern(regularExpression, Perl5Compiler.READ_ONLY_MASK | Perl5Compiler.CASE_INSENSITIVE_MASK | Perl5Compiler.MULTILINE_MASK);
3
        Pattern pattern = JMeterUtils.getPattern(regularExpression, Perl5Compiler.READ_ONLY_MASK | Perl5Compiler.CASE_INSENSITIVE_MASK | Perl5Compiler.MULTILINE_MASK);
4
        if(localMatcher.contains(multiPart, pattern)) {
4
        if(localMatcher.contains(requestHeaders, pattern)) {
5
            return localMatcher.getMatch()
5
            MatchResult match = localMatcher.getMatch();
6
.group(1).trim();
6
            return match.group(1);
7
        }
7
        }
8
        else {
8
        else {
9
            return null;
9
            return null;
10
        }
10
        }
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 comparisons21
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements5
    Number of unmapped statements in the first code fragment1
    Number of unmapped statements in the second code fragment2
    Time elapsed for statement mapping (ms)1.7
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
    1
    String regularExpression = headerName + "\\s*:\\s*(.*)$";
    1
    String regularExpression = headerName + "\\s*:\\s*(.*)$";
    2
    String regularExpression = "^" + HTTPSamplerBase.HEADER_CONTENT_TYPE + ": multipart/form-data; boundary=(.+)$";
    Differences
    Expression1Expression2Difference
    headerName"^"TYPE_COMPATIBLE_REPLACEMENT
    "\\s*:\\s*(.*)$"HTTPSamplerBase.HEADER_CONTENT_TYPETYPE_COMPATIBLE_REPLACEMENT
    headerName + "\\s*:\\s*(.*)$""^" + HTTPSamplerBase.HEADER_CONTENT_TYPE + ": multipart/form-data; boundary=(.+)$"INFIX_EXTENDED_OPERAND_NUMBER_MISMATCH
    2
    String regularExpression = "^" + HTTPSamplerBase.HEADER_CONTENT_TYPE + ": multipart/form-data; boundary=(.+)$";
    2
    Perl5Matcher localMatcher = JMeterUtils.getMatcher();
    1
    Perl5Matcher localMatcher = JMeterUtils.getMatcher();
    3
    Pattern pattern = JMeterUtils.getPattern(regularExpression, Perl5Compiler.READ_ONLY_MASK | Perl5Compiler.CASE_INSENSITIVE_MASK | Perl5Compiler.MULTILINE_MASK);
    3
    Pattern pattern = JMeterUtils.getPattern(regularExpression, Perl5Compiler.READ_ONLY_MASK | Perl5Compiler.CASE_INSENSITIVE_MASK | Perl5Compiler.MULTILINE_MASK);
    4
    if (localMatcher.contains(multiPart, pattern))
    4
    if (localMatcher.contains(multiPart, pattern))
    4
    if (localMatcher.contains(requestHeaders, pattern))
    Differences
    Expression1Expression2Difference
    multiPartrequestHeadersVARIABLE_NAME_MISMATCH
    4
    if (localMatcher.contains(requestHeaders, pattern))
                                                                                              
    5
    MatchResult match = localMatcher.getMatch();
    5
    return localMatcher.getMatch().group(1).trim();
                                                                                                        
                                                      
    6
    return match.group(1);
    Preondition Violations
    Unmatched return match.group(1);
    6
    return match.group(1);
    else
    else
    6
    return null;
    7
    return null;
    Precondition Violations (1)
    Row Violation
    1Unmatched return match.group(1);