if ( supportsLobValueChangePropogation() ) { s = openSession(); s.beginTransaction(); entity = ( LobHolder ) s.get( LobHolder.class, entity.getId(), LockMode.UPGRADE ); entity.getClobLocator().truncate( 1 ); entity.getClobLocator().setString( 1, changed ); s.getTransaction().commit(); s.close(); s = openSession(); s.beginTransaction(); entity = ( LobHolder ) s.get( LobHolder.class, entity.getId(), LockMode.UPGRADE ); assertNotNull( entity.getClobLocator() ); assertEquals( CLOB_SIZE, entity.getClobLocator().length() ); assertEquals( changed, extractData( entity.getClobLocator() ) ); entity.getClobLocator().truncate( 1 ); entity.getClobLocator().setString( 1, original ); s.getTransaction().commit(); s.close(); }
if ( supportsLobValueChangePropogation() ) { s = openSession(); s.beginTransaction(); entity = ( LobHolder ) s.get( LobHolder.class, entity.getId(), LockMode.UPGRADE ); entity.getBlobLocator().truncate( 1 ); entity.getBlobLocator().setBytes( 1, changed ); s.getTransaction().commit(); s.close(); s = openSession(); s.beginTransaction(); entity = ( LobHolder ) s.get( LobHolder.class, entity.getId(), LockMode.UPGRADE ); assertNotNull( entity.getBlobLocator() ); assertEquals( BLOB_SIZE, entity.getBlobLocator().length() ); assertEquals( changed, extractData( entity.getBlobLocator() ) ); entity.getBlobLocator().truncate( 1 ); entity.getBlobLocator().setBytes( 1, original ); s.getTransaction().commit(); 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/lob/ClobTest.java File path: /hibernate-distribution-3.3.2.GA/project/testsuite/src/test/java/org/hibernate/test/lob/BlobTest.java
Method name: void testBoundedClobLocatorAccess() Method name: void testBoundedBlobLocatorAccess()
Number of AST nodes: 18 Number of AST nodes: 18
1
if ( supportsLobValueChangePropogation() ) {
1
if ( supportsLobValueChangePropogation() ) {
2
			s = openSession();
2
			s = openSession();
3
			s.beginTransaction();
3
			s.beginTransaction();
4
			entity = ( LobHolder ) s.get( LobHolder.class, entity.getId(), LockMode.UPGRADE );
4
			entity = ( LobHolder ) s.get( LobHolder.class, entity.getId(), LockMode.UPGRADE );
5
			entity.getClobLocator().truncate( 1 );
5
			entity.getBlobLocator().truncate( 1 );
6
			entity.getClobLocator().setString( 1, changed );
6
			entity.getBlobLocator().setBytes( 1, changed );
7
			s.getTransaction().commit();
7
			s.getTransaction().commit();
8
			s.close();
8
			s.close();
9
			s = openSession();
9
			s = openSession();
10
			s.beginTransaction();
10
			s.beginTransaction();
11
			entity = ( LobHolder ) s.get( LobHolder.class, entity.getId(), LockMode.UPGRADE );
11
			entity = ( LobHolder ) s.get( LobHolder.class, entity.getId(), LockMode.UPGRADE );
12
			assertNotNull( entity.getClobLocator() );
12
			assertNotNull( entity.getBlobLocator() );
13
			assertEquals( CLOB_SIZE, entity.getClobLocator().length() );
13
			assertEquals( BLOB_SIZE, entity.getBlobLocator().length() );
14
			assertEquals( changed, extractData( entity.getClobLocator() ) );
14
			assertEquals( changed, extractData( entity.getBlobLocator() ) );
15
			entity.getClobLocator().truncate( 1 );
15
			entity.getBlobLocator().truncate( 1 );
16
			entity.getClobLocator().setString( 1, original );
16
			entity.getBlobLocator().setBytes( 1, original );
17
			s.getTransaction().commit();
17
			s.getTransaction().commit();
18
			s.close();
18
			s.close();
19
		}
19
		}
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.2
Clones locationClones are in different classes having the same super class
Number of node comparisons324
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements18
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)22.4
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    17
    if (supportsLobValueChangePropogation())
    17
    if (supportsLobValueChangePropogation())
    18
    s = openSession();
    18
    s = openSession();
    19
    s.beginTransaction();
    19
    s.beginTransaction();
    20
    entity = (LobHolder)s.get(LobHolder.class, entity.getId(), LockMode.UPGRADE);
    20
    entity = (LobHolder)s.get(LobHolder.class, entity.getId(), LockMode.UPGRADE);
    21
    entity.getClobLocator().truncate(1);
    21
    entity.getClobLocator().truncate(1);
    21
    entity.getBlobLocator().truncate(1);
    Differences
    Expression1Expression2Difference
    getClobLocatorgetBlobLocatorMETHOD_INVOCATION_NAME_MISMATCH
    java.sql.Clobjava.sql.BlobVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Expression entity.getClobLocator() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression entity.getBlobLocator() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Type java.sql.Clob of variable entity.getClobLocator() does not match with type java.sql.Blob of variable entity.getBlobLocator()
    • Make classes java.sql.Clob and java.sql.Blob extend a common superclass
    21
    entity.getBlobLocator().truncate(1);
    22
    entity.getClobLocator().setString(1, changed);
    22
    entity.getClobLocator().setString(1, changed);
    22
    entity.getBlobLocator().setBytes(1, changed);
    Differences
    Expression1Expression2Difference
    setStringsetBytesMETHOD_INVOCATION_NAME_MISMATCH
    java.lang.Stringbyte[]VARIABLE_TYPE_MISMATCH
    getClobLocatorgetBlobLocatorMETHOD_INVOCATION_NAME_MISMATCH
    java.sql.Clobjava.sql.BlobVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Expression entity.getClobLocator().setString(1,changed) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression entity.getBlobLocator().setBytes(1,changed) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Type java.lang.String of variable changed does not match with type byte[] of variable changed
    • Make classes java.lang.String and byte[] extend a common superclass
    Expression entity.getClobLocator() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression entity.getBlobLocator() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Type java.sql.Clob of variable entity.getClobLocator() does not match with type java.sql.Blob of variable entity.getBlobLocator()
    • Make classes java.sql.Clob and java.sql.Blob extend a common superclass
    22
    entity.getBlobLocator().setBytes(1, changed);
    23
    s.getTransaction().commit();
    23
    s.getTransaction().commit();
    24
    s.close();
    24
    s.close();
    25
    s = openSession();
    25
    s = openSession();
    26
    s.beginTransaction();
    26
    s.beginTransaction();
    27
    entity = (LobHolder)s.get(LobHolder.class, entity.getId(), LockMode.UPGRADE);
    27
    entity = (LobHolder)s.get(LobHolder.class, entity.getId(), LockMode.UPGRADE);
    28
    assertNotNull(entity.getClobLocator());
    28
    assertNotNull(entity.getClobLocator());
    28
    assertNotNull(entity.getBlobLocator());
    Differences
    Expression1Expression2Difference
    getClobLocatorgetBlobLocatorMETHOD_INVOCATION_NAME_MISMATCH
    java.sql.Clobjava.sql.BlobVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Expression entity.getClobLocator() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression entity.getBlobLocator() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Type java.sql.Clob of variable entity.getClobLocator() does not match with type java.sql.Blob of variable entity.getBlobLocator()
    • Make classes java.sql.Clob and java.sql.Blob extend a common superclass
    28
    assertNotNull(entity.getBlobLocator());
    29
    assertEquals(CLOB_SIZE, entity.getClobLocator().length());
    29
    assertEquals(CLOB_SIZE, entity.getClobLocator().length());
    30
    assertEquals(changed, extractData(entity.getBlobLocator()));
    Differences
    Expression1Expression2Difference
    CLOB_SIZEchangedVARIABLE_NAME_MISMATCH
    intbyte[]VARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type int of variable CLOB_SIZE does not match with type byte[] of variable changed
    30
    assertEquals(changed, extractData(entity.getBlobLocator()));
    30
    assertEquals(changed, extractData(entity.getClobLocator()));
    30
    assertEquals(changed, extractData(entity.getClobLocator()));
    29
    assertEquals(BLOB_SIZE, entity.getBlobLocator().length());
    Differences
    Expression1Expression2Difference
    changedBLOB_SIZEVARIABLE_NAME_MISMATCH
    java.lang.StringintVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.lang.String of variable changed does not match with type int of variable BLOB_SIZE
    29
    assertEquals(BLOB_SIZE, entity.getBlobLocator().length());
    31
    entity.getClobLocator().truncate(1);
    31
    entity.getClobLocator().truncate(1);
    31
    entity.getBlobLocator().truncate(1);
    Differences
    Expression1Expression2Difference
    getClobLocatorgetBlobLocatorMETHOD_INVOCATION_NAME_MISMATCH
    java.sql.Clobjava.sql.BlobVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Expression entity.getClobLocator() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression entity.getBlobLocator() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Type java.sql.Clob of variable entity.getClobLocator() does not match with type java.sql.Blob of variable entity.getBlobLocator()
    • Make classes java.sql.Clob and java.sql.Blob extend a common superclass
    31
    entity.getBlobLocator().truncate(1);
    32
    entity.getClobLocator().setString(1, original);
    32
    entity.getClobLocator().setString(1, original);
    32
    entity.getBlobLocator().setBytes(1, original);
    Differences
    Expression1Expression2Difference
    setStringsetBytesMETHOD_INVOCATION_NAME_MISMATCH
    java.lang.Stringbyte[]VARIABLE_TYPE_MISMATCH
    getClobLocatorgetBlobLocatorMETHOD_INVOCATION_NAME_MISMATCH
    java.sql.Clobjava.sql.BlobVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Expression entity.getClobLocator().setString(1,original) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression entity.getBlobLocator().setBytes(1,original) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Type java.lang.String of variable original does not match with type byte[] of variable original
    • Make classes java.lang.String and byte[] extend a common superclass
    Expression entity.getClobLocator() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression entity.getBlobLocator() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Type java.sql.Clob of variable entity.getClobLocator() does not match with type java.sql.Blob of variable entity.getBlobLocator()
    • Make classes java.sql.Clob and java.sql.Blob extend a common superclass
    32
    entity.getBlobLocator().setBytes(1, original);
    33
    s.getTransaction().commit();
    33
    s.getTransaction().commit();
    34
    s.close();
    34
    s.close();
    Precondition Violations (23)
    Row Violation
    1Expression entity.getClobLocator() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression entity.getBlobLocator() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Type java.sql.Clob of variable entity.getClobLocator() does not match with type java.sql.Blob of variable entity.getBlobLocator()
    4Expression entity.getClobLocator().setString(1,changed) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    5Expression entity.getBlobLocator().setBytes(1,changed) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    6Type java.lang.String of variable changed does not match with type byte[] of variable changed
    7Expression entity.getClobLocator() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    8Expression entity.getBlobLocator() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    9Type java.sql.Clob of variable entity.getClobLocator() does not match with type java.sql.Blob of variable entity.getBlobLocator()
    10Expression entity.getClobLocator() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    11Expression entity.getBlobLocator() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    12Type java.sql.Clob of variable entity.getClobLocator() does not match with type java.sql.Blob of variable entity.getBlobLocator()
    13Type int of variable CLOB_SIZE does not match with type byte[] of variable changed
    14Type java.lang.String of variable changed does not match with type int of variable BLOB_SIZE
    15Expression entity.getClobLocator() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    16Expression entity.getBlobLocator() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    17Type java.sql.Clob of variable entity.getClobLocator() does not match with type java.sql.Blob of variable entity.getBlobLocator()
    18Expression entity.getClobLocator().setString(1,original) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    19Expression entity.getBlobLocator().setBytes(1,original) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    20Type java.lang.String of variable original does not match with type byte[] of variable original
    21Expression entity.getClobLocator() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    22Expression entity.getBlobLocator() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    23Type java.sql.Clob of variable entity.getClobLocator() does not match with type java.sql.Blob of variable entity.getBlobLocator()