if ( isNotEmbedded( session ) ) { return getIdentifierType( session ).disassemble( value, 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 ); }
if ( isNotEmbedded(session) ) { return getIdentifierType(session).disassemble(value, 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: 8 Number of AST nodes: 8
1
if ( isNotEmbedded( session ) ) {
1
if ( isNotEmbedded(session) ) {
2
			return getIdentifierType( session ).disassemble( value, session, owner );
2
			return getIdentifierType(session).disassemble(value, session, owner);
3
		}
3
		}
4
		
4
		
5
		if ( value == null ) {
5
		if (value==null) {
6
			return null;
6
			return null;
7
		}
7
		}
8
		else {
8
		else {
9
			// cache the actual id of the object, not the value of the
9
			// cache the actual id of the object, not the value of the
10
			// property-ref, which might not be initialized
10
			// property-ref, which might not be initialized
11
			Object id = ForeignKeys.getEntityIdentifierIfNotUnsaved( 
11
			Object id = ForeignKeys.getEntityIdentifierIfNotUnsaved( 
12
					getAssociatedEntityName(), 
12
getAssociatedEntityName(), 
13
					value, 
13
value, 
14
					session
14
session
15
			);
15
 );
16
			if ( id == null ) {
16
			if (id==null) {
17
				throw new AssertionFailure(
17
				throw new AssertionFailure(
18
						"cannot cache a reference to an object with a null id: " + 
18
						"cannot cache a reference to an object with a null id: " + 
19
						getAssociatedEntityName()
19
						getAssociatedEntityName() 
20
				);
20
				);
21
			}
21
			}
22
			return getIdentifierType( session ).disassemble( id, session, owner );
22
			return getIdentifierType(session).disassemble(id, session, owner);
23
		}
23
		}
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.4
Clones locationClones are in different classes having the same super class
Number of node comparisons25
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements8
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)17.5
    Clone typeType 1
    Mapped Statements
    ID Statement ID Statement
    1
    if (isNotEmbedded(session))
    1
    if (isNotEmbedded(session))
    2
    return getIdentifierType(session).disassemble(value, session, owner);
    2
    return getIdentifierType(session).disassemble(value, session, owner);
    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