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: 8 | Number of AST nodes: 8 | |||
1 | try {↵ | 1 | try { ↵ | |
2 | ResultSet rs = qps.executeQuery();↵ | 2 | ResultSet selectRS = selectPS.executeQuery(); ↵ | |
3 | if ( !rs.next() ) {↵ | 3 | if ( !selectRS.next() ) { ↵ | |
4 | String err = "could not read a hi value - you need to populate the table: " + tableName;↵ | 4 | String err = "could not read a hi value - you need to populate the table: " + tableName; ↵ | |
5 | log.error(err);↵ | 5 | log.error( err ); ↵ | |
6 | throw new IdentifierGenerationException(err);↵ | 6 | throw new IdentifierGenerationException( err ); ↵ | |
7 | }↵ | 7 | } ↵ | |
8 | result = rs.getInt(1);↵ | 8 | result = selectRS.getLong( 1 ); ↵ | |
9 | rs.close();↵ | 9 | selectRS.close(); ↵ | |
10 | }↵ | 10 | } ↵ | |
11 | catch (SQLException sqle) {↵ | 11 | catch ( SQLException sqle ) { ↵ | |
12 | log.error("could not read a hi value", sqle);↵ | 12 | log.error( "could not read a hi value", sqle ); ↵ | |
13 | throw sqle;↵ | 13 | throw sqle; ↵ | |
14 | }↵ | 14 | } ↵ | |
15 | finally {↵ | 15 | finally { ↵ | |
16 | qps.close();↵ | 16 | selectPS.close(); ↵ | |
17 | } | 17 |
| |
See real code fragment | See real code fragment |
Number of common nesting structure subtrees | 1 |
Number of refactorable cases | 0 |
Number of non-refactorable cases | 1 |
Time elapsed for finding largest common nesting structure subtrees (ms) | 0.4 |
Clones location | Clones are in different classes having the same super class |
Number of node comparisons | 33 |
Number of mapped statements | 7 |
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) | 3.2 |
Clone type | Type 2 |
ID | Statement | ID | Statement | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
6 | try |
| 5 | try | |||||||||||||
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 | log.error(err); | 9 | log.error(err); | ||||||||||||||
11 | throw new IdentifierGenerationException(err); | 10 | throw new IdentifierGenerationException(err); | ||||||||||||||
|
| 11 | result = selectRS.getLong(1); | ||||||||||||||
12 | result = rs.getInt(1); |
| | ||||||||||||||
13 | rs.close(); |
| 12 | selectRS.close(); |
Row | Violation |
---|---|
1 | Unmatched statement result=selectRS.getLong(1); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
2 | Unmatched statement result=selectRS.getLong(1); cannot be moved before or after the extracted code, because it throws exception(s) that should be caught by a try block that will be extracted |
3 | Unmatched statement result=rs.getInt(1); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
4 | Unmatched statement result=rs.getInt(1); cannot be moved before or after the extracted code, because it throws exception(s) that should be caught by a try block that will be extracted |