File path: /hibernate-distribution-3.3.2.GA/project/cache-jbosscache2/src/test/java/org/hibernate/test/util/CacheTestUtil.java | File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/engine/StatefulPersistenceContext.java | |||
Method name: TestSuite createFailureExpectedSuite(Class)
|
Method name: Object unproxy(Object)
|
|||
Number of AST nodes: 5 | Number of AST nodes: 7 | |||
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 | }↵ | |||
7 | ↵ | 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;↵ | |||
8 | } | 14 | } | |
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 | 2 |
Number of unmapped statements in the second code fragment | 3 |
Time elapsed for statement mapping (ms) | 0.6 |
Clone type | Type 3 |
ID | Statement | ID | Statement | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 4 | HibernateProxy proxy = (HibernateProxy)maybeProxy; | ||||||||||||
| 5 | LazyInitializer li = proxy.getHibernateLazyInitializer(); | ||||||||||||
15 | String name = ((TestCase)t).getName(); |
| | |||||||||||
16 | if (!failureExpected.contains(name + "FailureExpected")) |
| 6 | if (li.isUninitialized()) | ||||||||||
|
| 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 | Unmatched throw new PersistentObjectException("object was an uninitialized proxy for " + li.getEntityName()); |