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 (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); } }
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: 5 Number of AST nodes: 5
1
if ( !found && mergeMap != null ) {
1
if (index==null && mergeMap!=null) {
2
					//check if the detached object being merged is the parent
2
					
3
					Object unmergedInstance = mergeMap.get( entityEntryInstance );
3
Object unmergedInstance = mergeMap.get(instance);
4
					Object unmergedChild = mergeMap.get( childEntity );
4
					Object unmergedChild = mergeMap.get(childEntity);
5
					if ( unmergedInstance != null && unmergedChild != null ) {
5
					if ( unmergedInstance!=null && unmergedChild!=null ) {
6
						found = isFoundInParent(
6
						
7
								propertyName,
8
								unmergedChild,
7
index = getIndexInParent(property, unmergedChild,
9
								persister,
8
 persister,
10
								collectionPersister,
11
								unmergedInstance
9
 cp, unmergedInstance
12
						);
10
);
13
					}
11
					}
14
				}
12
				}
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 declared in the same class
Number of node comparisons15
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements4
    Number of unmapped statements in the first code fragment1
    Number of unmapped statements in the second code fragment1
    Time elapsed for statement mapping (ms)1.2
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    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 (3)
    Row Violation
    1Unmatched 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
    2Unmatched 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
    3Clone fragment #1 returns variables unmergedInstance, unmergedChild , while Clone fragment #2 returns variables unmergedInstance, unmergedChild