File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/mapping/PersistentClass.java | File path: /hibernate-distribution-3.3.2.GA/project/testsuite/src/test/java/org/hibernate/test/hql/ASTParserLoadingTest.java | |||
Method name: Iterator getSubclassPropertyClosureIterator()
|
Method name: void destroyTestBaseData()
|
|||
Number of AST nodes: 7 | Number of AST nodes: 7 | |||
1 | ArrayList iters = new ArrayList();↵ | |||
2 | iters.add( getPropertyClosureIterator() );↵ | |||
3 | iters.add( subclassProperties.iterator() );↵ | 1 | Session session = openSession();↵ | |
2 | Transaction txn = session.beginTransaction();↵ | |||
4 | for ( int i=0; i<subclassJoins.size(); i++ ) {↵ | 3 | for ( int i = 0; i < createdAnimalIds.size(); i++ ) {↵ | |
5 | Join join = (Join) subclassJoins.get(i);↵ | 4 | Animal animal = ( Animal ) session.load( Animal.class, ( Long ) createdAnimalIds.get( i ) );↵ | |
6 | iters.add( join.getPropertyIterator() );↵ | 5 | session.delete( animal );↵ | |
7 | }↵ | 6 | }↵ | |
8 | return new JoinedIterator(iters↵ | 7 | txn.commit();↵ | |
9 | ); | 8 | session.close(); | |
See real code fragment | See real code fragment |
Number of common nesting structure subtrees | 1 |
Number of refactorable cases | 0 |
Number of non-refactorable cases | 1 |
Time elapsed for finding largest common nesting structure subtrees (ms) | 0.3 |
Clones location | Clones are in different classes |
Number of node comparisons | 25 |
Number of mapped statements | 1 |
Number of unmapped statements in the first code fragment | 6 |
Number of unmapped statements in the second code fragment | 6 |
Time elapsed for statement mapping (ms) | 2.5 |
Clone type | Type 2 |
ID | Statement | ID | Statement | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
| 1 | Session session = openSession(); | ||||||||||||||
1 | ArrayList iters = new ArrayList(); | | |||||||||||||||
| 2 | Transaction txn = session.beginTransaction(); | |||||||||||||||
2 | iters.add(getPropertyClosureIterator()); | | |||||||||||||||
3 | iters.add(subclassProperties.iterator()); | | |||||||||||||||
4 | for (int i = 0; i < subclassJoins.size(); i++) |
| 3 | for (int i = 0; i < createdAnimalIds.size(); i++) | |||||||||||||
|
| 4 | Animal animal = (Animal)session.load(Animal.class, (Long)createdAnimalIds.get(i)); | ||||||||||||||
|
| 5 | session.delete(animal); | ||||||||||||||
5 | Join join = (Join)subclassJoins.get(i); |
| | ||||||||||||||
6 | iters.add(join.getPropertyIterator()); | | |||||||||||||||
|
| 6 | txn.commit(); | ||||||||||||||
| 7 | session.close(); | |||||||||||||||
7 | return new JoinedIterator(iters); |
| |
Row | Violation |
---|---|
1 | Unmatched statement Session session=openSession(); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted |
2 | 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 |
3 | 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 | 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 | Unmatched statement Join join=(Join)subclassJoins.get(i); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
6 | Unmatched statement txn.commit(); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted |
7 | Unmatched return new JoinedIterator(iters); |
8 | The refactoring of the clones is infeasible, because the number of macthed statements is equal to zero |