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(); }
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(); }
Clone fragments detected by clone detection tool
File path: /hibernate-distribution-3.3.2.GA/project/testsuite/src/test/java/org/hibernate/test/lob/BlobTest.java File path: /hibernate-distribution-3.3.2.GA/project/testsuite/src/test/java/org/hibernate/test/lob/ClobTest.java
Method name: void testBoundedBlobLocatorAccess() Method name: void testBoundedClobLocatorAccess()
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.getBlobLocator().truncate( 1 );
5
			entity.getClobLocator().truncate( 1 );
6
			entity.getBlobLocator().setBytes( 1, changed );
6
			entity.getClobLocator().setString( 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.getBlobLocator() );
12
			assertNotNull( entity.getClobLocator() );
13
			assertEquals( BLOB_SIZE, entity.getBlobLocator().length() );
13
			assertEquals( CLOB_SIZE, entity.getClobLocator().length() );
14
			assertEquals( changed, extractData( entity.getBlobLocator() ) );
14
			assertEquals( changed, extractData( entity.getClobLocator() ) );
15
			entity.getBlobLocator().truncate( 1 );
15
			entity.getClobLocator().truncate( 1 );
16
			entity.getBlobLocator().setBytes( 1, original );
16
			entity.getClobLocator().setString( 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.1
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)20.3
    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.getBlobLocator().truncate(1);
    21
    entity.getBlobLocator().truncate(1);
    21
    entity.getClobLocator().truncate(1);
    Differences
    Expression1Expression2Difference
    getBlobLocatorgetClobLocatorMETHOD_INVOCATION_NAME_MISMATCH
    java.sql.Blobjava.sql.ClobVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Expression entity.getBlobLocator() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression entity.getClobLocator() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Type java.sql.Blob of variable entity.getBlobLocator() does not match with type java.sql.Clob of variable entity.getClobLocator()
    • Make classes java.sql.Blob and java.sql.Clob extend a common superclass
    21
    entity.getClobLocator().truncate(1);
    22
    entity.getBlobLocator().setBytes(1, changed);
    22
    entity.getBlobLocator().setBytes(1, changed);
    22
    entity.getClobLocator().setString(1, changed);
    Differences
    Expression1Expression2Difference
    setBytessetStringMETHOD_INVOCATION_NAME_MISMATCH
    byte[]java.lang.StringVARIABLE_TYPE_MISMATCH
    getBlobLocatorgetClobLocatorMETHOD_INVOCATION_NAME_MISMATCH
    java.sql.Blobjava.sql.ClobVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Expression entity.getBlobLocator().setBytes(1,changed) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression entity.getClobLocator().setString(1,changed) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Type byte[] of variable changed does not match with type java.lang.String of variable changed
    • Make classes byte[] and java.lang.String extend a common superclass
    Expression entity.getBlobLocator() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression entity.getClobLocator() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Type java.sql.Blob of variable entity.getBlobLocator() does not match with type java.sql.Clob of variable entity.getClobLocator()
    • Make classes java.sql.Blob and java.sql.Clob extend a common superclass
    22
    entity.getClobLocator().setString(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.getBlobLocator());
    28
    assertNotNull(entity.getBlobLocator());
    28
    assertNotNull(entity.getClobLocator());
    Differences
    Expression1Expression2Difference
    getBlobLocatorgetClobLocatorMETHOD_INVOCATION_NAME_MISMATCH
    java.sql.Blobjava.sql.ClobVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Expression entity.getBlobLocator() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression entity.getClobLocator() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Type java.sql.Blob of variable entity.getBlobLocator() does not match with type java.sql.Clob of variable entity.getClobLocator()
    • Make classes java.sql.Blob and java.sql.Clob extend a common superclass
    28
    assertNotNull(entity.getClobLocator());
    29
    assertEquals(BLOB_SIZE, entity.getBlobLocator().length());
    29
    assertEquals(BLOB_SIZE, entity.getBlobLocator().length());
    30
    assertEquals(changed, extractData(entity.getClobLocator()));
    Differences
    Expression1Expression2Difference
    BLOB_SIZEchangedVARIABLE_NAME_MISMATCH
    intjava.lang.StringVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type int of variable BLOB_SIZE does not match with type java.lang.String of variable changed
    30
    assertEquals(changed, extractData(entity.getClobLocator()));
    30
    assertEquals(changed, extractData(entity.getBlobLocator()));
    30
    assertEquals(changed, extractData(entity.getBlobLocator()));
    29
    assertEquals(CLOB_SIZE, entity.getClobLocator().length());
    Differences
    Expression1Expression2Difference
    changedCLOB_SIZEVARIABLE_NAME_MISMATCH
    byte[]intVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type byte[] of variable changed does not match with type int of variable CLOB_SIZE
    29
    assertEquals(CLOB_SIZE, entity.getClobLocator().length());
    31
    entity.getBlobLocator().truncate(1);
    31
    entity.getBlobLocator().truncate(1);
    31
    entity.getClobLocator().truncate(1);
    Differences
    Expression1Expression2Difference
    getBlobLocatorgetClobLocatorMETHOD_INVOCATION_NAME_MISMATCH
    java.sql.Blobjava.sql.ClobVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Expression entity.getBlobLocator() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression entity.getClobLocator() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Type java.sql.Blob of variable entity.getBlobLocator() does not match with type java.sql.Clob of variable entity.getClobLocator()
    • Make classes java.sql.Blob and java.sql.Clob extend a common superclass
    31
    entity.getClobLocator().truncate(1);
    32
    entity.getBlobLocator().setBytes(1, original);
    32
    entity.getBlobLocator().setBytes(1, original);
    32
    entity.getClobLocator().setString(1, original);
    Differences
    Expression1Expression2Difference
    setBytessetStringMETHOD_INVOCATION_NAME_MISMATCH
    byte[]java.lang.StringVARIABLE_TYPE_MISMATCH
    getBlobLocatorgetClobLocatorMETHOD_INVOCATION_NAME_MISMATCH
    java.sql.Blobjava.sql.ClobVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Expression entity.getBlobLocator().setBytes(1,original) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression entity.getClobLocator().setString(1,original) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Type byte[] of variable original does not match with type java.lang.String of variable original
    • Make classes byte[] and java.lang.String extend a common superclass
    Expression entity.getBlobLocator() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression entity.getClobLocator() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Type java.sql.Blob of variable entity.getBlobLocator() does not match with type java.sql.Clob of variable entity.getClobLocator()
    • Make classes java.sql.Blob and java.sql.Clob extend a common superclass
    32
    entity.getClobLocator().setString(1, original);
    33
    s.getTransaction().commit();
    33
    s.getTransaction().commit();
    34
    s.close();
    34
    s.close();
    Precondition Violations (23)
    Row Violation
    1Expression entity.getBlobLocator() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression entity.getClobLocator() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Type java.sql.Blob of variable entity.getBlobLocator() does not match with type java.sql.Clob of variable entity.getClobLocator()
    4Expression entity.getBlobLocator().setBytes(1,changed) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    5Expression entity.getClobLocator().setString(1,changed) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    6Type byte[] of variable changed does not match with type java.lang.String of variable changed
    7Expression entity.getBlobLocator() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    8Expression entity.getClobLocator() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    9Type java.sql.Blob of variable entity.getBlobLocator() does not match with type java.sql.Clob of variable entity.getClobLocator()
    10Expression entity.getBlobLocator() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    11Expression entity.getClobLocator() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    12Type java.sql.Blob of variable entity.getBlobLocator() does not match with type java.sql.Clob of variable entity.getClobLocator()
    13Type int of variable BLOB_SIZE does not match with type java.lang.String of variable changed
    14Type byte[] of variable changed does not match with type int of variable CLOB_SIZE
    15Expression entity.getBlobLocator() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    16Expression entity.getClobLocator() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    17Type java.sql.Blob of variable entity.getBlobLocator() does not match with type java.sql.Clob of variable entity.getClobLocator()
    18Expression entity.getBlobLocator().setBytes(1,original) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    19Expression entity.getClobLocator().setString(1,original) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    20Type byte[] of variable original does not match with type java.lang.String of variable original
    21Expression entity.getBlobLocator() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    22Expression entity.getClobLocator() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    23Type java.sql.Blob of variable entity.getBlobLocator() does not match with type java.sql.Clob of variable entity.getClobLocator()