File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/jdbc/ColumnNameCache.java | File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/persister/entity/AbstractEntityPersister.java | |||
Method name: int getIndexForColumnName(String, ResultSetWrapper)
|
Method name: void afterReassociate(Object, SessionImplementor)
|
|||
Number of AST nodes: 6 | Number of AST nodes: 6 | |||
1 | Integer cached = ( Integer ) columnNameToIndexCache.get( columnName↵ | 1 | if ( FieldInterceptionHelper.isInstrumented( entity ) ) {↵ | |
2 | );↵ | 2 | FieldInterceptor interceptor = FieldInterceptionHelper.extractFieldInterceptor( entity );↵ | |
3 | if ( cached != null ) {↵ | 3 | if ( interceptor != null ) {↵ | |
4 | return cached.intValue();↵ | 4 | interceptor.setSession( session );↵ | |
5 | }↵ | 5 | }↵ | |
6 | else {↵ | 6 | else {↵ | |
7 | int index = rs.getTarget().findColumn( columnName );↵ | 7 | ↵ | |
8 | columnNameToIndexCache.put( columnName, new Integer(index) ↵ | 8 | FieldInterceptor fieldInterceptor = FieldInterceptionHelper.injectFieldInterceptor(↵ | |
9 | entity,↵ | |||
10 | getEntityName(),↵ | |||
11 | null,↵ | |||
12 | session↵ | |||
9 | );↵ | 13 | );↵ | |
10 | return index;↵ | 14 | fieldInterceptor.dirty();↵ | |
15 | }↵ | |||
11 | } | 16 |
| |
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 in different classes |
Number of node comparisons | 21 |
Number of mapped statements | 1 |
Number of unmapped statements in the first code fragment | 5 |
Number of unmapped statements in the second code fragment | 4 |
Time elapsed for statement mapping (ms) | 1.9 |
Clone type | Type 3 |
ID | Statement | ID | Statement | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | Integer cached = (Integer)columnNameToIndexCache.get(columnName); | | ||||||||||||||||
| 2 | FieldInterceptor interceptor = FieldInterceptionHelper.extractFieldInterceptor(entity); | ||||||||||||||||
2 | if (cached != null) |
| 3 | if (interceptor != null) | ||||||||||||||
3 | return cached.intValue(); |
| | |||||||||||||||
else | | |||||||||||||||||
4 | int index = rs.getTarget().findColumn(columnName); |
| | |||||||||||||||
| 5 | FieldInterceptor fieldInterceptor = FieldInterceptionHelper.injectFieldInterceptor(entity, getEntityName(), null, session); | ||||||||||||||||
5 | columnNameToIndexCache.put(columnName, new Integer(index)); | | ||||||||||||||||
|
| 6 | fieldInterceptor.dirty(); | |||||||||||||||
6 | return index; |
| | |||||||||||||||
|
| 4 | interceptor.setSession(session); |
Row | Violation |
---|---|
1 | Type java.lang.Integer of variable cached does not match with type org.hibernate.intercept.FieldInterceptor of variable interceptor |
2 | Unmatched statement return cached.intValue(); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted |
3 | Unmatched return cached.intValue(); |
4 | Unmatched statement int index=rs.getTarget().findColumn(columnName); 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 |
5 | Unmatched statement fieldInterceptor.dirty(); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted |
6 | Unmatched return index; |
7 | Unmatched statement interceptor.setSession(session); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted |
8 | The refactoring of the clones is infeasible, because the number of macthed statements is equal to zero |