errorIfClosed(); checkTransactionSynchStatus(); PersistEventListener[] createEventListener = listeners.getPersistOnFlushEventListeners(); for ( int i = 0; i < createEventListener.length; i++ ) { createEventListener[i].onPersist(event); }
errorIfClosed(); checkTransactionSynchStatus(); ReplicateEventListener[] replicateEventListener = listeners.getReplicateEventListeners(); for ( int i = 0; i < replicateEventListener.length; i++ ) { replicateEventListener[i].onReplicate(event); }
Clone fragments detected by clone detection tool
File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/impl/SessionImpl.java File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/impl/SessionImpl.java
Method name: void firePersistOnFlush(PersistEvent) Method name: void fireReplicate(ReplicateEvent)
Number of AST nodes: 5 Number of AST nodes: 5
1
errorIfClosed();
1
errorIfClosed();
2
		checkTransactionSynchStatus();
2
		checkTransactionSynchStatus();
3
		PersistEventListener[] createEventListener = listeners.getPersistOnFlushEventListeners();
3
		ReplicateEventListener[] replicateEventListener = listeners.getReplicateEventListeners();
4
		for ( int i = 0; i < createEventListener.length; i++ ) {
4
		for ( int i = 0; i < replicateEventListener.length; i++ ) {
5
			createEventListener[i].onPersist(event);
5
			replicateEventListener[i].onReplicate(event);
6
		}
6
		}
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 declared in the same class
Number of node comparisons13
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements3
    Number of unmapped statements in the first code fragment2
    Number of unmapped statements in the second code fragment2
    Time elapsed for statement mapping (ms)21.9
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    errorIfClosed();
    1
    errorIfClosed();
    2
    checkTransactionSynchStatus();
    2
    checkTransactionSynchStatus();
                                                                                                                                                                                        
    3
    ReplicateEventListener[] replicateEventListener = listeners.getReplicateEventListeners();
    3
    PersistEventListener[] createEventListener = listeners.getPersistOnFlushEventListeners();
                                                                                                                                                                                        
    4
    for (int i = 0; i < createEventListener.length; i++)
    4
    for (int i = 0; i < createEventListener.length; i++)
    4
    for (int i = 0; i < replicateEventListener.length; i++)
    Differences
    Expression1Expression2Difference
    createEventListenerreplicateEventListenerVARIABLE_NAME_MISMATCH
    org.hibernate.event.PersistEventListener[]org.hibernate.event.ReplicateEventListener[]VARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type int of variable createEventListener.length does not match with type int of variable replicateEventListener.length
    • Make classes org.hibernate.event.PersistEventListener[] and org.hibernate.event.ReplicateEventListener[] extend a common superclass
    4
    for (int i = 0; i < replicateEventListener.length; i++)
                                                                                                    
    5
    replicateEventListener[i].onReplicate(event);
    Preondition Violations
    Unmatched statement replicateEventListener[i].onReplicate(event); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    Unmatched statement replicateEventListener[i].onReplicate(event); 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
    5
    replicateEventListener[i].onReplicate(event);
    5
    createEventListener[i].onPersist(event);
    5
    createEventListener[i].onPersist(event);
    Preondition Violations
    Unmatched statement createEventListener[i].onPersist(event); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    Unmatched statement createEventListener[i].onPersist(event); 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 (5)
    Row Violation
    1Type int of variable createEventListener.length does not match with type int of variable replicateEventListener.length
    2Unmatched statement replicateEventListener[i].onReplicate(event); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    3Unmatched statement replicateEventListener[i].onReplicate(event); 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
    4Unmatched statement createEventListener[i].onPersist(event); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    5Unmatched statement createEventListener[i].onPersist(event); 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