File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/persister/PersisterFactory.java | File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/persister/PersisterFactory.java | |||
Method name: EntityPersister create(Class, PersistentClass, EntityRegionAccessStrategy, SessionFactoryImplementor, Mapping)
|
Method name: CollectionPersister create(Class, Configuration, Collection, CollectionRegionAccessStrategy, SessionFactoryImplementor)
|
|||
Number of AST nodes: 5 | Number of AST nodes: 5 | |||
1 | Constructor pc;↵ | 1 | Constructor pc;↵ | |
2 | try {↵ | 2 | try {↵ | |
3 | pc = persisterClass.getConstructor( PERSISTER_CONSTRUCTOR_ARGS );↵ | 3 | pc = persisterClass.getConstructor( COLLECTION_PERSISTER_CONSTRUCTOR_ARGS );↵ | |
4 | }↵ | 4 | }↵ | |
5 | catch ( Exception e ) {↵ | 5 | catch (Exception e) {↵ | |
6 | throw new MappingException( "Could not get constructor for " + persisterClass.getName(), e );↵ | 6 | throw new MappingException( "Could not get constructor for " + persisterClass.getName(), e );↵ | |
7 | }↵ | 7 | }↵ | |
8 | try {↵ | 8 | try {↵ | |
9 | return (EntityPersister) pc.newInstance( new Object[] { model, cacheAccessStrategy, factory, cfg } );↵ | 9 | return (CollectionPersister) pc.newInstance( new Object[] { model, cacheAccessStrategy, cfg, factory } );↵ | |
10 | }↵ | 10 | }↵ | |
11 | catch (InvocationTargetException ite) {↵ | 11 | catch (InvocationTargetException ite) {↵ | |
12 | Throwable e = ite.getTargetException();↵ | 12 | Throwable e = ite.getTargetException();↵ | |
13 | if (e instanceof HibernateException) {↵ | 13 | if (e instanceof HibernateException) {↵ | |
14 | throw (HibernateException) e;↵ | 14 | throw (HibernateException) e;↵ | |
15 | }↵ | 15 | }↵ | |
16 | else {↵ | 16 | else {↵ | |
17 | throw new MappingException( "Could not instantiate persister " + persisterClass.getName(), e );↵ | 17 | throw new MappingException( "Could not instantiate collection persister " + persisterClass.getName(), e );↵ | |
18 | }↵ | 18 | }↵ | |
19 | }↵ | 19 | }↵ | |
20 | catch (Exception e) {↵ | 20 | catch (Exception e) {↵ | |
21 | throw new MappingException( "Could not instantiate persister " + persisterClass.getName(), e );↵ | 21 | throw new MappingException( "Could not instantiate collection persister " + persisterClass.getName(), e );↵ | |
22 | } | 22 |
| |
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) | 1.0 |
Clones location | Clones are declared in the same class |
Number of node comparisons | 11 |
Number of mapped statements | 4 |
Number of unmapped statements in the first code fragment | 1 |
Number of unmapped statements in the second code fragment | 1 |
Time elapsed for statement mapping (ms) | 2.0 |
Clone type | Type 2 |
ID | Statement | ID | Statement | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | Constructor pc; | 1 | Constructor pc; | ||||||||||||||
2 | try | 2 | try | ||||||||||||||
3 | pc = persisterClass.getConstructor(PERSISTER_CONSTRUCTOR_ARGS); |
| 3 | pc = persisterClass.getConstructor(COLLECTION_PERSISTER_CONSTRUCTOR_ARGS); | |||||||||||||
4 | try |
| 4 | try | |||||||||||||
|
| 5 | return (CollectionPersister)pc.newInstance(new Object[] {model, cacheAccessStrategy, cfg, factory}); | ||||||||||||||
5 | return (EntityPersister)pc.newInstance(new Object[] {model, cacheAccessStrategy, factory, cfg}); |
| |
Row | Violation |
---|---|
1 | Unmatched statement return (CollectionPersister)pc.newInstance(new Object[]{model,cacheAccessStrategy,cfg,factory}); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
2 | Unmatched statement return (CollectionPersister)pc.newInstance(new Object[]{model,cacheAccessStrategy,cfg,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 |
3 | Unmatched return (CollectionPersister)pc.newInstance(new Object[]{model,cacheAccessStrategy,cfg,factory}); |
4 | Unmatched statement return (EntityPersister)pc.newInstance(new Object[]{model,cacheAccessStrategy,factory,cfg}); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
5 | Unmatched statement return (EntityPersister)pc.newInstance(new Object[]{model,cacheAccessStrategy,factory,cfg}); 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 |
6 | Unmatched return (EntityPersister)pc.newInstance(new Object[]{model,cacheAccessStrategy,factory,cfg}); |