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();
    40
    assertFalse(Hibernate.isInitialized(b.getLocation()));
    Differences
    Expression1Expression2Difference
    prepareassertFalseMETHOD_INVOCATION_NAME_MISMATCH
    prepare()assertFalse(Hibernate.isInitialized(b.getLocation()))ARGUMENT_NUMBER_MISMATCH
    Preondition Violations
    Expression prepare() is a void method call, and thus it cannot be parameterized
    Expression assertFalse(Hibernate.isInitialized(b.getLocation())) is a void method call, and thus it cannot be parameterized
    Expression prepare() is a void method call, and thus it cannot be parameterized
    Expression assertFalse(Hibernate.isInitialized(b.getLocation())) is a void method call, and thus it cannot be parameterized
    40
    assertFalse(Hibernate.isInitialized(b.getLocation()));
    2
    Session s = getSessionUnderTest();
                                                                          
    3
    Connection conn = s.connection();
                                                                        
    4
    assertTrue(((SessionImpl)s).getJDBCContext().getConnectionManager().hasBorrowedConnection());
                                                                                                                                                                                                    
                                                                  
    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();
    5
    conn.close();
    5
    conn.close();
    42
    assertNotNull(b.getIdentity());
    Differences
    Expression1Expression2Difference
    closeassertNotNullMETHOD_INVOCATION_NAME_MISMATCH
    conn.close()assertNotNull(b.getIdentity())ARGUMENT_NUMBER_MISMATCH
    connMISSING_METHOD_INVOCATION_EXPRESSION
    Preondition Violations
    Expression conn.close() 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 conn.close() 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());
    6
    assertFalse(((SessionImpl)s).getJDBCContext().getConnectionManager().hasBorrowedConnection());
                                                                                                                                                                                                      
    7
    release(s);
                                
    8
    done();
    8
    done();
    41
    assertNotNull(b.getLocation().getName());
    Differences
    Expression1Expression2Difference
    doneassertNotNullMETHOD_INVOCATION_NAME_MISMATCH
    done()assertNotNull(b.getLocation().getName())ARGUMENT_NUMBER_MISMATCH
    Preondition Violations
    Expression done() 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 done() 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());
                                                                        
    43
    assertNotNull(b.getSpecies());
    Precondition Violations (13)
    Row Violation
    1Expression prepare() is a void method call, and thus it cannot be parameterized
    2Expression assertFalse(Hibernate.isInitialized(b.getLocation())) is a void method call, and thus it cannot be parameterized
    3Expression prepare() is a void method call, and thus it cannot be parameterized
    4Expression assertFalse(Hibernate.isInitialized(b.getLocation())) is a void method call, and thus it cannot be parameterized
    5Unmatched 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
    6Expression conn.close() is a void method call, and thus it cannot be parameterized
    7Expression assertNotNull(b.getIdentity()) is a void method call, and thus it cannot be parameterized
    8Expression conn.close() is a void method call, and thus it cannot be parameterized
    9Expression assertNotNull(b.getIdentity()) is a void method call, and thus it cannot be parameterized
    10Expression done() is a void method call, and thus it cannot be parameterized
    11Expression assertNotNull(b.getLocation().getName()) is a void method call, and thus it cannot be parameterized
    12Expression done() is a void method call, and thus it cannot be parameterized
    13Expression assertNotNull(b.getLocation().getName()) is a void method call, and thus it cannot be parameterized