File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/tool/hbm2ddl/TableMetadata.java | File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/tool/hbm2ddl/TableMetadata.java | |||
Method name: void initColumns(DatabaseMetaData)
|
Method name: void initForeignKeys(DatabaseMetaData)
|
|||
Number of AST nodes: 5 | Number of AST nodes: 5 | |||
1 | ResultSet rs = null;↵ | 1 | ResultSet rs = null;↵ | |
2 | ↵ | |||
3 | try {↵ | 2 | try {↵ | |
4 | rs = meta.getColumns(catalog, schema, name, "%");↵ | 3 | rs = meta.getImportedKeys(catalog, schema, name);↵ | |
5 | while ( rs.next() ) addColumn(rs);↵ | 4 | while ( rs.next() ) addForeignKey(rs);↵ | |
6 | }↵ | 5 | }↵ | |
7 | finally {↵ | 6 | finally {↵ | |
8 | if (rs != null) rs.close();↵ | 7 | if (rs != null) rs.close();↵ | |
9 | } | 8 |
| |
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.2 |
Clones location | Clones are declared in the same class |
Number of node comparisons | 9 |
Number of mapped statements | 5 |
Number of unmapped statements in the first code fragment | 0 |
Number of unmapped statements in the second code fragment | 0 |
Time elapsed for statement mapping (ms) | 1.0 |
Clone type | Type 2 |
ID | Statement | ID | Statement | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | ResultSet rs = null; | 1 | ResultSet rs = null; | ||||||||||||||||||
2 | try | 2 | try | ||||||||||||||||||
3 | rs = meta.getColumns(catalog, schema, name, "%"); |
| 3 | rs = meta.getImportedKeys(catalog, schema, name); | |||||||||||||||||
4 | while (rs.next()) | 4 | while (rs.next()) | ||||||||||||||||||
5 | addColumn(rs); |
| 5 | addForeignKey(rs); |
Row | Violation |
---|---|
1 | Expression meta.getColumns(catalog,schema,name,"%") is a method call throwing exception(s) that should be caught by a try block that will be extracted |
2 | Expression meta.getImportedKeys(catalog,schema,name) is a method call throwing exception(s) that should be caught by a try block that will be extracted |
3 | Expression meta.getColumns(catalog,schema,name,"%") is a method call throwing exception(s) that should be caught by a try block that will be extracted |
4 | Expression meta.getImportedKeys(catalog,schema,name) is a method call throwing exception(s) that should be caught by a try block that will be extracted |
5 | Expression addColumn(rs) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
6 | Expression addForeignKey(rs) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
7 | Expression addColumn(rs) is a void method call, and thus it cannot be parameterized |
8 | Expression addForeignKey(rs) is a void method call, and thus it cannot be parameterized |