IExtensionHandler handler = PluginManager .getInstance() .getExtensionHandler( IExtensionHandlerKeys.ORG_COLUMBA_CORE_CONTEXT_PROVIDER); String[] ids = handler.getPluginIdList(); for (int i = 0; i < ids.length; i++) { try { IExtension extension = handler.getExtension(ids[i]); IContextProvider provider = (IContextProvider) extension .instanciateExtension(null); contextSearchManager.register(provider); } catch (PluginException e) { LOG.severe("Error while loading plugin: " + e.getMessage()); if (Logging.DEBUG) e.printStackTrace(); } }
IExtensionHandler handler = PluginManager.getInstance() .getExtensionHandler( IExtensionHandlerKeys.ORG_COLUMBA_CORE_SEARCH); String[] ids = handler.getPluginIdList(); for (int i = 0; i < ids.length; i++) { try { IExtension extension = handler.getExtension(ids[i]); ISearchProvider provider = (ISearchProvider) extension .instanciateExtension(null); searchManager.registerProvider(provider); } catch (PluginException e) { LOG.severe("Error while loading plugin: " + e.getMessage()); if (Logging.DEBUG) e.printStackTrace(); } }
Clone fragments detected by clone detection tool
File path: /columba-1.4-src/core/src/main/java/org/columba/core/gui/search/SearchPanel.java File path: /columba-1.4-src/core/src/main/java/org/columba/core/gui/search/SearchPanel.java
Method name: void initContextProvider() Method name: void initSearchProvider()
Number of AST nodes: 7 Number of AST nodes: 7
1
IExtensionHandler handler = PluginManager
1
IExtensionHandler handler = PluginManager
2
					.getInstance()
2
.getInstance()
3
					.getExtensionHandler(
3
					.getExtensionHandler(
4
							IExtensionHandlerKeys.ORG_COLUMBA_CORE_CONTEXT_PROVIDER);
4
							IExtensionHandlerKeys.ORG_COLUMBA_CORE_SEARCH);
5
			String[] ids = handler.getPluginIdList();
5
			String[] ids = handler.getPluginIdList();
6
			for (int i = 0; i < ids.length; i++) {
6
			for (int i = 0; i < ids.length; i++) {
7
				try {
7
				try {
8
					IExtension extension = handler.getExtension(ids[i]);
8
					IExtension extension = handler.getExtension(ids[i]);
9
					IContextProvider provider = (IContextProvider) extension
9
					ISearchProvider provider = (ISearchProvider) extension
10
							.instanciateExtension(null);
10
							.instanciateExtension(null);
11
					contextSearchManager.register(provider);
11
					searchManager.registerProvider(provider);
12
				} catch (PluginException e) {
12
				} catch (PluginException e) {
13
					LOG.severe("Error while loading plugin: " + e.getMessage());
13
					LOG.severe("Error while loading plugin: " + e.getMessage());
14
					if (Logging.DEBUG)
14
					if (Logging.DEBUG)
15
						e.printStackTrace();
15
						e.printStackTrace();
16
				}
16
				}
17
			}
17
			}
Summary
Number of common nesting structure subtrees1
Number of refactorable cases1
Number of non-refactorable cases0
Time elapsed for finding largest common nesting structure subtrees (ms)1.3
Clones locationClones are declared in the same class
Number of node comparisons22
  1. {Refactorable}
    Mapping Summary
    Number of mapped statements6
    Number of unmapped statements in the first code fragment1
    Number of unmapped statements in the second code fragment1
    Time elapsed for statement mapping (ms)6.0
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    4
    IExtensionHandler handler = PluginManager.getInstance().getExtensionHandler(IExtensionHandlerKeys.ORG_COLUMBA_CORE_CONTEXT_PROVIDER);
    4
    IExtensionHandler handler = PluginManager.getInstance().getExtensionHandler(IExtensionHandlerKeys.ORG_COLUMBA_CORE_CONTEXT_PROVIDER);
    3
    IExtensionHandler handler = PluginManager.getInstance().getExtensionHandler(IExtensionHandlerKeys.ORG_COLUMBA_CORE_SEARCH);
    Differences
    Expression1Expression2Difference
    ORG_COLUMBA_CORE_CONTEXT_PROVIDERORG_COLUMBA_CORE_SEARCHVARIABLE_NAME_MISMATCH
    3
    IExtensionHandler handler = PluginManager.getInstance().getExtensionHandler(IExtensionHandlerKeys.ORG_COLUMBA_CORE_SEARCH);
    5
    String[] ids = handler.getPluginIdList();
    4
    String[] ids = handler.getPluginIdList();
    6
    for (int i = 0; i < ids.length; i++)
    5
    for (int i = 0; i < ids.length; i++)
    7
    try
    6
    try
    8
    IExtension extension = handler.getExtension(ids[i]);
    7
    IExtension extension = handler.getExtension(ids[i]);
    9
    IContextProvider provider = (IContextProvider)extension.instanciateExtension(null);
    9
    IContextProvider provider = (IContextProvider)extension.instanciateExtension(null);
    8
    ISearchProvider provider = (ISearchProvider)extension.instanciateExtension(null);
    Differences
    Expression1Expression2Difference
    org.columba.core.context.api.IContextProviderorg.columba.core.search.api.ISearchProviderSUBCLASS_TYPE_MISMATCH
    org.columba.core.context.api.IContextProviderorg.columba.core.search.api.ISearchProviderSUBCLASS_TYPE_MISMATCH
    org.columba.core.context.api.IContextProviderorg.columba.core.search.api.ISearchProviderSUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Expression (IContextProvider)extension.instanciateExtension(null) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression (ISearchProvider)extension.instanciateExtension(null) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    8
    ISearchProvider provider = (ISearchProvider)extension.instanciateExtension(null);
                                                                                            
    9
    searchManager.registerProvider(provider);
    Preondition Violations
    Unmatched statement searchManager.registerProvider(provider); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    9
    searchManager.registerProvider(provider);
    10
    contextSearchManager.register(provider);
    10
    contextSearchManager.register(provider);
    Preondition Violations
    Unmatched statement contextSearchManager.register(provider); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                            
    Precondition Violations (4)
    Row Violation
    1Expression (IContextProvider)extension.instanciateExtension(null) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression (ISearchProvider)extension.instanciateExtension(null) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Unmatched statement searchManager.registerProvider(provider); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    4Unmatched statement contextSearchManager.register(provider); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted