final Object entity = persistenceContext.removeEntity( key ); if ( entity != null ) { EntityEntry e = event.getSession().getPersistenceContext().removeEntry( entity ); doEvict( entity, key, e.getPersister(), event.getSession() ); }
if ( e != null ) { EntityKey key = new EntityKey( e.getId(), e.getPersister(), source.getEntityMode() ); persistenceContext.removeEntity( key ); doEvict( object, key, e.getPersister(), source ); }
Clone fragments detected by clone detection tool
File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/event/def/DefaultEvictEventListener.java File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/event/def/DefaultEvictEventListener.java
Method name: void onEvict(EvictEvent) Method name: void onEvict(EvictEvent)
Number of AST nodes: 4 Number of AST nodes: 4
1
final Object entity = persistenceContext.removeEntity( key );
2
				if ( entity != null ) {
1
if ( e != null ) {
3
					EntityEntry e = event.getSession().getP
2
				EntityKey key = new EntityKey( e.getId(), e.getPersister(), source.getEntityMode()  );
4
ersistenceContext().removeEntry( entity );
3
				persistenceContext.removeEntity( key );
5
					doEvict( entity, key, e.getPersister(), event.getSession() );
4
				doEvict( object, key, e.getPersister(), source );
6
				}
5
			}
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.1
Clones locationClones are in the same method
Number of node comparisons12
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements2
    Number of unmapped statements in the first code fragment2
    Number of unmapped statements in the second code fragment2
    Time elapsed for statement mapping (ms)3.9
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
    13
    final Object entity = persistenceContext.removeEntity(key);
    13
    final Object entity = persistenceContext.removeEntity(key);
    Preondition Violations
    Unmatched statement final Object entity=persistenceContext.removeEntity(key); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
                                                                                                                              
    14
    if (entity != null)
    14
    if (entity != null)
    19
    if (e != null)
    Differences
    Expression1Expression2Difference
    entityeVARIABLE_NAME_MISMATCH
    java.lang.Objectorg.hibernate.engine.EntityEntryVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Expression entity cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Type java.lang.Object of variable entity does not match with type org.hibernate.engine.EntityEntry of variable e
    • Make classes java.lang.Object and org.hibernate.engine.EntityEntry extend a common superclass
    19
    if (e != null)
    15
    EntityEntry e = event.getSession().getPersistenceContext().removeEntry(entity);
    15
    EntityEntry e = event.getSession().getPersistenceContext().removeEntry(entity);
    Preondition Violations
    Unmatched statement EntityEntry e=event.getSession().getPersistenceContext().removeEntry(entity); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
                                                                                                                                                                      
                                                                                                                                                                          
    20
    EntityKey key = new EntityKey(e.getId(), e.getPersister(), source.getEntityMode());
    Preondition Violations
    Unmatched statement EntityKey key=new EntityKey(e.getId(),e.getPersister(),source.getEntityMode()); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    Unmatched statement EntityKey key=new EntityKey(e.getId(),e.getPersister(),source.getEntityMode()); cannot be moved before or after the extracted code, because it throws exception(s) that should be caught by a try block that will be extracted
    20
    EntityKey key = new EntityKey(e.getId(), e.getPersister(), source.getEntityMode());
                                                                                      
    21
    persistenceContext.removeEntity(key);
    Preondition Violations
    Unmatched statement persistenceContext.removeEntity(key); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    21
    persistenceContext.removeEntity(key);
    16
    doEvict(entity, key, e.getPersister(), event.getSession());
    16
    doEvict(entity, key, e.getPersister(), event.getSession());
    22
    doEvict(object, key, e.getPersister(), source);
    Differences
    Expression1Expression2Difference
    entityobjectVARIABLE_NAME_MISMATCH
    event.getSession()sourceTYPE_COMPATIBLE_REPLACEMENT
    Preondition Violations
    Expression entity cannot be parameterized, because it has dependencies to/from statements that will be extracted
    22
    doEvict(object, key, e.getPersister(), source);
    Precondition Violations (8)
    Row Violation
    1Unmatched statement final Object entity=persistenceContext.removeEntity(key); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    2Expression entity cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Type java.lang.Object of variable entity does not match with type org.hibernate.engine.EntityEntry of variable e
    4Unmatched statement EntityEntry e=event.getSession().getPersistenceContext().removeEntry(entity); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    5Unmatched statement EntityKey key=new EntityKey(e.getId(),e.getPersister(),source.getEntityMode()); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    6Unmatched statement EntityKey key=new EntityKey(e.getId(),e.getPersister(),source.getEntityMode()); cannot be moved before or after the extracted code, because it throws exception(s) that should be caught by a try block that will be extracted
    7Unmatched statement persistenceContext.removeEntity(key); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    8Expression entity cannot be parameterized, because it has dependencies to/from statements that will be extracted