s = openSession();
txn = s.beginTransaction();
s.update(item);
txn.commit();
s.close();
fail("expected stale write to fail");
s = openSession();
txn = s.beginTransaction();
s.update( item );
txn.commit();
s.close();
fail( "expected stale write to fail" );
Clone fragments detected by clone detection tool
File path: /hibernate-distribution-3.3.2.GA/project/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/functional/AbstractEntityCacheFunctionalTestCase.java
|
|
File path: /hibernate-distribution-3.3.2.GA/project/testing/src/main/java/org/hibernate/test/cache/BaseCacheProviderTestCase.java
|
Method name: void testStaleWritesLeaveCacheConsistent()
|
|
Method name: void testStaleWritesLeaveCacheConsistent()
|
Number of AST nodes: 6
|
|
Number of AST nodes: 6
|
|
1 | s = openSession();↵ | | 1 | s = openSession();↵
|
2 | txn = s.beginTransaction();↵ | | 2 | txn = s.beginTransaction();↵
|
3 | s.update(item);↵ | | 3 | s.update( item );↵
|
4 | txn.commit();↵ | | 4 | txn.commit();↵
|
5 | s.close();↵ | | |
|
6 | ↵ | | 5 | s.close();↵
|
7 | fail("expected stale write to fail"); | | 6 | fail( "expected stale write to fail" );
|
See real code fragment |
|
See real code fragment |
Summary
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.0 |
Clones location | Clones are in different classes having the same super class |
Number of node comparisons | 36 |
-
{Non-refactorable}
Mapping Summary
Number of mapped statements | 6 |
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) | 0.0 |
Clone type | Type 2 |
Mapped Statements
ID |
Statement |
|
ID |
Statement |
12 | s = openSession(); | | 12 | s = openSession(); |
13 | txn = s.beginTransaction(); | | 13 | txn = s.beginTransaction(); |
14 | s.update(item); | | 14 | s.update(item); |
15 | txn.commit(); | | 15 | txn.commit(); |
16 | s.close(); | | 16 | s.close(); |
17 | fail("expected stale write to fail"); | | 17 | fail("expected stale write to fail"); |
Precondition Violations (2)
Row |
Violation |
1 | Type org.hibernate.test.cache.jbc2.functional.VersionedItem of variable item does not match with type org.hibernate.test.cache.VersionedItem of variable item |
2 | Clone fragment #1 returns variables s, txn , while Clone fragment #2 returns variables s, txn |