File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/engine/StatefulPersistenceContext.java | File path: /hibernate-distribution-3.3.2.GA/project/testing/src/main/java/org/hibernate/junit/UnitTestCase.java | |||
Method name: Object unproxy(Object)
|
Method name: TestSuite createFailureExpectedSuite(Class)
|
|||
Number of AST nodes: 7 | Number of AST nodes: 5 | |||
1 | if ( maybeProxy instanceof HibernateProxy ) {↵ | |||
2 | HibernateProxy proxy = (HibernateProxy) maybeProxy;↵ | |||
3 | LazyInitializer li = proxy.getHibernateLazyInitializer();↵ | |||
4 | if ( li.isUninitialized() ) {↵ | |||
5 | throw new PersistentObjectException(↵ | |||
6 | "object was an uninitialized proxy for " +↵ | |||
7 | li.getEntityName()↵ | |||
8 | );↵ | |||
9 | }↵ | |||
10 | return li.getImplementation(); //unwrap the object↵ | |||
11 | }↵ | |||
12 | else {↵ | |||
13 | return maybeProxy;↵ | |||
14 | ↵ | 1 | Test t = (Test) tests.nextElement();↵ | |
2 | if (t instanceof TestCase) {↵ | |||
3 | String name = ((TestCase) t).getName();↵ | |||
4 | if (!failureExpected.contains(name + "FailureExpected")) {↵ | |||
5 | result.addTest(t);↵ | |||
6 | }↵ | |||
15 | } | 7 | } | |
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.2 |
Clones location | Clones are in different classes |
Number of node comparisons | 7 |
Number of mapped statements | 1 |
Number of unmapped statements in the first code fragment | 3 |
Number of unmapped statements in the second code fragment | 2 |
Time elapsed for statement mapping (ms) | 37.3 |
Clone type | Type 3 |
ID | Statement | ID | Statement | |||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
4 | HibernateProxy proxy = (HibernateProxy)maybeProxy; | | ||||||||||||||
5 | LazyInitializer li = proxy.getHibernateLazyInitializer(); | | ||||||||||||||
|
| 15 | String name = ((TestCase)t).getName(); | |||||||||||||
6 | if (li.isUninitialized()) |
| 16 | if (!failureExpected.contains(name + "FailureExpected")) | ||||||||||||
7 | throw new PersistentObjectException("object was an uninitialized proxy for " + li.getEntityName()); |
| | |||||||||||||
| 17 | result.addTest(t); |
Row | Violation |
---|---|
1 | Unmatched statement String name=((TestCase)t).getName(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
2 | Expression li.isUninitialized() cannot be parameterized, because it has dependencies to/from statements that will be extracted |
3 | Expression !failureExpected.contains(name + "FailureExpected") cannot be parameterized, because it has dependencies to/from statements that will be extracted |
4 | Unmatched statement throw new PersistentObjectException("object was an uninitialized proxy for " + li.getEntityName()); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted |
5 | Unmatched statement throw new PersistentObjectException("object was an uninitialized proxy for " + li.getEntityName()); 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 |
6 | Unmatched throw new PersistentObjectException("object was an uninitialized proxy for " + li.getEntityName()); |
7 | The refactoring of the clones is infeasible, because the number of macthed statements is equal to zero |