if (query == null) { return this; } else { return new URI(hierarchical, scheme, authority, device, absolutePath, segments, null, fragment); }
if (buffer == null) { return value; } else { return buffer.toString(); }
Clone fragments detected by clone detection tool
File path: /emf-2.4.1/src/org/eclipse/emf/common/util/URI.java File path: /emf-2.4.1/src/org/eclipse/emf/ecore/xml/type/util/XMLTypeUtil.java
Method name: URI trimQuery() Method name: String normalize(String, boolean)
Number of AST nodes: 3 Number of AST nodes: 3
1
if (query == null)
1
if (buffer == null)
2
    {
2
      {
3
      return this;
3
        return 
4
value;
4
    }
5
      }
5
    else
6
      else
6
    {
7
    
8
  {
7
      return new URI(hierarchical, scheme, authority, device, absolutePath, segments, null, fragment); 
9
        return 
10
buffer.toString();
8
    }
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.1
Clones locationClones are in different classes
Number of node comparisons9
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements1
    Number of unmapped statements in the first code fragment2
    Number of unmapped statements in the second code fragment2
    Time elapsed for statement mapping (ms)0.6
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    if (query == null)
    1
    if (query == null)
    30
    if (buffer == null)
    Differences
    Expression1Expression2Difference
    querybufferVARIABLE_NAME_MISMATCH
    java.lang.Stringjava.lang.StringBufferVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.lang.String of variable query does not match with type java.lang.StringBuffer of variable buffer
    • Make classes java.lang.String and java.lang.StringBuffer extend a common superclass
    30
    if (buffer == null)
    2
    return this;
    2
    return this;
    Preondition Violations
    Unmatched return this;
                                  
    else
            
    3
    return new URI(hierarchical, scheme, authority, device, absolutePath, segments, null, fragment);
    3
    return new URI(hierarchical, scheme, authority, device, absolutePath, segments, null, fragment);
    Preondition Violations
    Unmatched return new URI(hierarchical,scheme,authority,device,absolutePath,segments,null,fragment);
                                                                                                                                                                                            
                                                              
    32
    return buffer.toString();
    Preondition Violations
    Unmatched return buffer.toString();
    32
    return buffer.toString();
                                      
    31
    return value;
    Preondition Violations
    Unmatched return value;
    31
    return value;
    Precondition Violations (5)
    Row Violation
    1Type java.lang.String of variable query does not match with type java.lang.StringBuffer of variable buffer
    2Unmatched return this;
    3Unmatched return new URI(hierarchical,scheme,authority,device,absolutePath,segments,null,fragment);
    4Unmatched return buffer.toString();
    5Unmatched return value;