File path: /hibernate-distribution-3.3.2.GA/project/testsuite/src/test/java/org/hibernate/test/bytecode/cglib/InvocationTargetExceptionTest.java | File path: /hibernate-distribution-3.3.2.GA/project/testsuite/src/test/java/org/hibernate/test/bytecode/javassist/InvocationTargetExceptionTest.java | |||
Method name: void testProxiedInvocationException()
|
Method name: void testProxiedInvocationException()
|
|||
Number of AST nodes: 20 | Number of AST nodes: 20 | |||
1 | if ( ! ( Environment.getBytecodeProvider() instanceof org.hibernate.bytecode.cglib.BytecodeProviderImpl ) ) {↵ | 1 | if ( !( Environment.getBytecodeProvider() instanceof org.hibernate.bytecode.javassist.BytecodeProviderImpl ) ) {↵ | |
2 | // because of the scoping :(↵ | 2 | // because of the scoping :(↵ | |
3 | reportSkip( ↵ | 3 | reportSkip(↵ | |
4 | "env not configured for cglib provider", "bytecode-provider InvocationTargetException handling" ↵ | 4 | "env not configured for javassist provider", "bytecode-provider InvocationTargetException handling"↵ | |
5 | );↵ | 5 | );↵ | |
6 | return;↵ | 6 | return;↵ | |
7 | }↵ | 7 | }↵ | |
8 | Session s = openSession();↵ | 8 | Session s = openSession();↵ | |
9 | s.beginTransaction();↵ | 9 | s.beginTransaction();↵ | |
10 | Bean bean = new Bean();↵ | 10 | Bean bean = new Bean();↵ | |
11 | bean.setSomeString( "my-bean" );↵ | 11 | bean.setSomeString( "my-bean" );↵ | |
12 | s.save( bean );↵ | 12 | s.save( bean );↵ | |
13 | s.getTransaction().commit();↵ | 13 | s.getTransaction().commit();↵ | |
14 | s.close();↵ | 14 | s.close();↵ | |
15 | s = openSession();↵ | 15 | s = openSession();↵ | |
16 | s.beginTransaction();↵ | 16 | s.beginTransaction();↵ | |
17 | bean = ( Bean ) s.load( Bean.class, bean.getSomeString() );↵ | 17 | bean = ( Bean ) s.load( Bean.class, bean.getSomeString() );↵ | |
18 | assertFalse( Hibernate.isInitialized( bean ) );↵ | 18 | assertFalse( Hibernate.isInitialized( bean ) );↵ | |
19 | try {↵ | 19 | try {↵ | |
20 | bean.throwException();↵ | 20 | bean.throwException();↵ | |
21 | fail( "exception not thrown" );↵ | 21 | fail( "exception not thrown" );↵ | |
22 | }↵ | 22 | }↵ | |
23 | catch ( ParseException e ) {↵ | 23 | catch ( ParseException e ) {↵ | |
24 | // expected behavior↵ | 24 | // expected behavior↵ | |
25 | }↵ | 25 | }↵ | |
26 | catch( Throwable t ) {↵ | 26 | catch ( Throwable t ) {↵ | |
27 | fail( "unexpected exception type : " + t );↵ | 27 | fail( "unexpected exception type : " + t );↵ | |
28 | }↵ | 28 | }↵ | |
29 | s.delete( bean );↵ | 29 | s.delete( bean );↵ | |
30 | s.getTransaction().commit();↵ | 30 | s.getTransaction().commit();↵ | |
31 | s.close(); | 31 |
| |
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) | 1.1 |
Clones location | Clones are in different classes having the same super class |
Number of node comparisons | 80 |
Number of mapped statements | 20 |
Number of unmapped statements in the first code fragment | 0 |
Number of unmapped statements in the second code fragment | 0 |
Time elapsed for statement mapping (ms) | 5.2 |
Clone type | Type 2 |
ID | Statement | ID | Statement | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | if (!(Environment.getBytecodeProvider() instanceof org.hibernate.bytecode.cglib.BytecodeProviderImpl)) |
| 1 | if (!(Environment.getBytecodeProvider() instanceof org.hibernate.bytecode.javassist.BytecodeProviderImpl)) | ||||||||||||||
2 | reportSkip("env not configured for cglib provider", "bytecode-provider InvocationTargetException handling"); |
| 2 | reportSkip("env not configured for javassist provider", "bytecode-provider InvocationTargetException handling"); | ||||||||||||||
3 | return; | 3 | return; | |||||||||||||||
4 | Session s = openSession(); | 4 | Session s = openSession(); | |||||||||||||||
5 | s.beginTransaction(); | 5 | s.beginTransaction(); | |||||||||||||||
6 | Bean bean = new Bean(); | 6 | Bean bean = new Bean(); | |||||||||||||||
7 | bean.setSomeString("my-bean"); | 7 | bean.setSomeString("my-bean"); | |||||||||||||||
8 | s.save(bean); | 8 | s.save(bean); | |||||||||||||||
9 | s.getTransaction().commit(); | 9 | s.getTransaction().commit(); | |||||||||||||||
10 | s.close(); | 10 | s.close(); | |||||||||||||||
11 | s = openSession(); | 11 | s = openSession(); | |||||||||||||||
12 | s.beginTransaction(); | 12 | s.beginTransaction(); | |||||||||||||||
13 | bean = (Bean)s.load(Bean.class, bean.getSomeString()); | 13 | bean = (Bean)s.load(Bean.class, bean.getSomeString()); | |||||||||||||||
14 | assertFalse(Hibernate.isInitialized(bean)); | 14 | assertFalse(Hibernate.isInitialized(bean)); | |||||||||||||||
15 | try | 15 | try | |||||||||||||||
16 | bean.throwException(); | 16 | bean.throwException(); | |||||||||||||||
17 | fail("exception not thrown"); | 17 | fail("exception not thrown"); | |||||||||||||||
18 | s.delete(bean); | 18 | s.delete(bean); | |||||||||||||||
19 | s.getTransaction().commit(); | 19 | s.getTransaction().commit(); | |||||||||||||||
20 | s.close(); | 20 | s.close(); |
Row | Violation |
---|---|
1 | Type org.hibernate.bytecode.cglib.BytecodeProviderImpl of variable org.hibernate.bytecode.cglib.BytecodeProviderImpl does not match with type org.hibernate.bytecode.javassist.BytecodeProviderImpl of variable org.hibernate.bytecode.javassist.BytecodeProviderImpl |