File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/engine/StatefulPersistenceContext.java | File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/engine/StatefulPersistenceContext.java | |||
Method name: Serializable getOwnerId(String, String, Object, Map)
|
Method name: Object getIndexInOwner(String, String, Object, Map)
|
|||
Number of AST nodes: 10 | Number of AST nodes: 10 | |||
1 | if ( persister.isSubclassEntityName( entityEntry.getEntityName() ) ) {↵ | 1 | if ( persister.isSubclassEntityName( ee.getEntityName() ) ) {↵ | |
2 | final Object entityEntryInstance = me.getKey();↵ | 2 | Object instance = me.getKey();↵ | |
3 | ↵ | |||
3 | //check if the managed object is the parent↵ | 4 | ↵ | |
4 | boolean found = isFoundInParent(↵ | 5 | Object index = getIndexInParent(↵ | |
5 | propertyName,↵ | 6 | property↵ | |
6 | childEntity,↵ | 7 | , childEntity,↵ | |
7 | persister,↵ | 8 | persister,↵ | |
8 | collectionPersister,↵ | |||
9 | entityEntryInstance↵ | 9 | cp, instance);↵ | |
10 | );↵ | 10 | ↵ | |
11 | if ( !found && mergeMap != null ) {↵ | 11 | if (index==null && mergeMap!=null) {↵ | |
12 | //check if the detached object being merged is the parent↵ | 12 | ↵ | |
13 | Object unmergedInstance = mergeMap.get( entityEntryInstance );↵ | 13 | Object unmergedInstance = mergeMap.get(instance);↵ | |
14 | Object unmergedChild = mergeMap.get( childEntity );↵ | 14 | Object unmergedChild = mergeMap.get(childEntity);↵ | |
15 | if ( unmergedInstance != null && unmergedChild != null ) {↵ | 15 | if ( unmergedInstance!=null && unmergedChild!=null ) {↵ | |
16 | found = isFoundInParent(↵ | 16 | ↵ | |
17 | propertyName,↵ | |||
18 | unmergedChild,↵ | 17 | index = getIndexInParent(property, unmergedChild,↵ | |
19 | persister,↵ | 18 | persister,↵ | |
20 | collectionPersister,↵ | |||
21 | unmergedInstance↵ | 19 | cp, unmergedInstance);↵ | |
22 | );↵ | 20 | ↵ | |
23 | ↵ | 21 | }↵ | |
24 | }↵ | 22 | }↵ | |
25 | }↵ | 23 | ↵ | |
26 | if ( found ) {↵ | 24 | if (↵ | |
27 | return entityEntry.getId();↵ | |||
28 | }↵ | |||
25 | index!=null) return index;↵ | |||
29 | } | 26 |
| |
See real code fragment | See real code fragment |
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.7 |
Clones location | Clones are declared in the same class |
Number of node comparisons | 24 |
Number of mapped statements | 5 |
Number of unmapped statements in the first code fragment | 3 |
Number of unmapped statements in the second code fragment | 3 |
Time elapsed for statement mapping (ms) | 1.7 |
Clone type | Type 2 |
ID | Statement | ID | Statement | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
8 | if (persister.isSubclassEntityName(entityEntry.getEntityName())) |
| 7 | if (persister.isSubclassEntityName(ee.getEntityName())) | ||||||||||
|
| 8 | Object instance = me.getKey(); | |||||||||||
|
| 9 | Object index = getIndexInParent(property, childEntity, persister, cp, instance); | |||||||||||
9 | final Object entityEntryInstance = me.getKey(); |
| | |||||||||||
10 | boolean found = isFoundInParent(propertyName, childEntity, persister, collectionPersister, entityEntryInstance); |
| | |||||||||||
11 | if (!found && mergeMap != null) |
| 10 | if (index == null && mergeMap != null) | ||||||||||
12 | Object unmergedInstance = mergeMap.get(entityEntryInstance); |
| 11 | Object unmergedInstance = mergeMap.get(instance); | ||||||||||
13 | Object unmergedChild = mergeMap.get(childEntity); | 12 | Object unmergedChild = mergeMap.get(childEntity); | |||||||||||
14 | if (unmergedInstance != null && unmergedChild != null) | 13 | if (unmergedInstance != null && unmergedChild != null) | |||||||||||
|
| 14 | index = getIndexInParent(property, unmergedChild, persister, cp, unmergedInstance); | |||||||||||
15 | found = isFoundInParent(propertyName, unmergedChild, persister, collectionPersister, unmergedInstance); |
| |
Row | Violation |
---|---|
1 | Unmatched statement Object instance=me.getKey(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
2 | Unmatched statement Object index=getIndexInParent(property,childEntity,persister,cp,instance); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
3 | Unmatched statement final Object entityEntryInstance=me.getKey(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
4 | Unmatched statement boolean found=isFoundInParent(propertyName,childEntity,persister,collectionPersister,entityEntryInstance); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
5 | Unmatched statement index=getIndexInParent(property,unmergedChild,persister,cp,unmergedInstance); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
6 | Unmatched statement found=isFoundInParent(propertyName,unmergedChild,persister,collectionPersister,unmergedInstance); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
7 | Clone fragment #1 returns variables unmergedInstance, unmergedChild , while Clone fragment #2 returns variables unmergedInstance, unmergedChild |