try { 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(); } } } catch (PluginHandlerNotFoundException e) { LOG.severe("Error while loading plugin: " + e.getMessage()); if (Logging.DEBUG) e.printStackTrace(); }
try { 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(); } } } catch (PluginHandlerNotFoundException 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 initSearchProvider() Method name: void initContextProvider()
Number of AST nodes: 8 Number of AST nodes: 8
1
try {
1
try {
2
			IExtensionHandler handler = PluginManager
2
			IExtensionHandler handler = PluginManager
3
.getInstance()
3
					.getInstance()
4
					.getExtensionHandler(
4
					.getExtensionHandler(
5
							IExtensionHandlerKeys.ORG_COLUMBA_CORE_SEARCH);
5
							IExtensionHandlerKeys.ORG_COLUMBA_CORE_CONTEXT_PROVIDER);
6
			String[] ids = handler.getPluginIdList();
6
			String[] ids = handler.getPluginIdList();
7
			for (int i = 0; i < ids.length; i++) {
7
			for (int i = 0; i < ids.length; i++) {
8
				try {
8
				try {
9
					IExtension extension = handler.getExtension(ids[i]);
9
					IExtension extension = handler.getExtension(ids[i]);
10
					ISearchProvider provider = (ISearchProvider) extension
10
					IContextProvider provider = (IContextProvider) extension
11
							.instanciateExtension(null);
11
							.instanciateExtension(null);
12
					searchManager.registerProvider(provider);
12
					contextSearchManager.register(provider);
13
				} catch (PluginException e) {
13
				} catch (PluginException e) {
14
					LOG.severe("Error while loading plugin: " + e.getMessage());
14
					LOG.severe("Error while loading plugin: " + e.getMessage());
15
					if (Logging.DEBUG)
15
					if (Logging.DEBUG)
16
						e.printStackTrace();
16
						e.printStackTrace();
17
				}
17
				}
18
			}
18
			}
19
		} catch (PluginHandlerNotFoundException e) {
19
		} catch (PluginHandlerNotFoundException e) {
20
			LOG.severe("Error while loading plugin: " + e.getMessage());
20
			LOG.severe("Error while loading plugin: " + e.getMessage());
21
			if (Logging.DEBUG)
21
			if (Logging.DEBUG)
22
				e.printStackTrace();
22
				e.printStackTrace();
23
		}
23
		}
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)0.8
Clones locationClones are declared in the same class
Number of node comparisons26
  1. {Refactorable}
    Mapping Summary
    Number of mapped statements7
    Number of unmapped statements in the first code fragment1
    Number of unmapped statements in the second code fragment1
    Time elapsed for statement mapping (ms)5.7
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    2
    try
    3
    try
    3
    IExtensionHandler handler = PluginManager.getInstance().getExtensionHandler(IExtensionHandlerKeys.ORG_COLUMBA_CORE_SEARCH);
    3
    IExtensionHandler handler = PluginManager.getInstance().getExtensionHandler(IExtensionHandlerKeys.ORG_COLUMBA_CORE_SEARCH);
    4
    IExtensionHandler handler = PluginManager.getInstance().getExtensionHandler(IExtensionHandlerKeys.ORG_COLUMBA_CORE_CONTEXT_PROVIDER);
    Differences
    Expression1Expression2Difference
    ORG_COLUMBA_CORE_SEARCHORG_COLUMBA_CORE_CONTEXT_PROVIDERVARIABLE_NAME_MISMATCH
    4
    IExtensionHandler handler = PluginManager.getInstance().getExtensionHandler(IExtensionHandlerKeys.ORG_COLUMBA_CORE_CONTEXT_PROVIDER);
    4
    String[] ids = handler.getPluginIdList();
    5
    String[] ids = handler.getPluginIdList();
    5
    for (int i = 0; i < ids.length; i++)
    6
    for (int i = 0; i < ids.length; i++)
    6
    try
    7
    try
    7
    IExtension extension = handler.getExtension(ids[i]);
    8
    IExtension extension = handler.getExtension(ids[i]);
    8
    ISearchProvider provider = (ISearchProvider)extension.instanciateExtension(null);
    8
    ISearchProvider provider = (ISearchProvider)extension.instanciateExtension(null);
    9
    IContextProvider provider = (IContextProvider)extension.instanciateExtension(null);
    Differences
    Expression1Expression2Difference
    org.columba.core.search.api.ISearchProviderorg.columba.core.context.api.IContextProviderSUBCLASS_TYPE_MISMATCH
    org.columba.core.search.api.ISearchProviderorg.columba.core.context.api.IContextProviderSUBCLASS_TYPE_MISMATCH
    org.columba.core.search.api.ISearchProviderorg.columba.core.context.api.IContextProviderSUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Expression (ISearchProvider)extension.instanciateExtension(null) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression (IContextProvider)extension.instanciateExtension(null) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    9
    IContextProvider provider = (IContextProvider)extension.instanciateExtension(null);
    9
    searchManager.registerProvider(provider);
    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
                                                                                            
                                                                                            
    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
    10
    contextSearchManager.register(provider);
    Precondition Violations (4)
    Row Violation
    1Expression (ISearchProvider)extension.instanciateExtension(null) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression (IContextProvider)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