Integer cached = ( Integer ) columnNameToIndexCache.get( columnName );
if ( cached != null ) {
return cached.intValue();
}
else {
int index = rs.getTarget().findColumn( columnName );
columnNameToIndexCache.put( columnName, new Integer(index) );
return index;
}
if ( FieldInterceptionHelper.isInstrumented( entity ) ) {
FieldInterceptor interceptor = FieldInterceptionHelper.extractFieldInterceptor( entity );
if ( interceptor != null ) {
interceptor.setSession( session );
}
else {
FieldInterceptor fieldInterceptor = FieldInterceptionHelper.injectFieldInterceptor(
entity,
getEntityName(),
null,
session
);
fieldInterceptor.dirty();
}
}
Clone fragments detected by clone detection tool
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 |
Summary
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 |
-
{Non-refactorable}
Mapping Summary
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.1 |
Clone type | Type 3 |
Mapped Statements
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(); | | | |
| | | | |
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 | | | | |
| | | 4 | interceptor.setSession(session); |
Precondition Violations (3)
Row |
Violation |
1 | Type java.lang.Integer of variable cached does not match with type org.hibernate.intercept.FieldInterceptor of variable interceptor |
2 | Unmatched return cached.intValue(); |
3 | Unmatched return index; |