String propertyName = (String) j.nextElement(); fragment = getProject().getProperty(propertyName); if (fragment == null) { if (props.containsKey(propertyName)) { resolve(props, propertyName, referencesSeen); fragment = props.getProperty(propertyName); } else { fragment = "${" + propertyName + "}"; } }
String buf = FileUtils.readFully(br); if (buf == null) { buf = ""; } String res = doReplace(regex, subs, buf, options); if (!res.equals(buf)) { changes = true; } pw.print(res); pw.flush();
Clone fragments detected by clone detection tool
File path: /apache-ant-1.7.0/src/org/apache/tools/ant/taskdefs/Property.java File path: /apache-ant-1.7.0/src/org/apache/tools/ant/taskdefs/optional/ReplaceRegExp.java
Method name: void resolve(Properties, String, Stack) Method name: void doReplace(File, int)
Number of AST nodes: 7 Number of AST nodes: 8
1
String propertyName = (String) j.nextElement();
1
String 
2
                    fragment = getProject().getProperty(propertyName);
2
buf = FileUtils.readFully(br);
3
                    if (fragment == null) {
3
                if (buf == null) {
4
                        if (props.containsKey(propertyName)) {
4
                    
5
                            resolve(props, propertyName, referencesSeen
5
buf = "";
6
                }
6
);
7
                String res = doReplace(regex, subs, buf, options);
7
                            fragment = props.getProperty(propertyName);
8
                if (!res.equals(buf)) {
8
                        } else {
9
                    changes = true;
9
                
10
                }
10
            fragment = "${" + propertyName + "}";
11
            
11
                        }
12
                    }
12
    pw.print(res);
13
                pw.flush();
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.1
Clones locationClones are in different classes having the same super class
Number of node comparisons9
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements1
    Number of unmapped statements in the first code fragment3
    Number of unmapped statements in the second code fragment5
    Time elapsed for statement mapping (ms)1.0
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
                                                                                  
    58
    String buf = FileUtils.readFully(br);
                                          
    59
    if (buf == null)
                          
    60
    buf = "";
                                                                                                      
    61
    String res = doReplace(regex, subs, buf, options);
    18
    if (props.containsKey(propertyName))
    18
    if (props.containsKey(propertyName))
    62
    if (!res.equals(buf))
    Differences
    Expression1Expression2Difference
    props.containsKey(propertyName)!res.equals(buf)TYPE_COMPATIBLE_REPLACEMENT
    62
    if (!res.equals(buf))
    19
    resolve(props, propertyName, referencesSeen);
    19
    resolve(props, propertyName, referencesSeen);
    Preondition Violations
    Unmatched statement resolve(props,propertyName,referencesSeen); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                                  
    20
    fragment = props.getProperty(propertyName);
    20
    fragment = props.getProperty(propertyName);
    Preondition Violations
    Unmatched statement fragment=props.getProperty(propertyName); cannot be moved, because it updates a variable modified in other unmapped statements
                                                                                              
    else
            
    21
    fragment = "${" + propertyName + "}";
    21
    fragment = "${" + propertyName + "}";
    Preondition Violations
    Unmatched statement fragment="${" + propertyName + "}"; cannot be moved, because it updates a variable modified in other unmapped statements
                                                                                  
                                      
    63
    changes = true;
    Precondition Violations (3)
    Row Violation
    1Unmatched statement resolve(props,propertyName,referencesSeen); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    2Unmatched statement fragment=props.getProperty(propertyName); cannot be moved, because it updates a variable modified in other unmapped statements
    3Unmatched statement fragment="${" + propertyName + "}"; cannot be moved, because it updates a variable modified in other unmapped statements