if ( value == null ) { return null; } else { // cache the actual id of the object, not the value of the // property-ref, which might not be initialized Object id = ForeignKeys.getEntityIdentifierIfNotUnsaved( getAssociatedEntityName(), value, session ); if ( id == null ) { throw new AssertionFailure( "cannot cache a reference to an object with a null id: " + getAssociatedEntityName() ); } return getIdentifierType( session ).disassemble( id, session, owner ); }
if (value==null) { return null; } else { // cache the actual id of the object, not the value of the // property-ref, which might not be initialized Object id = ForeignKeys.getEntityIdentifierIfNotUnsaved( getAssociatedEntityName(), value, session ); if (id==null) { throw new AssertionFailure( "cannot cache a reference to an object with a null id: " + getAssociatedEntityName() ); } return getIdentifierType(session).disassemble(id, session, owner); }
Clone fragments detected by clone detection tool
File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/type/ManyToOneType.java File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/type/SpecialOneToOneType.java
Method name: Serializable disassemble(Object, SessionImplementor, Object) Method name: Serializable disassemble(Object, SessionImplementor, Object)
Number of AST nodes: 6 Number of AST nodes: 6
1
if ( value == null ) {
1
if (value==null) {
2
			return null;
2
			return null;
3
		}
3
		}
4
		else {
4
		else {
5
			// cache the actual id of the object, not the value of the
5
			// cache the actual id of the object, not the value of the
6
			// property-ref, which might not be initialized
6
			// property-ref, which might not be initialized
7
			Object id = ForeignKeys.getEntityIdentifierIfNotUnsaved( 
7
			Object id = ForeignKeys.getEntityIdentifierIfNotUnsaved( 
8
					getAssociatedEntityName(), 
8
getAssociatedEntityName(), 
9
					value, 
9
value, 
10
					session
10
session
11
			);
11
 );
12
			if ( id == null ) {
12
			if (id==null) {
13
				throw new AssertionFailure(
13
				throw new AssertionFailure(
14
						"cannot cache a reference to an object with a null id: " + 
14
						"cannot cache a reference to an object with a null id: " + 
15
						getAssociatedEntityName()
15
						getAssociatedEntityName() 
16
				);
16
				);
17
			}
17
			}
18
			return getIdentifierType( session ).disassemble( id, session, owner );
18
			return getIdentifierType(session).disassemble(id, session, owner);
19
		}
19
		}
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.2
Clones locationClones are in different classes having the same super class
Number of node comparisons20
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements6
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)15.8
    Clone typeType 1
    Mapped Statements
    ID Statement ID Statement
    3
    if (value == null)
    3
    if (value == null)
    4
    return null;
    4
    return null;
    else
    else
    5
    Object id = ForeignKeys.getEntityIdentifierIfNotUnsaved(getAssociatedEntityName(), value, session);
    5
    Object id = ForeignKeys.getEntityIdentifierIfNotUnsaved(getAssociatedEntityName(), value, session);
    6
    if (id == null)
    6
    if (id == null)
    7
    throw new AssertionFailure("cannot cache a reference to an object with a null id: " + getAssociatedEntityName());
    7
    throw new AssertionFailure("cannot cache a reference to an object with a null id: " + getAssociatedEntityName());
    8
    return getIdentifierType(session).disassemble(id, session, owner);
    8
    return getIdentifierType(session).disassemble(id, session, owner);
    Precondition Violations (1)
    Row Violation
    1Not all possible execution flows end in a return statement