File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/cfg/SettingsFactory.java | File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/cfg/SettingsFactory.java | |||
Method name: QueryCacheFactory createQueryCacheFactory(Properties)
|
Method name: QueryTranslatorFactory createQueryTranslatorFactory(Properties)
|
|||
Number of AST nodes: 4 | Number of AST nodes: 4 | |||
1 | String queryCacheFactoryClassName = PropertiesHelper.getString(↵ | 1 | String className = PropertiesHelper.getString(↵ | |
2 | Environment.QUERY_CACHE_FACTORY, properties, "org.hibernate.cache.StandardQueryCacheFactory"↵ | 2 | Environment.QUERY_TRANSLATOR, properties, "org.hibernate.hql.ast.ASTQueryTranslatorFactory"↵ | |
3 | );↵ | 3 | );↵ | |
4 | log.info("Query cache factory: " + queryCacheFactoryClassName);↵ | 4 | log.info("Query translator: " + className);↵ | |
5 | try {↵ | 5 | try {↵ | |
6 | return (QueryCacheFactory) ReflectHelper.classForName(queryCacheFactoryClassName).newInstance();↵ | 6 | return (QueryTranslatorFactory) ReflectHelper.classForName(className).newInstance();↵ | |
7 | }↵ | 7 | }↵ | |
8 | catch (Exception cnfe) {↵ | 8 | catch (Exception cnfe) {↵ | |
9 | throw new HibernateException("could not instantiate QueryCacheFactory: " + queryCacheFactoryClassName, cnfe);↵ | 9 | throw new HibernateException("could not instantiate QueryTranslatorFactory: " + className, cnfe);↵ | |
10 | } | 10 |
| |
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 declared in the same class |
Number of node comparisons | 8 |
Number of mapped statements | 3 |
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) | 1.6 |
Clone type | Type 2 |
ID | Statement | ID | Statement | |||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | String queryCacheFactoryClassName = PropertiesHelper.getString(Environment.QUERY_CACHE_FACTORY, properties, "org.hibernate.cache.StandardQueryCacheFactory"); |
| 1 | String className = PropertiesHelper.getString(Environment.QUERY_TRANSLATOR, properties, "org.hibernate.hql.ast.ASTQueryTranslatorFactory"); | ||||||||||||||||
2 | log.info("Query cache factory: " + queryCacheFactoryClassName); |
| 2 | log.info("Query translator: " + className); | ||||||||||||||||
3 | try |
| 3 | try | ||||||||||||||||
|
| 4 | return (QueryTranslatorFactory)ReflectHelper.classForName(className).newInstance(); | |||||||||||||||||
4 | return (QueryCacheFactory)ReflectHelper.classForName(queryCacheFactoryClassName).newInstance(); |
| |
Row | Violation |
---|---|
1 | Unmatched statement return (QueryTranslatorFactory)ReflectHelper.classForName(className).newInstance(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
2 | Unmatched statement return (QueryTranslatorFactory)ReflectHelper.classForName(className).newInstance(); 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 (QueryTranslatorFactory)ReflectHelper.classForName(className).newInstance(); |
4 | Unmatched statement return (QueryCacheFactory)ReflectHelper.classForName(queryCacheFactoryClassName).newInstance(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
5 | Unmatched statement return (QueryCacheFactory)ReflectHelper.classForName(queryCacheFactoryClassName).newInstance(); 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 (QueryCacheFactory)ReflectHelper.classForName(queryCacheFactoryClassName).newInstance(); |