Constructor pc; try { pc = persisterClass.getConstructor( COLLECTION_PERSISTER_CONSTRUCTOR_ARGS ); } catch (Exception e) { throw new MappingException( "Could not get constructor for " + persisterClass.getName(), e ); } try { return (CollectionPersister) pc.newInstance( new Object[] { model, cacheAccessStrategy, cfg, factory } ); } catch (InvocationTargetException ite) { Throwable e = ite.getTargetException(); if (e instanceof HibernateException) { throw (HibernateException) e; } else { throw new MappingException( "Could not instantiate collection persister " + persisterClass.getName(), e ); } } catch (Exception e) { throw new MappingException( "Could not instantiate collection persister " + persisterClass.getName(), e ); }
Constructor pc; try { pc = persisterClass.getConstructor( PERSISTER_CONSTRUCTOR_ARGS ); } catch ( Exception e ) { throw new MappingException( "Could not get constructor for " + persisterClass.getName(), e ); } try { return (EntityPersister) pc.newInstance( new Object[] { model, cacheAccessStrategy, factory, cfg } ); } catch (InvocationTargetException ite) { Throwable e = ite.getTargetException(); if (e instanceof HibernateException) { throw (HibernateException) e; } else { throw new MappingException( "Could not instantiate persister " + persisterClass.getName(), e ); } } catch (Exception e) { throw new MappingException( "Could not instantiate persister " + persisterClass.getName(), e ); }
Clone fragments detected by clone detection tool
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: CollectionPersister create(Class, Configuration, Collection, CollectionRegionAccessStrategy, SessionFactoryImplementor) Method name: EntityPersister create(Class, PersistentClass, EntityRegionAccessStrategy, SessionFactoryImplementor, Mapping)
Number of AST nodes: 5 Number of AST nodes: 5
1
Constructor pc;
1
Constructor pc;
2
		try {
2
		try {
3
			pc = persisterClass.getConstructor( COLLECTION_PERSISTER_CONSTRUCTOR_ARGS );
3
			pc = persisterClass.getConstructor( 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 (CollectionPersister) pc.newInstance( new Object[] { model, cacheAccessStrategy, cfg, factory } );
9
			return (EntityPersister) pc.newInstance( new Object[] { model, cacheAccessStrategy, factory, cfg } );
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 collection persister " + persisterClass.getName(), e );
17
				throw new MappingException( "Could not instantiate persister " + persisterClass.getName(), e );
18
			}
18
			}
19
		}
19
		}
20
		catch (Exception e) {
20
		catch (Exception e) {
21
			throw new MappingException( "Could not instantiate collection persister " + persisterClass.getName(), e );
21
			throw new MappingException( "Could not instantiate persister " + persisterClass.getName(), e );
22
		}
22
		}
Summary
Number of common nesting structure subtrees1
Number of refactorable cases0
Number of non-refactorable cases1
Time elapsed for finding largest common nesting structure subtrees (ms)1.0
Clones locationClones are declared in the same class
Number of node comparisons14
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements4
    Number of unmapped statements in the first code fragment1
    Number of unmapped statements in the second code fragment1
    Time elapsed for statement mapping (ms)1.2
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    Constructor pc;
    1
    Constructor pc;
    2
    try
    2
    try
    3
    pc = persisterClass.getConstructor(COLLECTION_PERSISTER_CONSTRUCTOR_ARGS);
    3
    pc = persisterClass.getConstructor(COLLECTION_PERSISTER_CONSTRUCTOR_ARGS);
    3
    pc = persisterClass.getConstructor(PERSISTER_CONSTRUCTOR_ARGS);
    Differences
    Expression1Expression2Difference
    COLLECTION_PERSISTER_CONSTRUCTOR_ARGSPERSISTER_CONSTRUCTOR_ARGSVARIABLE_NAME_MISMATCH
    3
    pc = persisterClass.getConstructor(PERSISTER_CONSTRUCTOR_ARGS);
    4
    try
    4
    try
    4
    try
    Differences
    Expression1Expression2Difference
    "Could not instantiate collection persister ""Could not instantiate persister "LITERAL_VALUE_MISMATCH
    "Could not instantiate collection persister ""Could not instantiate persister "LITERAL_VALUE_MISMATCH
    4
    try
                                                                                                                                                                                                  
    5
    return (EntityPersister)pc.newInstance(new Object[] {model, cacheAccessStrategy, factory, cfg});
    Preondition Violations
    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
    5
    return (EntityPersister)pc.newInstance(new Object[] {model, cacheAccessStrategy, factory, cfg});
    5
    return (CollectionPersister)pc.newInstance(new Object[] {model, cacheAccessStrategy, cfg, factory});
    5
    return (CollectionPersister)pc.newInstance(new Object[] {model, cacheAccessStrategy, cfg, factory});
    Preondition Violations
    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
                                                                                                                                                                                                          
    Precondition Violations (2)
    Row Violation
    1Unmatched 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
    2Unmatched 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