StringBuffer buffer = new StringBuffer(); manyToManyFilterHelper.render( buffer, alias, enabledFilters ); if ( manyToManyWhereString != null ) { buffer.append( " and " ) .append( StringHelper.replace( manyToManyWhereTemplate, Template.TEMPLATE, alias ) ); } return buffer.toString();
if ( FieldInterceptionHelper.isInstrumented( entity ) ) { FieldInterceptor interceptor = FieldInterceptionHelper.extractFieldInterceptor( entity ); if ( interceptor != null ) { interceptor.setSession( session ); } else { FieldInterceptor fieldInterceptor = FieldInterceptionHelper.injectFieldInterceptor( entity, getEntityName(), null, session ); fieldInterceptor.dirty(); } }
Clone fragments detected by clone detection tool
File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/persister/collection/AbstractCollectionPersister.java File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/persister/entity/AbstractEntityPersister.java
Method name: String getManyToManyFilterFragment(String, Map) Method name: void afterReassociate(Object, SessionImplementor)
Number of AST nodes: 5 Number of AST nodes: 6
1
StringBuffer buffer = new StringBuffer();
2
		manyToManyFilterHelper.render( buffer, alias, enabledFilters
1
if ( FieldInterceptionHelper.isInstrumented( entity ) ) {
3
 );
2
			FieldInterceptor interceptor = FieldInterceptionHelper.extractFieldInterceptor( entity );
4
		if ( manyToManyWhereString != null ) {
3
			if ( 
5
			buffer.append( " and "
4
interceptor != null ) {
6
 )
5
				interceptor.setSession( session );
7
					.append( StringHelper.replace( manyToManyWhereTemplate, Template.TEMPLATE, alias ) );
6
			
8
		}
9
		return buffer.toString();
7
}
8
			else {
9
				FieldInterceptor fieldInterceptor = FieldInterceptionHelper.injectFieldInterceptor(
10
						entity,
11
						getEntityName(),
12
						null,
13
						session
14
				);
15
				fieldInterceptor.dirty();
16
			}
17
		}
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 comparisons11
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements1
    Number of unmapped statements in the first code fragment4
    Number of unmapped statements in the second code fragment4
    Time elapsed for statement mapping (ms)1.3
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
    1
    StringBuffer buffer = new StringBuffer();
                                                                                        
                                                                                                                                                                                    
    2
    FieldInterceptor interceptor = FieldInterceptionHelper.extractFieldInterceptor(entity);
    2
    manyToManyFilterHelper.render(buffer, alias, enabledFilters);
                                                                                                                                
    3
    if (manyToManyWhereString != null)
    3
    if (manyToManyWhereString != null)
    3
    if (interceptor != null)
    Differences
    Expression1Expression2Difference
    manyToManyWhereStringinterceptorVARIABLE_NAME_MISMATCH
    java.lang.Stringorg.hibernate.intercept.FieldInterceptorVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.lang.String of variable manyToManyWhereString does not match with type org.hibernate.intercept.FieldInterceptor of variable interceptor
    • Make classes java.lang.String and org.hibernate.intercept.FieldInterceptor extend a common superclass
    3
    if (interceptor != null)
                                                                          
    4
    interceptor.setSession(session);
    4
    buffer.append(" and ").append(StringHelper.replace(manyToManyWhereTemplate, Template.TEMPLATE, alias));
                                                                                                                                                                                                                    
            
    else
                                                                                                                                                                                                                                                      
    5
    FieldInterceptor fieldInterceptor = FieldInterceptionHelper.injectFieldInterceptor(entity, getEntityName(), null, session);
                                                            
    6
    fieldInterceptor.dirty();
    5
    return buffer.toString();
    5
    return buffer.toString();
    Preondition Violations
    Unmatched return buffer.toString();
                                                            
    Precondition Violations (2)
    Row Violation
    1Type java.lang.String of variable manyToManyWhereString does not match with type org.hibernate.intercept.FieldInterceptor of variable interceptor
    2Unmatched return buffer.toString();