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" );
Summary
Number of common nesting structure subtrees1
Number of refactorable cases0
Number of non-refactorable cases1
Time elapsed for finding largest common nesting structure subtrees (ms)0.0
Clones locationClones are in different classes having the same super class
Number of node comparisons36
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements6
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)0.0
    Clone typeType 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);
    14
    s.update(item);
    Differences
    Expression1Expression2Difference
    org.hibernate.test.cache.jbc2.functional.VersionedItemorg.hibernate.test.cache.VersionedItemVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.hibernate.test.cache.jbc2.functional.VersionedItem of variable item does not match with type org.hibernate.test.cache.VersionedItem of variable item
    • Make classes org.hibernate.test.cache.jbc2.functional.VersionedItem and org.hibernate.test.cache.VersionedItem extend a common superclass
    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
    1Type org.hibernate.test.cache.jbc2.functional.VersionedItem of variable item does not match with type org.hibernate.test.cache.VersionedItem of variable item
    2Clone fragment #1 returns variables s, txn , while Clone fragment #2 returns variables s, txn