IsolatedWork work = new IsolatedWork() { public void doWork(Connection connection) throws HibernateException { Statement stmnt = null; try { stmnt = connection.createStatement(); stmnt.executeUpdate( "drop table " + persister.getTemporaryIdTableName() ); } catch( Throwable t ) { log.warn( "unable to drop temporary id table after use [" + t.getMessage() + "]" ); } finally { if ( stmnt != null ) { try { stmnt.close(); } catch( Throwable ignore ) { // ignore } } } } }; if ( shouldIsolateTemporaryTableDDL() ) { if ( getFactory().getSettings().isDataDefinitionInTransactionSupported() ) { Isolater.doIsolatedWork( work, session ); } else { Isolater.doNonTransactedWork( work, session ); } } else { work.doWork( session.getJDBCContext().getConnectionManager().getConnection() ); session.getJDBCContext().getConnectionManager().afterStatement(); }
IsolatedWork work = new IsolatedWork() { public void doWork(Connection connection) throws HibernateException { Statement stmnt = null; try { stmnt = connection.createStatement(); stmnt.executeUpdate( persister.getTemporaryIdTableDDL() ); } catch( Throwable t ) { log.debug( "unable to create temporary id table [" + t.getMessage() + "]" ); } finally { if ( stmnt != null ) { try { stmnt.close(); } catch( Throwable ignore ) { // ignore } } } } }; if ( shouldIsolateTemporaryTableDDL() ) { if ( getFactory().getSettings().isDataDefinitionInTransactionSupported() ) { Isolater.doIsolatedWork( work, session ); } else { Isolater.doNonTransactedWork( work, session ); } } else { work.doWork( session.getJDBCContext().getConnectionManager().getConnection() ); session.getJDBCContext().getConnectionManager().afterStatement(); }
Clone fragments detected by clone detection tool
File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/hql/ast/exec/AbstractStatementExecutor.java File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/hql/ast/exec/AbstractStatementExecutor.java
Method name: void dropTemporaryTableIfNecessary(Queryable, SessionImplementor) Method name: void createTemporaryTableIfNecessary(Queryable, SessionImplementor)
Number of AST nodes: 7 Number of AST nodes: 7
1
IsolatedWork work = new IsolatedWork() {
1
IsolatedWork work = new IsolatedWork() {
2
				public void doWork(Connection connection) throws HibernateException {
2
			public void doWork(Connection connection) throws HibernateException {
3
					Statement stmnt = null;
3
				Statement stmnt = null;
4
					try {
4
				try {
5
						stmnt = connection.createStatement();
5
					stmnt = connection.createStatement();
6
						stmnt.executeUpdate( "drop table " + persister.getTemporaryIdTableName() );
6
					stmnt.executeUpdate( persister.getTemporaryIdTableDDL() );
7
					}
7
				}
8
					catch( Throwable t ) {
8
				catch( Throwable t ) {
9
						log.warn( "unable to drop temporary id table after use [" + t.getMessage() + "]" );
9
					log.debug( "unable to create temporary id table [" + t.getMessage() + "]" );
10
					}
10
				}
11
					finally {
11
				finally {
12
						if ( stmnt != null ) {
12
					if ( stmnt != null ) {
13
							try {
13
						try {
14
								stmnt.close();
14
							stmnt.close();
15
							}
15
						}
16
							catch( Throwable ignore ) {
16
						catch( Throwable ignore ) {
17
								// ignore
17
							// ignore
18
							}
18
						}
19
						}
19
					}
20
					}
20
				}
21
				}
21
			}
22
			};
22
		};
23
			if ( shouldIsolateTemporaryTableDDL() ) {
23
		if ( shouldIsolateTemporaryTableDDL() ) {
24
				if ( getFactory().getSettings().isDataDefinitionInTransactionSupported() ) {
24
			if ( getFactory().getSettings().isDataDefinitionInTransactionSupported() ) {
25
					Isolater.doIsolatedWork( work, session );
25
				Isolater.doIsolatedWork( work, session );
26
				}
26
			}
27
				else {
27
			else {
28
					Isolater.doNonTransactedWork( work, session );
28
				Isolater.doNonTransactedWork( work, session );
29
				}
29
			}
30
			}
30
		}
31
			else {
31
		else {
32
				work.doWork( session.getJDBCContext().getConnectionManager().getConnection() );
32
			work.doWork( session.getJDBCContext().getConnectionManager().getConnection() );
33
				session.getJDBCContext().getConnectionManager().afterStatement();
33
			session.getJDBCContext().getConnectionManager().afterStatement();
34
			}
34
		}
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.3
Clones locationClones are declared in the same class
Number of node comparisons19
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements7
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)4.7
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    2
    IsolatedWork work = new IsolatedWork() {...};
    2
    IsolatedWork work = new IsolatedWork() {...};
    1
    IsolatedWork work = new IsolatedWork() {...};
    Differences
    Expression1Expression2Difference
    "drop table " + persister.getTemporaryIdTableName()persister.getTemporaryIdTableDDL()TYPE_COMPATIBLE_REPLACEMENT
    warndebugMETHOD_INVOCATION_NAME_MISMATCH
    "unable to drop temporary id table after use [""unable to create temporary id table ["LITERAL_VALUE_MISMATCH
    Preondition Violations
    Expression log.warn("unable to drop temporary id table after use [" + t.getMessage() + "]") cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression log.debug("unable to create temporary id table [" + t.getMessage() + "]") cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression log.warn("unable to drop temporary id table after use [" + t.getMessage() + "]") is a void method call, and thus it cannot be parameterized
    Expression log.debug("unable to create temporary id table [" + t.getMessage() + "]") is a void method call, and thus it cannot be parameterized
    1
    IsolatedWork work = new IsolatedWork() {...};
    3
    if (shouldIsolateTemporaryTableDDL())
    2
    if (shouldIsolateTemporaryTableDDL())
    4
    if (getFactory().getSettings().isDataDefinitionInTransactionSupported())
    3
    if (getFactory().getSettings().isDataDefinitionInTransactionSupported())
    5
    Isolater.doIsolatedWork(work, session);
    4
    Isolater.doIsolatedWork(work, session);
    else
    else
    6
    Isolater.doNonTransactedWork(work, session);
    5
    Isolater.doNonTransactedWork(work, session);
    else
    else
    7
    work.doWork(session.getJDBCContext().getConnectionManager().getConnection());
    6
    work.doWork(session.getJDBCContext().getConnectionManager().getConnection());
    8
    session.getJDBCContext().getConnectionManager().afterStatement();
    7
    session.getJDBCContext().getConnectionManager().afterStatement();
    Precondition Violations (4)
    Row Violation
    1Expression log.warn("unable to drop temporary id table after use [" + t.getMessage() + "]") cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression log.debug("unable to create temporary id table [" + t.getMessage() + "]") cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Expression log.warn("unable to drop temporary id table after use [" + t.getMessage() + "]") is a void method call, and thus it cannot be parameterized
    4Expression log.debug("unable to create temporary id table [" + t.getMessage() + "]") is a void method call, and thus it cannot be parameterized