if (key.equals("name")) { name = value; } else if (key.equals("id")) { id = value; } else if (key.equals("basedir")) { baseDir = value; } else { throw new SAXParseException("Unexpected attribute \"" + attrs.getName(i) + "\"", helperImpl.locator); }
if (filter.equalsIgnoreCase("all")) { show = SHOW_ALL; } else if (filter.equalsIgnoreCase("existing")) { show = SHOW_EXISTING; } else if (filter.equalsIgnoreCase("non-existing")) { show = SHOW_NON_EXISTING; } else { throw new BuildException("P4Fstat: ShowFilter should be one of: " + "all, existing, non-existing"); }
Clone fragments detected by clone detection tool
File path: /apache-ant-1.7.0/src/org/apache/tools/ant/helper/ProjectHelperImpl.java File path: /apache-ant-1.7.0/src/org/apache/tools/ant/taskdefs/optional/perforce/P4Fstat.java
Method name: void init(String, AttributeList) Method name: void setShowFilter(String)
Number of AST nodes: 7 Number of AST nodes: 7
1
if (key.equals("name")) {
1
if (filter.equalsIgnoreCase("all")) {
2
                    name = value;
2
            
3
       
3
show = SHOW_ALL;
4
         } else if (key.equals("id")) {
4
        } else if (filter.equals
5
                    id = value;
6
        
5
IgnoreCase("existing")) {
6
            show = SHOW_EXISTING;
7
        } else if (key.equals("basedir")) {
7
        } else if (filter.equalsIgnoreCase("non-existing")) {
8
                    baseDir = value;
8
            show = SHOW_NON_EXISTING;
9
                } else {
9
        } else {
10
                    throw new SAXParseException("Unexpected attribute \"" + attrs.getName(i) + "\"",
10
            throw new BuildException("
11
                                                helperImpl.locator);
12
        
11
P4Fstat: ShowFilter should be one of: "
12
                + "all, existing, non-existing");
13
        }
13
        }
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.5
Clones locationClones are in different classes
Number of node comparisons31
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements3
    Number of unmapped statements in the first code fragment4
    Number of unmapped statements in the second code fragment4
    Time elapsed for statement mapping (ms)1.5
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
    10
    else if (key.equals("name"))
    10
    else if (key.equals("name"))
    5
    else if (filter.equalsIgnoreCase("non-existing"))
    Differences
    Expression1Expression2Difference
    equalsequalsIgnoreCaseMETHOD_INVOCATION_NAME_MISMATCH
    "name""non-existing"LITERAL_VALUE_MISMATCH
    keyfilterVARIABLE_NAME_MISMATCH
    5
    else if (filter.equalsIgnoreCase("non-existing"))
                                                        
    6
    show = SHOW_NON_EXISTING;
            
    else
                                                                                                                                                                                                                
    7
    throw new BuildException("P4Fstat: ShowFilter should be one of: " + "all, existing, non-existing");
    Preondition Violations
    Unmatched throw new BuildException("P4Fstat: ShowFilter should be one of: " + "all, existing, non-existing");
    7
    throw new BuildException("P4Fstat: ShowFilter should be one of: " + "all, existing, non-existing");
    11
    name = value;
                                  
    12
    else if (key.equals("id"))
    12
    else if (key.equals("id"))
    3
    else if (filter.equalsIgnoreCase("existing"))
    Differences
    Expression1Expression2Difference
    equalsequalsIgnoreCaseMETHOD_INVOCATION_NAME_MISMATCH
    "id""existing"LITERAL_VALUE_MISMATCH
    keyfilterVARIABLE_NAME_MISMATCH
    3
    else if (filter.equalsIgnoreCase("existing"))
    13
    id = value;
                              
    14
    else if (key.equals("basedir"))
    14
    else if (key.equals("basedir"))
    1
    else if (filter.equalsIgnoreCase("all"))
    Differences
    Expression1Expression2Difference
    equalsequalsIgnoreCaseMETHOD_INVOCATION_NAME_MISMATCH
    "basedir""all"LITERAL_VALUE_MISMATCH
    keyfilterVARIABLE_NAME_MISMATCH
    1
    else if (filter.equalsIgnoreCase("all"))
                                      
    2
    show = SHOW_ALL;
    15
    baseDir = value;
                                        
    else
            
    16
    throw new SAXParseException("Unexpected attribute \"" + attrs.getName(i) + "\"", helperImpl.locator);
    16
    throw new SAXParseException("Unexpected attribute \"" + attrs.getName(i) + "\"", helperImpl.locator);
    Preondition Violations
    Unmatched throw new SAXParseException("Unexpected attribute \"" + attrs.getName(i) + "\"",helperImpl.locator);
                                                                                                                                                                                                                    
                                                
    4
    show = SHOW_EXISTING;
    Precondition Violations (2)
    Row Violation
    1Unmatched throw new BuildException("P4Fstat: ShowFilter should be one of: " + "all, existing, non-existing");
    2Unmatched throw new SAXParseException("Unexpected attribute \"" + attrs.getName(i) + "\"",helperImpl.locator);