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();
|
See real code fragment |
|
See real code fragment |
Summary
Number of common nesting structure subtrees | 1 |
Number of refactorable cases | 1 |
Number of non-refactorable cases | 0 |
Time elapsed for finding largest common nesting structure subtrees (ms) | 0.3 |
Clones location | Clones are in different classes having the same super class |
Number of node comparisons | 27 |
-
{Refactorable}
Mapping Summary
Number of mapped statements | 6 |
Number of unmapped statements in the first code fragment | 1 |
Number of unmapped statements in the second code fragment | 1 |
Time elapsed for statement mapping (ms) | 1.3 |
Clone type | Type 2 |
Mapped Statements
ID |
Statement |
|
ID |
Statement |
7 | ResultSet rs = qps.executeQuery(); | | 6 | ResultSet selectRS = selectPS.executeQuery(); |
8 | if (!rs.next()) | | 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 | | | 9 | |
11 | throw new IdentifierGenerationException(err); | | 10 | throw new IdentifierGenerationException(err); |
13 | rs.close(); | | 12 | selectRS.close(); |
Precondition Violations (0)
Row |
Violation |