logOpenPreparedStatement(); CallableStatement ps = ( CallableStatement ) getPreparedStatement( connectionManager.getConnection(), sql, scrollable, false, null, scrollMode, true ); setStatementFetchSize( ps ); statementsToClose.add( ps ); lastQuery = ps; return ps;
logOpenPreparedStatement(); PreparedStatement ps = getPreparedStatement( connectionManager.getConnection(), sql, scrollable, scrollMode ); setStatementFetchSize( ps ); statementsToClose.add( ps ); lastQuery = ps; return ps;
Clone fragments detected by clone detection tool
File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/jdbc/AbstractBatcher.java File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/jdbc/AbstractBatcher.java
Method name: CallableStatement prepareCallableQueryStatement(String, boolean, ScrollMode) Method name: PreparedStatement prepareQueryStatement(String, boolean, ScrollMode)
Number of AST nodes: 6 Number of AST nodes: 6
1
logOpenPreparedStatement();
1
logOpenPreparedStatement();
2
		CallableStatement ps = ( CallableStatement ) getPreparedStatement(
2
		PreparedStatement ps = getPreparedStatement(
3
				connectionManager.getConnection(),
3
				connectionManager.getConnection(),
4
		        sql,
4
		        sql,
5
		        scrollable,
5
		        scrollable,
6
		        false,
6
		        
7
		        null,
8
		        scrollMode,
9
		        true
7
scrollMode
10
		);
8
		);
11
		setStatementFetchSize( ps );
9
		setStatementFetchSize( ps );
12
		statementsToClose.add( ps );
10
		statementsToClose.add( ps );
13
		lastQuery = ps;
11
		lastQuery = ps;
14
		return ps;
12
		return ps;
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 declared in the same class
Number of node comparisons36
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements3
    Number of unmapped statements in the first code fragment3
    Number of unmapped statements in the second code fragment3
    Time elapsed for statement mapping (ms)0.0
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    logOpenPreparedStatement();
    1
    logOpenPreparedStatement();
                                                                                                                                                                                                                        
    2
    PreparedStatement ps = getPreparedStatement(connectionManager.getConnection(), sql, scrollable, scrollMode);
    2
    CallableStatement ps = (CallableStatement)getPreparedStatement(connectionManager.getConnection(), sql, scrollable, false, null, scrollMode, true);
                                                                                                                                                                                                                                                                                              
    3
    setStatementFetchSize(ps);
    3
    setStatementFetchSize(ps);
    3
    setStatementFetchSize(ps);
    Differences
    Expression1Expression2Difference
    java.sql.CallableStatementjava.sql.PreparedStatementVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.sql.CallableStatement of variable ps does not match with type java.sql.PreparedStatement of variable ps
    • Make classes java.sql.CallableStatement and java.sql.PreparedStatement extend a common superclass
    3
    setStatementFetchSize(ps);
    4
    statementsToClose.add(ps);
    4
    statementsToClose.add(ps);
    4
    statementsToClose.add(ps);
    Differences
    Expression1Expression2Difference
    java.sql.CallableStatementjava.sql.PreparedStatementVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.sql.CallableStatement of variable ps does not match with type java.sql.PreparedStatement of variable ps
    • Make classes java.sql.CallableStatement and java.sql.PreparedStatement extend a common superclass
    4
    statementsToClose.add(ps);
                                    
    5
    lastQuery = ps;
    5
    lastQuery = ps;
                                    
                              
    6
    return ps;
    Preondition Violations
    Unmatched return ps;
    6
    return ps;
    6
    return ps;
    6
    return ps;
    Preondition Violations
    Unmatched return ps;
                              
    Precondition Violations (4)
    Row Violation
    1Type java.sql.CallableStatement of variable ps does not match with type java.sql.PreparedStatement of variable ps
    2Type java.sql.CallableStatement of variable ps does not match with type java.sql.PreparedStatement of variable ps
    3Unmatched return ps;
    4Unmatched return ps;