File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/event/def/DefaultSaveOrUpdateEventListener.java | File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/impl/SessionFactoryImpl.java | |||
Method name: Serializable entityIsPersistent(SaveOrUpdateEvent)
|
Method name: void evictCollection(String, Serializable)
|
|||
Number of AST nodes: 4 | Number of AST nodes: 4 | |||
1 | final boolean isEqual = !entityEntry.getPersister().getIdentifierType()↵ | |||
2 | .isEqual( requestedId, entityEntry.getId(), event.getSession().getEntityMode(), factory );↵ | |||
3 | if ( isEqual ) {↵ | |||
4 | throw new PersistentObjectException(↵ | |||
5 | "object passed to save() was already persistent: " +↵ | |||
6 | ↵ | 1 | if ( log.isDebugEnabled() ) {↵ | |
7 | MessageHelper.infoString( entityEntry.getPersister(), requestedId, factory )↵ | 2 | log.debug( "evicting second-level cache: " + MessageHelper.↵ | |
8 | );↵ | |||
9 | }↵ | |||
10 | savedId = requestedId↵ | 3 | collectionInfoString(p, id, this) );↵ | |
4 | }↵ | |||
5 | CacheKey cacheKey = new CacheKey( id, p.getKeyType(), p.getRole(), EntityMode.POJO, this );↵ | |||
11 | ; | 6 | p.getCacheAccessStrategy().evict( cacheKey ); | |
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.1 |
Clones location | Clones are in different classes |
Number of node comparisons | 8 |
Number of mapped statements | 1 |
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) | 4.0 |
Clone type | Type 2 |
ID | Statement | ID | Statement | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
12 | final boolean isEqual = !entityEntry.getPersister().getIdentifierType().isEqual(requestedId, entityEntry.getId(), event.getSession().getEntityMode(), factory); | | |||||||||||||
13 | if (isEqual) |
| 3 | if (log.isDebugEnabled()) | |||||||||||
|
| 4 | log.debug("evicting second-level cache: " + MessageHelper.collectionInfoString(p, id, this)); | ||||||||||||
14 | throw new PersistentObjectException("object passed to save() was already persistent: " + MessageHelper.infoString(entityEntry.getPersister(), requestedId, factory)); |
| | ||||||||||||
|
| 5 | CacheKey cacheKey = new CacheKey(id, p.getKeyType(), p.getRole(), EntityMode.POJO, this); | ||||||||||||
| 6 | p.getCacheAccessStrategy().evict(cacheKey); | |||||||||||||
15 | savedId = requestedId; | |
Row | Violation |
---|---|
1 | Expression isEqual cannot be parameterized, because it has dependencies to/from statements that will be extracted |
2 | Unmatched statement log.debug("evicting second-level cache: " + MessageHelper.collectionInfoString(p,id,this)); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted |
3 | Unmatched statement throw new PersistentObjectException("object passed to save() was already persistent: " + MessageHelper.infoString(entityEntry.getPersister(),requestedId,factory)); 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 |
4 | Unmatched throw new PersistentObjectException("object passed to save() was already persistent: " + MessageHelper.infoString(entityEntry.getPersister(),requestedId,factory)); |
5 | Unmatched statement CacheKey cacheKey=new CacheKey(id,p.getKeyType(),p.getRole(),EntityMode.POJO,this); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted |
6 | The refactoring of the clones is infeasible, because the number of macthed statements is equal to zero |