if ( persister.isSubclassEntityName( entityEntry.getEntityName() ) ) { final Object entityEntryInstance = me.getKey(); //check if the managed object is the parent boolean found = isFoundInParent( propertyName, childEntity, persister, collectionPersister, entityEntryInstance ); if ( !found && mergeMap != null ) { //check if the detached object being merged is the parent Object unmergedInstance = mergeMap.get( entityEntryInstance ); Object unmergedChild = mergeMap.get( childEntity ); if ( unmergedInstance != null && unmergedChild != null ) { found = isFoundInParent( propertyName, unmergedChild, persister, collectionPersister, unmergedInstance ); } } if ( found ) { return entityEntry.getId(); } }
if ( persister.isSubclassEntityName( ee.getEntityName() ) ) { Object instance = me.getKey(); Object index = getIndexInParent(property, childEntity, persister, cp, instance); if (index==null && mergeMap!=null) { Object unmergedInstance = mergeMap.get(instance); Object unmergedChild = mergeMap.get(childEntity); if ( unmergedInstance!=null && unmergedChild!=null ) { index = getIndexInParent(property, unmergedChild, persister, cp, unmergedInstance); } } if (index!=null) return index; }
Clone fragments detected by clone detection tool
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
			}
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.7
Clones locationClones are declared in the same class
Number of node comparisons24
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements5
    Number of unmapped statements in the first code fragment3
    Number of unmapped statements in the second code fragment3
    Time elapsed for statement mapping (ms)1.7
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    8
    if (persister.isSubclassEntityName(entityEntry.getEntityName()))
    8
    if (persister.isSubclassEntityName(entityEntry.getEntityName()))
    7
    if (persister.isSubclassEntityName(ee.getEntityName()))
    Differences
    Expression1Expression2Difference
    entityEntryeeVARIABLE_NAME_MISMATCH
    7
    if (persister.isSubclassEntityName(ee.getEntityName()))
                                                                  
    8
    Object instance = me.getKey();
    Preondition Violations
    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
    8
    Object instance = me.getKey();
                                                                                                                                                              
    9
    Object index = getIndexInParent(property, childEntity, persister, cp, instance);
    Preondition Violations
    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
    9
    Object index = getIndexInParent(property, childEntity, persister, cp, instance);
    9
    final Object entityEntryInstance = me.getKey();
    9
    final Object entityEntryInstance = me.getKey();
    Preondition Violations
    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
                                                                                                    
    10
    boolean found = isFoundInParent(propertyName, childEntity, persister, collectionPersister, entityEntryInstance);
    10
    boolean found = isFoundInParent(propertyName, childEntity, persister, collectionPersister, entityEntryInstance);
    Preondition Violations
    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
                                                                                                                                                                                                                                
    11
    if (!found && mergeMap != null)
    11
    if (!found && mergeMap != null)
    10
    if (index == null && mergeMap != null)
    Differences
    Expression1Expression2Difference
    !foundindex == nullINFIX_LEFT_OPERAND_MISMATCH
    10
    if (index == null && mergeMap != null)
    12
    Object unmergedInstance = mergeMap.get(entityEntryInstance);
    12
    Object unmergedInstance = mergeMap.get(entityEntryInstance);
    11
    Object unmergedInstance = mergeMap.get(instance);
    Differences
    Expression1Expression2Difference
    entityEntryInstanceinstanceVARIABLE_NAME_MISMATCH
    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);
    Preondition Violations
    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
    14
    index = getIndexInParent(property, unmergedChild, persister, cp, unmergedInstance);
    15
    found = isFoundInParent(propertyName, unmergedChild, persister, collectionPersister, unmergedInstance);
    15
    found = isFoundInParent(propertyName, unmergedChild, persister, collectionPersister, unmergedInstance);
    Preondition Violations
    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
                                                                                                                                                                                                              
    Precondition Violations (7)
    Row Violation
    1Unmatched 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
    2Unmatched 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
    3Unmatched 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
    4Unmatched 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
    5Unmatched 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
    6Unmatched 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
    7Clone fragment #1 returns variables unmergedInstance, unmergedChild , while Clone fragment #2 returns variables unmergedInstance, unmergedChild