prepare(); Session s = getSessionUnderTest(); Connection conn = s.connection(); assertTrue( ( ( SessionImpl ) s ).getJDBCContext().getConnectionManager().hasBorrowedConnection() ); conn.close(); assertFalse( ( ( SessionImpl ) s ).getJDBCContext().getConnectionManager().hasBorrowedConnection() ); release( s ); done();
for ( Iterator iter = beings.iterator(); iter.hasNext(); ) { Being b = (Being) iter.next(); assertFalse( Hibernate.isInitialized( b.getLocation() ) ); assertNotNull( b.getLocation().getName() ); assertNotNull( b.getIdentity() ); assertNotNull( b.getSpecies() ); }
Clone fragments detected by clone detection tool
File path: /hibernate-distribution-3.3.2.GA/project/testsuite/src/test/java/org/hibernate/test/connections/AggressiveReleaseTest.java File path: /hibernate-distribution-3.3.2.GA/project/testsuite/src/test/java/org/hibernate/test/unionsubclass/UnionSubclassTest.java
Method name: void testBorrowedConnections() Method name: void testUnionSubclass()
Number of AST nodes: 8 Number of AST nodes: 6
1
prepare();
2
		Session s = getSessionUnderTest();
3
		Connection conn = s.connection
1
for ( Iterator iter = beings.iterator(); iter.hasNext(); ) {
4
();
2
			Being b = (Being) iter.next();
5
		assertTrue( ( ( SessionImpl ) s ).getJDBCContext().getConnectionManager().hasBorrowedConnection() );
3
			assert
6
		conn.close();
4
False( Hibernate.isInitialized( b.getLocation() ) );
7
		assertFalse( ( ( SessionImpl ) s ).getJDBCContext().getConnectionManager().hasBorrowedConnection
5
			assertNotNull( b.getLocation().getName() );
8
() );
6
			assertNotNull( b.getIdentity() );
9
		release( s );
7
		
10
		done();
8
	assertNotNull( b.getSpecies() );
9
		}
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 comparisons40
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements3
    Number of unmapped statements in the first code fragment5
    Number of unmapped statements in the second code fragment2
    Time elapsed for statement mapping (ms)0.0
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
    1
    prepare();
    1
    prepare();
    41
    assertNotNull(b.getLocation().getName());
    Differences
    Expression1Expression2Difference
    prepareassertNotNullMETHOD_INVOCATION_NAME_MISMATCH
    prepare()assertNotNull(b.getLocation().getName())TYPE_COMPATIBLE_REPLACEMENT
    prepare()assertNotNull(b.getLocation().getName())ARGUMENT_NUMBER_MISMATCH
    Preondition Violations
    Expression assertNotNull(b.getLocation().getName()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression prepare() is a void method call, and thus it cannot be parameterized
    Expression assertNotNull(b.getLocation().getName()) is a void method call, and thus it cannot be parameterized
    Expression assertNotNull(b.getLocation().getName()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression prepare() is a void method call, and thus it cannot be parameterized
    Expression assertNotNull(b.getLocation().getName()) is a void method call, and thus it cannot be parameterized
    41
    assertNotNull(b.getLocation().getName());
    2
    Session s = getSessionUnderTest();
                                                                          
    3
    Connection conn = s.connection();
                                                                        
    4
    assertTrue(((SessionImpl)s).getJDBCContext().getConnectionManager().hasBorrowedConnection());
                                                                                                                                                                                                    
    5
    conn.close();
                                    
                                                                  
    39
    Being b = (Being)iter.next();
    Preondition Violations
    Unmatched statement Being b=(Being)iter.next(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    39
    Being b = (Being)iter.next();
    6
    assertFalse(((SessionImpl)s).getJDBCContext().getConnectionManager().hasBorrowedConnection());
    6
    assertFalse(((SessionImpl)s).getJDBCContext().getConnectionManager().hasBorrowedConnection());
    40
    assertFalse(Hibernate.isInitialized(b.getLocation()));
    Differences
    Expression1Expression2Difference
    ((SessionImpl)s).getJDBCContext().getConnectionManager().hasBorrowedConnection()Hibernate.isInitialized(b.getLocation())TYPE_COMPATIBLE_REPLACEMENT
    Preondition Violations
    Expression ((SessionImpl)s).getJDBCContext().getConnectionManager().hasBorrowedConnection() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression Hibernate.isInitialized(b.getLocation()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    40
    assertFalse(Hibernate.isInitialized(b.getLocation()));
    7
    release(s);
                                
    8
    done();
    8
    done();
    42
    assertNotNull(b.getIdentity());
    Differences
    Expression1Expression2Difference
    doneassertNotNullMETHOD_INVOCATION_NAME_MISMATCH
    done()assertNotNull(b.getIdentity())TYPE_COMPATIBLE_REPLACEMENT
    done()assertNotNull(b.getIdentity())ARGUMENT_NUMBER_MISMATCH
    Preondition Violations
    Expression assertNotNull(b.getIdentity()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression done() is a void method call, and thus it cannot be parameterized
    Expression assertNotNull(b.getIdentity()) is a void method call, and thus it cannot be parameterized
    Expression assertNotNull(b.getIdentity()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression done() is a void method call, and thus it cannot be parameterized
    Expression assertNotNull(b.getIdentity()) is a void method call, and thus it cannot be parameterized
    42
    assertNotNull(b.getIdentity());
                                                                        
    43
    assertNotNull(b.getSpecies());
    Precondition Violations (15)
    Row Violation
    1Expression assertNotNull(b.getLocation().getName()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression prepare() is a void method call, and thus it cannot be parameterized
    3Expression assertNotNull(b.getLocation().getName()) is a void method call, and thus it cannot be parameterized
    4Expression assertNotNull(b.getLocation().getName()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    5Expression prepare() is a void method call, and thus it cannot be parameterized
    6Expression assertNotNull(b.getLocation().getName()) is a void method call, and thus it cannot be parameterized
    7Unmatched statement Being b=(Being)iter.next(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    8Expression ((SessionImpl)s).getJDBCContext().getConnectionManager().hasBorrowedConnection() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    9Expression Hibernate.isInitialized(b.getLocation()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    10Expression assertNotNull(b.getIdentity()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    11Expression done() is a void method call, and thus it cannot be parameterized
    12Expression assertNotNull(b.getIdentity()) is a void method call, and thus it cannot be parameterized
    13Expression assertNotNull(b.getIdentity()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    14Expression done() is a void method call, and thus it cannot be parameterized
    15Expression assertNotNull(b.getIdentity()) is a void method call, and thus it cannot be parameterized