/** * Build message with misssing labels per bundle * @param missingLabelsPerBundle * @return String */ private String printLabels(Map<String, Map<String, String>> missingLabelsPerBundle) { StringBuilder builder = new StringBuilder(); for (Iterator<Map.Entry<String,Map<String, String>>> iterator = missingLabelsPerBundle.entrySet().iterator(); iterator.hasNext();) { Map.Entry<String,Map<String, String>> entry = iterator.next(); builder.append("Missing labels in bundle:"+entry.getKey()+"\r\n"); for (Iterator<Map.Entry<String,String>> it2 = entry.getValue().entrySet().iterator(); it2.hasNext();) { Map.Entry<String,String> entry2 = it2.next(); builder.append(entry2.getKey()+"="+entry2.getValue()+"\r\n"); } builder.append("======================================================\r\n"); } return builder.toString(); }
public String convertSoapHeaders(Map<String, String> ht) { StringBuilder buf = new StringBuilder(); for (Entry<String, String> entry : ht.entrySet()) { buf.append(entry.getKey()).append("=").append(entry.getValue()).append("\n"); //$NON-NLS-1$ //$NON-NLS-2$ } return buf.toString(); }
Clone fragments detected by clone detection tool
File path: /apache-jmeter-2.11/test/src/org/apache/jmeter/resources/PackageTest.java File path: /apache-jmeter-2.11/src/protocol/http/org/apache/jmeter/protocol/http/sampler/WebServiceSampler.java
Method name: String printLabels(Map>) Method name: String convertSoapHeaders(Map)
Number of AST nodes: 3 Number of AST nodes: 2
1
/**
1
public String convertSoapHeaders(Map<String, String> ht) {
2
     * Build message with misssing labels per bundle
2
        StringBuilder buf = new StringBuilder();
3
     * @param missingLabelsPerBundle
3
        for (Entry<String, String> entry : ht.entrySet()) {
4
     * @return String
4
            buf.append(entry.getKey()).append("=").append(entry.getValue()).append("\n"); //$NON-NLS-1$ //$NON-NLS-2$
5
     */
5
        }
6
    private String printLabels(Map<String, Map<String, String>> missingLabelsPerBundle) {
6
        return buf.toString();
7
        StringBuilder builder = new StringBuilder();
7
    }
8
        for (Iterator<Map.Entry<String,Map<String, String>>> iterator =  missingLabelsPerBundle.entrySet().iterator(); iterator.hasNext();) {
9
            Map.Entry<String,Map<String, String>> entry = iterator.next();
10
            builder.append("Missing labels in bundle:"+entry.getKey()+"\r\n");
11
            for (Iterator<Map.Entry<String,String>> it2 =  entry.getValue().entrySet().iterator(); it2.hasNext();) {
12
                Map.Entry<String,String> entry2 = it2.next();
13
                builder.append(entry2.getKey()+"="+entry2.getValue()+"\r\n");
14
            }
15
            builder.append("======================================================\r\n");
16
        }
17
        return builder.toString();
18
    }
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements3
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)0.0
    Similarity Score0.750
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    5
    for (Iterator<Map.Entry<String, String>> it2 = entry.getValue().entrySet().iterator(); it2.hasNext(); )
    5
    for (Iterator<Map.Entry<String, String>> it2 = entry.getValue().entrySet().iterator(); it2.hasNext(); )
    2
    for (Entry<String, String> entry : ht.entrySet())
    Differences
    Expression1Expression2Difference
    entry2entryVARIABLE_NAME_MISMATCH
    entry.getValue()htTYPE_COMPATIBLE_REPLACEMENT
    2
    for (Entry<String, String> entry : ht.entrySet())
    6
    Map.Entry<String, String> entry2 = it2.next();
    6
    Map.Entry<String, String> entry2 = it2.next();
    Differences
    Expression1Expression2Difference
    entry2entryVARIABLE_NAME_MISMATCH
                                                                                                
    7
    builder.append(entry2.getKey() + "=" + entry2.getValue() + "\r\n");
    7
    builder.append(entry2.getKey() + "=" + entry2.getValue() + "\r\n");
    3
    buf.append(entry.getKey()).append("=").append(entry.getValue()).append("\n");
    Differences
    Expression1Expression2Difference
    entry2.getKey() + "=" + entry2.getValue()+ "\r\n""\n"TYPE_COMPATIBLE_REPLACEMENT
    builderbuf.append(entry.getKey()).append("=").append(entry.getValue())TYPE_COMPATIBLE_REPLACEMENT
    Preondition Violations
    Expression buf.append(entry.getKey()).append("=").append(entry.getValue()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3
    buf.append(entry.getKey()).append("=").append(entry.getValue()).append("\n");
    Precondition Violations (1)
    Row Violation
    1Expression buf.append(entry.getKey()).append("=").append(entry.getValue()) cannot be parameterized, because it has dependencies to/from statements that will be extracted