if ( isPropertyIncluded(value, subpath, subtype) ) { if ( subtype.isComponentType() ) { addComponentTypedValues(subpath, value, (AbstractComponentType) subtype, list, criteria, criteriaQuery); } else { addPropertyTypedValue(value, subtype, list); } }
if ( wrapper.setCurrentSession(session) ) { //a "detached" collection! if ( !isOwnerUnchanged( wrapper, persister, collectionKey ) ) { // if the collection belonged to a different entity, // clean up the existing state of the collection removeCollection( persister, collectionKey, session ); } reattachCollection(wrapper, type); } else { // a collection loaded in the current session // can not possibly be the collection belonging // to the entity passed to update() removeCollection(persister, collectionKey, session); }
Clone fragments detected by clone detection tool
File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/criterion/Example.java File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/event/def/OnUpdateVisitor.java
Method name: void addComponentTypedValues(String, Object, AbstractComponentType, List, Criteria, CriteriaQuery) Method name: Object processCollection(Object, CollectionType)
Number of AST nodes: 4 Number of AST nodes: 5
1
if ( isPropertyIncluded(value, subpath, subtype) ) {
1
if ( 
2
					if ( subtype.isComponentType() ) {
3
						addComponentTypedValues(subpath, value, (AbstractComponentType) subtype, list, criteria, criteriaQuery);
4
					}
5
					else {
6
						addPropertyTypedValue(value, subtype, list);
7
					}
8
	
2
wrapper.setCurrentSession(session) ) {
3
				//a "detached" collection!
4
				if ( !isOwnerUnchanged( wrapper, persister, collectionKey ) ) {
5
					// if the collection belonged to a different entity,
6
					// clean up the existing state of the collection
7
					removeCollection( persister, collectionKey, session );
8
				}
9
				reattachCollection(wrapper, type);
10
			}
11
			else {
12
				// a collection loaded in the current session
13
				// can not possibly be the collection belonging
14
				// to the entity passed to update()
15
				removeCollection(persister, collectionKey, session);
9
			}
16
			}
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.2
Clones locationClones are in different classes
Number of node comparisons10
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements3
    Number of unmapped statements in the first code fragment1
    Number of unmapped statements in the second code fragment2
    Time elapsed for statement mapping (ms)6.0
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
    9
    if (isPropertyIncluded(value, subpath, subtype))
    9
    if (isPropertyIncluded(value, subpath, subtype))
    8
    if (wrapper.setCurrentSession(session))
    Differences
    Expression1Expression2Difference
    isPropertyIncludedsetCurrentSessionMETHOD_INVOCATION_NAME_MISMATCH
    isPropertyIncluded(value,subpath,subtype)wrapper.setCurrentSession(session)ARGUMENT_NUMBER_MISMATCH
    wrapperMISSING_METHOD_INVOCATION_EXPRESSION
    8
    if (wrapper.setCurrentSession(session))
    10
    if (subtype.isComponentType())
    10
    if (subtype.isComponentType())
    9
    if (!isOwnerUnchanged(wrapper, persister, collectionKey))
    Differences
    Expression1Expression2Difference
    subtype.isComponentType()!isOwnerUnchanged(wrapper,persister,collectionKey)TYPE_COMPATIBLE_REPLACEMENT
    9
    if (!isOwnerUnchanged(wrapper, persister, collectionKey))
    11
    addComponentTypedValues(subpath, value, (AbstractComponentType)subtype, list, criteria, criteriaQuery);
    11
    addComponentTypedValues(subpath, value, (AbstractComponentType)subtype, list, criteria, criteriaQuery);
    10
    removeCollection(persister, collectionKey, session);
    Differences
    Expression1Expression2Difference
    addComponentTypedValuesremoveCollectionMETHOD_INVOCATION_NAME_MISMATCH
    addComponentTypedValues(subpath,value,(AbstractComponentType)subtype,list,criteria,criteriaQuery)removeCollection(persister,collectionKey,session)ARGUMENT_NUMBER_MISMATCH
    Preondition Violations
    Expression addComponentTypedValues(subpath,value,(AbstractComponentType)subtype,list,criteria,criteriaQuery) is a void method call, and thus it cannot be parameterized
    Expression removeCollection(persister,collectionKey,session) is a void method call, and thus it cannot be parameterized
    Expression addComponentTypedValues(subpath,value,(AbstractComponentType)subtype,list,criteria,criteriaQuery) is a void method call, and thus it cannot be parameterized
    Expression removeCollection(persister,collectionKey,session) is a void method call, and thus it cannot be parameterized
    10
    removeCollection(persister, collectionKey, session);
    else
            
    12
    addPropertyTypedValue(value, subtype, list);
                                                                                                
                                                                              
    11
    reattachCollection(wrapper, type);
            
    else
                                                                                                                
    12
    removeCollection(persister, collectionKey, session);
    Precondition Violations (4)
    Row Violation
    1Expression addComponentTypedValues(subpath,value,(AbstractComponentType)subtype,list,criteria,criteriaQuery) is a void method call, and thus it cannot be parameterized
    2Expression removeCollection(persister,collectionKey,session) is a void method call, and thus it cannot be parameterized
    3Expression addComponentTypedValues(subpath,value,(AbstractComponentType)subtype,list,criteria,criteriaQuery) is a void method call, and thus it cannot be parameterized
    4Expression removeCollection(persister,collectionKey,session) is a void method call, and thus it cannot be parameterized