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 | }
|
See real code fragment |
|
See real code fragment |
Summary
Number of common nesting structure subtrees | 1 |
Number of refactorable cases | 0 |
Number of non-refactorable cases | 1 |
Time elapsed for finding largest common nesting structure subtrees (ms) | 0.2 |
Clones location | Clones are in different classes having the same super class |
Number of node comparisons | 20 |
-
{Non-refactorable}
Mapping Summary
Number of mapped statements | 6 |
Number of unmapped statements in the first code fragment | 0 |
Number of unmapped statements in the second code fragment | 0 |
Time elapsed for statement mapping (ms) | 15.8 |
Clone type | Type 1 |
Mapped Statements
ID |
Statement |
|
ID |
Statement |
3 | if (value == null) | | 3 | if (value == null) |
4 | | | 4 | |
| | | | |
5 | Object id = ForeignKeys.getEntityIdentifierIfNotUnsaved(getAssociatedEntityName(), value, session); | | 5 | Object id = ForeignKeys.getEntityIdentifierIfNotUnsaved(getAssociatedEntityName(), value, session); |
6 | | | 6 | |
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 |
1 | Not all possible execution flows end in a return statement |