FlushEntityEvent entityEvent = new FlushEntityEvent( source, me.getKey(), entry ); FlushEntityEventListener[] listeners = source.getListeners().getFlushEntityEventListeners(); for ( int j = 0; j < listeners.length; j++ ) { listeners[j].onFlushEntity(entityEvent); }
Configuration cfg = new Configuration().setProperty( Environment.HBM2DDL_AUTO, "create-drop" ); String[] resources = getResources(); for ( int i = 0; i < resources.length; i++ ) { cfg.addResource( resources[i] ); } factory = cfg.buildSessionFactory();
Clone fragments detected by clone detection tool
File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/event/def/AbstractFlushingEventListener.java File path: /hibernate-distribution-3.3.2.GA/project/testsuite/src/test/java/org/hibernate/test/instrument/cases/AbstractExecutable.java
Method name: void flushEntities(FlushEvent) Method name: void prepare()
Number of AST nodes: 4 Number of AST nodes: 5
1
FlushEntityEvent entityEvent = new FlushEntityEvent( source, me.getKey(), entry );
1
Configuration cfg = new Configuration().setProperty( Environment.HBM2DDL_AUTO, "create-drop" );
2
				FlushEntityEventListener[] listeners = source.getListeners().getFlushEntityEventListeners();
2
		String[] resources = getResources();
3
				for ( int j = 0; j < listeners.length; j++ ) {
3
		for ( int i = 0; i < resources.length; i++ ) {
4
					listeners[j].onFlushEntity(entityEvent);
4
			
5
				}
5
cfg.addResource( resources[i] );
6
		}
7
		factory = cfg.buildSessionFactory();
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 fragment3
    Number of unmapped statements in the second code fragment4
    Time elapsed for statement mapping (ms)1.8
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
                                                                                                                                                                                              
    1
    Configuration cfg = new Configuration().setProperty(Environment.HBM2DDL_AUTO, "create-drop");
                                                                              
    2
    String[] resources = getResources();
                                                                              
    5
    factory = cfg.buildSessionFactory();
    Preondition Violations
    Unmatched statement factory=cfg.buildSessionFactory(); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    5
    factory = cfg.buildSessionFactory();
    10
    FlushEntityEvent entityEvent = new FlushEntityEvent(source, me.getKey(), entry);
    10
    FlushEntityEvent entityEvent = new FlushEntityEvent(source, me.getKey(), entry);
    Preondition Violations
    Unmatched statement FlushEntityEvent entityEvent=new FlushEntityEvent(source,me.getKey(),entry); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
                                                                                                                                                                    
    11
    FlushEntityEventListener[] listeners = source.getListeners().getFlushEntityEventListeners();
    11
    FlushEntityEventListener[] listeners = source.getListeners().getFlushEntityEventListeners();
    Preondition Violations
    Unmatched statement FlushEntityEventListener[] listeners=source.getListeners().getFlushEntityEventListeners(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                                                                                                                                
    12
    for (int j = 0; j < listeners.length; j++)
    12
    for (int j = 0; j < listeners.length; j++)
    3
    for (int i = 0; i < resources.length; i++)
    Differences
    Expression1Expression2Difference
    jiVARIABLE_NAME_MISMATCH
    jiVARIABLE_NAME_MISMATCH
    listenersresourcesVARIABLE_NAME_MISMATCH
    org.hibernate.event.FlushEntityEventListener[]java.lang.String[]VARIABLE_TYPE_MISMATCH
    jiVARIABLE_NAME_MISMATCH
    Preondition Violations
    Type int of variable listeners.length does not match with type int of variable resources.length
    • Make classes org.hibernate.event.FlushEntityEventListener[] and java.lang.String[] extend a common superclass
    3
    for (int i = 0; i < resources.length; i++)
                                                                      
    4
    cfg.addResource(resources[i]);
    Preondition Violations
    Unmatched statement cfg.addResource(resources[i]); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    Unmatched statement cfg.addResource(resources[i]); 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
    4
    cfg.addResource(resources[i]);
    13
    listeners[j].onFlushEntity(entityEvent);
    13
    listeners[j].onFlushEntity(entityEvent);
    Preondition Violations
    Unmatched statement listeners[j].onFlushEntity(entityEvent); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    Unmatched statement listeners[j].onFlushEntity(entityEvent); 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
                                                                                            
    Precondition Violations (9)
    Row Violation
    1Unmatched statement factory=cfg.buildSessionFactory(); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    2Unmatched statement FlushEntityEvent entityEvent=new FlushEntityEvent(source,me.getKey(),entry); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    3Unmatched statement FlushEntityEventListener[] listeners=source.getListeners().getFlushEntityEventListeners(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    4Type int of variable listeners.length does not match with type int of variable resources.length
    5Unmatched statement cfg.addResource(resources[i]); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    6Unmatched statement cfg.addResource(resources[i]); 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 listeners[j].onFlushEntity(entityEvent); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    8Unmatched statement listeners[j].onFlushEntity(entityEvent); 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
    9The refactoring of the clones is infeasible, because the number of macthed statements is equal to zero