ResultSet rs = qps.executeQuery(); if ( !rs.next() ) { String err = "could not read a hi value - you need to populate the table: " + tableName; log.error(err); throw new IdentifierGenerationException(err); } result = rs.getInt(1); rs.close();
ResultSet selectRS = selectPS.executeQuery(); if ( !selectRS.next() ) { String err = "could not read a hi value - you need to populate the table: " + tableName; log.error( err ); throw new IdentifierGenerationException( err ); } result = selectRS.getLong( 1 ); selectRS.close();
Clone fragments detected by clone detection tool
File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/id/TableGenerator.java File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/id/enhanced/TableStructure.java
Method name: Serializable doWorkInCurrentTransaction(Connection, String) Method name: Serializable doWorkInCurrentTransaction(Connection, String)
Number of AST nodes: 7 Number of AST nodes: 7
1
ResultSet rs = qps.executeQuery();
1
ResultSet selectRS = selectPS.executeQuery();
2
				if ( !rs.next() ) {
2
				if ( !selectRS.next() ) {
3
					String err = "could not read a hi value - you need to populate the table: " + tableName;
3
					String err = "could not read a hi value - you need to populate the table: " + tableName;
4
					log.error(err);
4
					log.error( err );
5
					throw new IdentifierGenerationException(err);
5
					throw new IdentifierGenerationException( err );
6
				}
6
				}
7
				result = rs.getInt(1);
7
				result = selectRS.getLong( 1 );
8
				rs.close();
8
				selectRS.close();
Summary
Number of common nesting structure subtrees1
Number of refactorable cases1
Number of non-refactorable cases0
Time elapsed for finding largest common nesting structure subtrees (ms)0.3
Clones locationClones are in different classes having the same super class
Number of node comparisons27
  1. {Refactorable}
    Mapping Summary
    Number of mapped statements6
    Number of unmapped statements in the first code fragment1
    Number of unmapped statements in the second code fragment1
    Time elapsed for statement mapping (ms)1.3
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    7
    ResultSet rs = qps.executeQuery();
    7
    ResultSet rs = qps.executeQuery();
    6
    ResultSet selectRS = selectPS.executeQuery();
    Differences
    Expression1Expression2Difference
    rsselectRSVARIABLE_NAME_MISMATCH
    qpsselectPSVARIABLE_NAME_MISMATCH
    6
    ResultSet selectRS = selectPS.executeQuery();
    8
    if (!rs.next())
    8
    if (!rs.next())
    7
    if (!selectRS.next())
    Differences
    Expression1Expression2Difference
    rsselectRSVARIABLE_NAME_MISMATCH
    7
    if (!selectRS.next())
    9
    String err = "could not read a hi value - you need to populate the table: " + tableName;
    8
    String err = "could not read a hi value - you need to populate the table: " + tableName;
    10
    log.error(err);
    9
    log.error(err);
    11
    throw new IdentifierGenerationException(err);
    10
    throw new IdentifierGenerationException(err);
    13
    rs.close();
    13
    rs.close();
    12
    selectRS.close();
    Differences
    Expression1Expression2Difference
    rsselectRSVARIABLE_NAME_MISMATCH
    12
    selectRS.close();
    Precondition Violations (0)
    Row Violation