Class actClass; actClass = loader.loadClass(className); // // we can't just load the first constructor // -> go find the correct constructor based // -> based on the arguments // if ((arguments == null) || (arguments.length == 0)) { plugin = (IExtensionInterface) actClass.newInstance(); } else { Constructor constructor; constructor = ClassLoaderHelper .findConstructor(arguments, actClass); // couldn't find correct constructor if (constructor == null) { LOG.severe("Couldn't find constructor for " + className + " with matching argument-list: "); for (int i = 0; i < arguments.length; i++) { LOG.severe("argument[" + i + "]=" + arguments[i]); } return null; } else { plugin = (IExtensionInterface) constructor .newInstance(arguments); } } return plugin;
Class actClass; actClass = loader.loadClass(className); // // we can't just load the first constructor // -> go find the correct constructor based // -> based on the arguments // if ((arguments == null) || (arguments.length == 0)) { plugin = (IExtensionInterface) actClass.newInstance(); } else { Constructor constructor; constructor = ClassLoaderHelper .findConstructor(arguments, actClass); // couldn't find correct constructor if (constructor == null) { LOG.severe("Couldn't find constructor for " + className + " with matching argument-list: "); for (int i = 0; i < arguments.length; i++) { LOG.severe("argument[" + i + "]=" + arguments[i]); } return null; } else { plugin = (IExtensionInterface) constructor .newInstance(arguments); } } return plugin;
Clone fragments detected by clone detection tool
File path: /columba-1.4-src/core/src/main/java/org/columba/core/plugin/Extension.java File path: /columba-1.4-src/core/src/main/java/org/columba/core/plugin/DefaultPluginLoader.java
Method name: IExtensionInterface instanciateJavaClass(String, Object[]) Method name: IExtensionInterface loadPlugin(String, String, Object[])
Number of AST nodes: 13 Number of AST nodes: 13
1
Class actClass;
1
Class actClass;
2
		actClass = loader.loadClass(className);
2
		actClass = loader.loadClass(className);
3
		//
3
		//
4
		// we can't just load the first constructor
4
		// we can't just load the first constructor
5
		// -> go find the correct constructor based
5
		// -> go find the correct constructor based
6
		// -> based on the arguments
6
		// -> based on the arguments
7
		//
7
		//
8
		if ((arguments == null) || (arguments.length == 0)) {
8
		if ((arguments == null) || (arguments.length == 0)) {
9
			plugin = (IExtensionInterface) actClass.newInstance();
9
			plugin = (IExtensionInterface) actClass.newInstance();
10
		} else {
10
		} else {
11
			Constructor constructor;
11
			Constructor constructor;
12
			constructor = ClassLoaderHelper
12
			constructor = ClassLoaderHelper
13
					.findConstructor(arguments, actClass);
13
					.findConstructor(arguments, actClass);
14
			// couldn't find correct constructor
14
			// couldn't find correct constructor
15
			if (constructor == null) {
15
			if (constructor == null) {
16
				LOG.severe("Couldn't find constructor for " + className
16
				LOG.severe("Couldn't find constructor for " + className
17
						+ " with matching argument-list: ");
17
						+ " with matching argument-list: ");
18
				for (int i = 0; i < arguments.length; i++) {
18
				for (int i = 0; i < arguments.length; i++) {
19
					LOG.severe("argument[" + i + "]=" + arguments[i]);
19
					LOG.severe("argument[" + i + "]=" + arguments[i]);
20
				}
20
				}
21
				return null;
21
				return null;
22
			} else {
22
			} else {
23
				plugin = (IExtensionInterface) constructor
23
				plugin = (IExtensionInterface) constructor
24
						.newInstance(arguments);
24
						.newInstance(arguments);
25
			}
25
			}
26
		}
26
		}
27
		return plugin;
27
		return plugin;
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.5
Clones locationClones are in different classes
Number of node comparisons45
  1. {Refactorable}
    Mapping Summary
    Number of mapped statements13
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)4.2
    Clone typeType 1
    Mapped Statements
    ID Statement ID Statement
    5
    Class actClass;
    4
    Class actClass;
    6
    actClass = loader.loadClass(className);
    5
    actClass = loader.loadClass(className);
    7
    if ((arguments == null) || (arguments.length == 0))
    6
    if ((arguments == null) || (arguments.length == 0))
    8
    plugin = (IExtensionInterface)actClass.newInstance();
    7
    plugin = (IExtensionInterface)actClass.newInstance();
    else
    else
    9
    Constructor constructor;
    8
    Constructor constructor;
    10
    constructor = ClassLoaderHelper.findConstructor(arguments, actClass);
    9
    constructor = ClassLoaderHelper.findConstructor(arguments, actClass);
    11
    if (constructor == null)
    10
    if (constructor == null)
    12
    LOG.severe("Couldn't find constructor for " + className + " with matching argument-list: ");
    11
    LOG.severe("Couldn't find constructor for " + className + " with matching argument-list: ");
    13
    for (int i = 0; i < arguments.length; i++)
    12
    for (int i = 0; i < arguments.length; i++)
    14
    LOG.severe("argument[" + i + "]=" + arguments[i]);
    13
    LOG.severe("argument[" + i + "]=" + arguments[i]);
    15
    return null;
    14
    return null;
    else
    else
    16
    plugin = (IExtensionInterface)constructor.newInstance(arguments);
    15
    plugin = (IExtensionInterface)constructor.newInstance(arguments);
    17
    return plugin;
    16
    return plugin;
    Precondition Violations (0)
    Row Violation