StringBuffer s = new StringBuffer(); s.append( '[' ); if( entityName == null ) { s.append( "<null entity name>" ); } else { s.append( entityName ); } s.append( '#' ); if ( id == null ) { s.append( "<null>" ); } else { s.append( id ); } s.append( ']' ); return s.toString();
StringBuffer s = new StringBuffer(); s.append( '[' ); if( role == null ) { s.append( "<unreferenced>" ); } else { s.append( role ); s.append( '#' ); if ( id == null ) { s.append( "<null>" ); } else { s.append( id ); } } s.append( ']' ); return s.toString();
Clone fragments detected by clone detection tool
File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/pretty/MessageHelper.java File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/pretty/MessageHelper.java
Method name: String infoString(String, Serializable) Method name: String collectionInfoString(String, Serializable)
Number of AST nodes: 11 Number of AST nodes: 11
1
StringBuffer s = new StringBuffer();
1
StringBuffer s = new StringBuffer();
2
		s.append( '[' );
2
		s.append( '[' );
3
		if( entityName == null ) {
3
		if( role == null ) {
4
			s.append( "<null entity name>" );
4
			s.append( "<unreferenced>" );
5
		}
5
		}
6
		else {
6
		else {
7
			s.append( entityName );
7
			s.append( role );
8
		}
8
		
9
		s.append( '#' );
9
	s.append( '#' );
10
		if ( id == null ) {
10
			if ( id == null ) {
11
			s.append( "<null>" );
11
				s.append( "<null>" );
12
		}
12
			}
13
		else {
13
			else {
14
			s.append( id );
14
				s.append( id );
15
		
15
			}
16
}
16
		}
17
		s.append( ']' );
17
		s.append( ']' );
18
		return s.toString();
18
		return s.toString();
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 declared in the same class
Number of node comparisons14
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements4
    Number of unmapped statements in the first code fragment1
    Number of unmapped statements in the second code fragment1
    Time elapsed for statement mapping (ms)1.1
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    StringBuffer s = new StringBuffer();
                                                                              
                                        
    5
    s.append(role);
    2
    s.append('[');
    2
    s.append('[');
    6
    s.append('#');
    Differences
    Expression1Expression2Difference
    '[''#'LITERAL_VALUE_MISMATCH
    6
    s.append('#');
    3
    if (entityName == null)
    3
    if (entityName == null)
    7
    if (id == null)
    Differences
    Expression1Expression2Difference
    entityNameidVARIABLE_NAME_MISMATCH
    java.lang.Stringjava.io.SerializableVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.lang.String of variable entityName does not match with type java.io.Serializable of variable id
    • Make classes java.lang.String and java.io.Serializable extend a common superclass
    7
    if (id == null)
    4
    s.append("<null entity name>");
    4
    s.append("<null entity name>");
    8
    s.append("<null>");
    Differences
    Expression1Expression2Difference
    """"LITERAL_VALUE_MISMATCH
    8
    s.append("<null>");
    else
    else
    5
    s.append(entityName);
    5
    s.append(entityName);
    9
    s.append(id);
    Differences
    Expression1Expression2Difference
    entityNameidVARIABLE_NAME_MISMATCH
    java.lang.Stringjava.io.SerializableVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.lang.String of variable entityName does not match with type java.io.Serializable of variable id
    • Make classes java.lang.String and java.io.Serializable extend a common superclass
    9
    s.append(id);
    Precondition Violations (2)
    Row Violation
    1Type java.lang.String of variable entityName does not match with type java.io.Serializable of variable id
    2Type java.lang.String of variable entityName does not match with type java.io.Serializable of variable id