for ( int i = 0; i < size; i++ ) { Map.Entry e = ( Map.Entry ) list.get( i ); ( (CollectionEntry) e.getValue() ).preFlush( (PersistentCollection) e.getKey() ); }
for ( int i = 0; i < createdAnimalIds.size(); i++ ) { Animal animal = ( Animal ) session.load( Animal.class, ( Long ) createdAnimalIds.get( i ) ); session.delete( animal ); }
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/hql/ASTParserLoadingTest.java
Method name: void prepareCollectionFlushes(SessionImplementor) Method name: void destroyTestBaseData()
Number of AST nodes: 3 Number of AST nodes: 3
1
for ( int i = 0; i < size; i++ ) {
1
for ( int i = 0; i < createdAnimalIds.size(); i++ ) {
2
			Map.Entry e = ( Map.Entry ) list.get( i );
2
			
3
			( (CollectionEntry) e.getValue() ).preFlush( (PersistentCollection) e.getKey()
3
Animal animal = ( Animal ) session.load( Animal.class, ( Long ) createdAnimalIds.get( i ) );
4
 );
4
			session.delete( animal );
5
		}
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.2
Clones locationClones are in different classes
Number of node comparisons9
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements1
    Number of unmapped statements in the first code fragment2
    Number of unmapped statements in the second code fragment2
    Time elapsed for statement mapping (ms)1.8
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    4
    for (int i = 0; i < size; i++)
    4
    for (int i = 0; i < size; i++)
    3
    for (int i = 0; i < createdAnimalIds.size(); i++)
    Differences
    Expression1Expression2Difference
    sizecreatedAnimalIds.size()TYPE_COMPATIBLE_REPLACEMENT
    3
    for (int i = 0; i < createdAnimalIds.size(); i++)
                                                                                                                                                                        
    4
    Animal animal = (Animal)session.load(Animal.class, (Long)createdAnimalIds.get(i));
    Preondition Violations
    Unmatched statement Animal animal=(Animal)session.load(Animal.class,(Long)createdAnimalIds.get(i)); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    Unmatched statement Animal animal=(Animal)session.load(Animal.class,(Long)createdAnimalIds.get(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
    Animal animal = (Animal)session.load(Animal.class, (Long)createdAnimalIds.get(i));
                                                        
    5
    session.delete(animal);
    Preondition Violations
    Unmatched statement session.delete(animal); 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
    session.delete(animal);
    5
    Map.Entry e = (Map.Entry)list.get(i);
    5
    Map.Entry e = (Map.Entry)list.get(i);
    Preondition Violations
    Unmatched statement Map.Entry e=(Map.Entry)list.get(i); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                
    6
    ((CollectionEntry)e.getValue()).preFlush((PersistentCollection)e.getKey());
    6
    ((CollectionEntry)e.getValue()).preFlush((PersistentCollection)e.getKey());
    Preondition Violations
    Unmatched statement ((CollectionEntry)e.getValue()).preFlush((PersistentCollection)e.getKey()); 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 (6)
    Row Violation
    1Unmatched statement Animal animal=(Animal)session.load(Animal.class,(Long)createdAnimalIds.get(i)); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    2Unmatched statement Animal animal=(Animal)session.load(Animal.class,(Long)createdAnimalIds.get(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
    3Unmatched statement session.delete(animal); 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 Map.Entry e=(Map.Entry)list.get(i); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    5Unmatched statement ((CollectionEntry)e.getValue()).preFlush((PersistentCollection)e.getKey()); 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
    6The refactoring of the clones is infeasible, because the number of macthed statements is equal to zero