try {
s.getTransaction().commit();
fail( "expecting TransientObjectException on flush" );
}
catch( TransientObjectException e ) {
// expected result
log.trace( "handled expected exception", e );
s.getTransaction().rollback();
}
finally {
s.close();
}
try {
s.getTransaction().commit();
fail( "expecting TransientObjectException on flush" );
}
catch( TransientObjectException e ) {
// expected result
log.trace( "handled expected exception", e );
s.getTransaction().rollback();
}
finally {
s.close();
}
Clone fragments detected by clone detection tool
File path: /hibernate-distribution-3.3.2.GA/project/testsuite/src/test/java/org/hibernate/test/jpa/cascade/CascadeTest.java
|
|
File path: /hibernate-distribution-3.3.2.GA/project/testsuite/src/test/java/org/hibernate/test/jpa/cascade/CascadeTest.java
|
Method name: void testOneToOneGeneratedIds()
|
|
Method name: void testManyToOnePropertyRefAssignedIds()
|
Number of AST nodes: 3
|
|
Number of AST nodes: 3
|
|
1 | try {↵ | | 1 | try {↵
|
2 | s.getTransaction().commit();↵ | | 2 | s.getTransaction().commit();↵
|
3 | fail( "expecting TransientObjectException on flush" );↵ | | 3 | fail( "expecting TransientObjectException on flush" );↵
|
4 | }↵ | | 4 | }↵
|
5 | catch( TransientObjectException e ) {↵ | | 5 | catch( TransientObjectException e ) {↵
|
6 | // expected result↵ | | 6 | // expected result↵
|
7 | log.trace( "handled expected exception", e );↵ | | 7 | log.trace( "handled expected exception", e );↵
|
8 | s.getTransaction().rollback();↵ | | 8 | s.getTransaction().rollback();↵
|
9 | }↵ | | 9 | }↵
|
10 | finally {↵ | | 10 | finally {↵
|
11 | s.close();↵ | | 11 | s.close();↵
|
12 | } | | 12 | }
|
See real code fragment |
|
See real code fragment |
Summary
Number of common nesting structure subtrees | 1 |
Number of refactorable cases | 1 |
Number of non-refactorable cases | 0 |
Time elapsed for finding largest common nesting structure subtrees (ms) | 0.3 |
Clones location | Clones are declared in the same class |
Number of node comparisons | 10 |
-
{Refactorable}
Mapping Summary
Number of mapped statements | 3 |
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) | 1.0 |
Clone type | Type 1 |
Mapped Statements
ID |
Statement |
|
ID |
Statement |
9 | try | | 8 | try |
10 | s.getTransaction().commit(); | | 9 | s.getTransaction().commit(); |
11 | fail("expecting TransientObjectException on flush"); | | 10 | fail("expecting TransientObjectException on flush"); |
Precondition Violations (0)
Row |
Violation |