String sectionName = section.getName(); if (sectionName == null) { throw new BuildException("Sections must have a name"); } sections.put(sectionName, section); if (!sectionIndex.contains(sectionName)) { sectionIndex.addElement(sectionName); }
if (attribute == null) { return; } String attributeKey = attribute.getKey(); attributes.put(attributeKey, attribute); if (!attributeIndex.contains(attributeKey)) { attributeIndex.addElement(attributeKey); }
Clone fragments detected by clone detection tool
File path: /apache-ant-1.7.0/src/org/apache/tools/ant/taskdefs/Manifest.java File path: /apache-ant-1.7.0/src/org/apache/tools/ant/taskdefs/Manifest.java
Method name: void addConfiguredSection(Section) Method name: void storeAttribute(Attribute)
Number of AST nodes: 6 Number of AST nodes: 6
1
String sectionName = section.getName();
2
        if (sectionName == null) {
3
            throw new BuildException("Sections must have a name"
1
if (attribute == null) {
2
                return;
3
            }
4
);
4
            String attributeKey = attribute.getKey();
5
        }
5
        
6
        sections.put(sectionName, section);
6
    
7
attributes.put(attributeKey, attribute);
7
        if (!sectionIndex.contains(sectionName)) {
8
            if (!attributeIndex.contains(attributeKey)) {
8
            sectionIndex.addElement(sectionName);
9
                attributeIndex.addElement(
10
attributeKey);
9
        }
11
            }
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 the same java file
Number of node comparisons17
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements4
    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.3
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    String sectionName = section.getName();
                                                                                    
    2
    if (sectionName == null)
    2
    if (sectionName == null)
    1
    if (attribute == null)
    Differences
    Expression1Expression2Difference
    sectionNameattributeVARIABLE_NAME_MISMATCH
    java.lang.Stringorg.apache.tools.ant.taskdefs.Manifest.AttributeVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.lang.String of variable sectionName does not match with type org.apache.tools.ant.taskdefs.Manifest.Attribute of variable attribute
    • Make classes java.lang.String and org.apache.tools.ant.taskdefs.Manifest.Attribute extend a common superclass
    1
    if (attribute == null)
                        
    2
    return;
    Preondition Violations
    Unmatched return;
    2
    return;
    3
    throw new BuildException("Sections must have a name");
    3
    throw new BuildException("Sections must have a name");
    Preondition Violations
    Unmatched throw new BuildException("Sections must have a name");
                                                                                                                      
                                                                                        
    3
    String attributeKey = attribute.getKey();
    4
    sections.put(sectionName, section);
    4
    sections.put(sectionName, section);
    4
    attributes.put(attributeKey, attribute);
    Differences
    Expression1Expression2Difference
    sectionNameattributeKeyVARIABLE_NAME_MISMATCH
    sectionattributeVARIABLE_NAME_MISMATCH
    org.apache.tools.ant.taskdefs.Manifest.Sectionorg.apache.tools.ant.taskdefs.Manifest.AttributeVARIABLE_TYPE_MISMATCH
    sectionsattributesVARIABLE_NAME_MISMATCH
    Preondition Violations
    Type org.apache.tools.ant.taskdefs.Manifest.Section of variable section does not match with type org.apache.tools.ant.taskdefs.Manifest.Attribute of variable attribute
    • Make classes org.apache.tools.ant.taskdefs.Manifest.Section and org.apache.tools.ant.taskdefs.Manifest.Attribute extend a common superclass
    4
    attributes.put(attributeKey, attribute);
    5
    if (!sectionIndex.contains(sectionName))
    5
    if (!sectionIndex.contains(sectionName))
    5
    if (!attributeIndex.contains(attributeKey))
    Differences
    Expression1Expression2Difference
    sectionNameattributeKeyVARIABLE_NAME_MISMATCH
    sectionIndexattributeIndexVARIABLE_NAME_MISMATCH
    5
    if (!attributeIndex.contains(attributeKey))
    6
    sectionIndex.addElement(sectionName);
    6
    sectionIndex.addElement(sectionName);
    6
    attributeIndex.addElement(attributeKey);
    Differences
    Expression1Expression2Difference
    sectionNameattributeKeyVARIABLE_NAME_MISMATCH
    sectionIndexattributeIndexVARIABLE_NAME_MISMATCH
    6
    attributeIndex.addElement(attributeKey);
    Precondition Violations (4)
    Row Violation
    1Type java.lang.String of variable sectionName does not match with type org.apache.tools.ant.taskdefs.Manifest.Attribute of variable attribute
    2Unmatched return;
    3Unmatched throw new BuildException("Sections must have a name");
    4Type org.apache.tools.ant.taskdefs.Manifest.Section of variable section does not match with type org.apache.tools.ant.taskdefs.Manifest.Attribute of variable attribute