File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/bytecode/javassist/JavassistClassTransformer.java | File path: /hibernate-distribution-3.3.2.GA/project/core/src/test/java/org/hibernate/dialect/Mocks.java | |||
Method name: boolean alreadyInstrumented(ClassFile)
|
Method name: boolean canThrowSQLException(Method)
|
|||
Number of AST nodes: 5 | Number of AST nodes: 5 | |||
1 | String[] intfs = classfile.getInterfaces(); ↵ | 1 | final Class[] exceptions = method.getExceptionTypes();↵ | |
2 | for ( int i = 0; i < intfs.length; i++ ) { ↵ | 2 | for ( int i = 0; i < exceptions.length; i++ ) {↵ | |
3 | if ( FieldHandled.class.getName().equals( intfs[i] ) ) { ↵ | 3 | if ( SQLException.class.isAssignableFrom( exceptions[i] ) ) {↵ | |
4 | return true; ↵ | 4 | return true;↵ | |
5 | } ↵ | 5 | }↵ | |
6 | } ↵ | 6 | }↵ | |
7 | return false; | 7 |
| |
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.3 |
Clones location | Clones are in different classes |
Number of node comparisons | 6 |
Number of mapped statements | 2 |
Number of unmapped statements in the first code fragment | 3 |
Number of unmapped statements in the second code fragment | 3 |
Time elapsed for statement mapping (ms) | 0.9 |
Clone type | Type 3 |
ID | Statement | ID | Statement | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | final Class[] exceptions = method.getExceptionTypes(); | ||||||||||||||||
1 | String[] intfs = classfile.getInterfaces(); | | ||||||||||||||||
2 | for (int i = 0; i < intfs.length; i++) |
| 2 | for (int i = 0; i < exceptions.length; i++) | ||||||||||||||
|
| 3 | if (SQLException.class.isAssignableFrom(exceptions[i])) | |||||||||||||||
|
| 4 | return true; | |||||||||||||||
3 | if (FieldHandled.class.getName().equals(intfs[i])) |
| | |||||||||||||||
4 | return true; |
| | |||||||||||||||
5 | return false; | 5 | return false; |
Row | Violation |
---|---|
1 | Type int of variable intfs.length does not match with type int of variable exceptions.length |
2 | Unmatched statement if(SQLException.class.isAssignableFrom(exceptions[i])) cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
3 | Unmatched return true; |
4 | Unmatched statement if(FieldHandled.class.getName().equals(intfs[i])) cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
5 | Unmatched return true; |