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 statements17
    Number of unmapped statements in the first code fragment1
    Number of unmapped statements in the second code fragment1
    Time elapsed for statement mapping (ms)37.5
    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
    byte[]java.lang.StringVARIABLE_TYPE_MISMATCH
    setBytessetStringMETHOD_INVOCATION_NAME_MISMATCH
    getBlobLocatorgetClobLocatorMETHOD_INVOCATION_NAME_MISMATCH
    java.sql.Blobjava.sql.ClobVARIABLE_TYPE_MISMATCH
    Preondition Violations
    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().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
    Expression entity.getBlobLocator().setBytes(1,changed) is a void method call, and thus it cannot be parameterized
    Expression entity.getClobLocator().setString(1,changed) is a void method call, and thus it cannot be parameterized
    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(CLOB_SIZE, entity.getClobLocator().length());
    Preondition Violations
    Unmatched statement assertEquals(CLOB_SIZE,entity.getClobLocator().length()); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    Unmatched statement assertEquals(CLOB_SIZE,entity.getClobLocator().length()); cannot be moved before or after the extracted code, because it throws exception(s) that should be caught by a try block that will be extracted
    29
    assertEquals(CLOB_SIZE, entity.getClobLocator().length());
    29
    assertEquals(BLOB_SIZE, entity.getBlobLocator().length());
    29
    assertEquals(BLOB_SIZE, entity.getBlobLocator().length());
    Preondition Violations
    Unmatched statement assertEquals(BLOB_SIZE,entity.getBlobLocator().length()); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    Unmatched statement assertEquals(BLOB_SIZE,entity.getBlobLocator().length()); cannot be moved before or after the extracted code, because it throws exception(s) that should be caught by a try block that will be extracted
                                                                                                                              
    30
    assertEquals(changed, extractData(entity.getBlobLocator()));
    30
    assertEquals(changed, extractData(entity.getBlobLocator()));
    30
    assertEquals(changed, extractData(entity.getClobLocator()));
    Differences
    Expression1Expression2Difference
    byte[]java.lang.StringVARIABLE_TYPE_MISMATCH
    getBlobLocatorgetClobLocatorMETHOD_INVOCATION_NAME_MISMATCH
    java.sql.Blobjava.sql.ClobVARIABLE_TYPE_MISMATCH
    byte[]java.lang.StringVARIABLE_TYPE_MISMATCH
    Preondition Violations
    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
    Expression extractData(entity.getBlobLocator()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    • Inline private method extractData
    Expression extractData(entity.getClobLocator()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    • Inline private method extractData
    Type byte[] of variable extractData(entity.getBlobLocator()) does not match with type java.lang.String of variable extractData(entity.getClobLocator())
    • Make classes byte[] and java.lang.String extend a common superclass
    30
    assertEquals(changed, extractData(entity.getClobLocator()));
    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
    byte[]java.lang.StringVARIABLE_TYPE_MISMATCH
    setBytessetStringMETHOD_INVOCATION_NAME_MISMATCH
    getBlobLocatorgetClobLocatorMETHOD_INVOCATION_NAME_MISMATCH
    java.sql.Blobjava.sql.ClobVARIABLE_TYPE_MISMATCH
    Preondition Violations
    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().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
    Expression entity.getBlobLocator().setBytes(1,original) is a void method call, and thus it cannot be parameterized
    Expression entity.getClobLocator().setString(1,original) is a void method call, and thus it cannot be parameterized
    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 (36)
    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()
    4Type byte[] of variable changed does not match with type java.lang.String of variable changed
    5Expression entity.getBlobLocator().setBytes(1,changed) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    6Expression entity.getClobLocator().setString(1,changed) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    7Expression entity.getBlobLocator().setBytes(1,changed) is a void method call, and thus it cannot be parameterized
    8Expression entity.getClobLocator().setString(1,changed) is a void method call, and thus it cannot be parameterized
    9Expression entity.getBlobLocator() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    10Expression entity.getClobLocator() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    11Type java.sql.Blob of variable entity.getBlobLocator() does not match with type java.sql.Clob of variable entity.getClobLocator()
    12Expression entity.getBlobLocator() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    13Expression entity.getClobLocator() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    14Type java.sql.Blob of variable entity.getBlobLocator() does not match with type java.sql.Clob of variable entity.getClobLocator()
    15Unmatched statement assertEquals(CLOB_SIZE,entity.getClobLocator().length()); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    16Unmatched statement assertEquals(CLOB_SIZE,entity.getClobLocator().length()); cannot be moved before or after the extracted code, because it throws exception(s) that should be caught by a try block that will be extracted
    17Unmatched statement assertEquals(BLOB_SIZE,entity.getBlobLocator().length()); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    18Unmatched statement assertEquals(BLOB_SIZE,entity.getBlobLocator().length()); cannot be moved before or after the extracted code, because it throws exception(s) that should be caught by a try block that will be extracted
    19Type byte[] of variable changed does not match with type java.lang.String of variable changed
    20Expression entity.getBlobLocator() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    21Expression entity.getClobLocator() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    22Type java.sql.Blob of variable entity.getBlobLocator() does not match with type java.sql.Clob of variable entity.getClobLocator()
    23Expression extractData(entity.getBlobLocator()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    24Expression extractData(entity.getClobLocator()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    25Type byte[] of variable extractData(entity.getBlobLocator()) does not match with type java.lang.String of variable extractData(entity.getClobLocator())
    26Expression entity.getBlobLocator() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    27Expression entity.getClobLocator() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    28Type java.sql.Blob of variable entity.getBlobLocator() does not match with type java.sql.Clob of variable entity.getClobLocator()
    29Type byte[] of variable original does not match with type java.lang.String of variable original
    30Expression entity.getBlobLocator().setBytes(1,original) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    31Expression entity.getClobLocator().setString(1,original) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    32Expression entity.getBlobLocator().setBytes(1,original) is a void method call, and thus it cannot be parameterized
    33Expression entity.getClobLocator().setString(1,original) is a void method call, and thus it cannot be parameterized
    34Expression entity.getBlobLocator() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    35Expression entity.getClobLocator() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    36Type java.sql.Blob of variable entity.getBlobLocator() does not match with type java.sql.Clob of variable entity.getClobLocator()