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); } }
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); } }
Clone fragments detected by clone detection tool
File path: /columba-1.4-src/core/src/main/java/org/columba/core/plugin/DefaultPluginLoader.java File path: /columba-1.4-src/core/src/main/java/org/columba/core/plugin/Extension.java
Method name: IExtensionInterface loadPlugin(String, String, Object[]) Method name: IExtensionInterface instanciateJavaClass(String, Object[])
Number of AST nodes: 10 Number of AST nodes: 10
1
if ((arguments == null) || (arguments.length == 0)) {
1
if ((arguments == null) || (arguments.length == 0)) {
2
			plugin = (IExtensionInterface) actClass.newInstance();
2
			plugin = (IExtensionInterface) actClass.newInstance();
3
		} else {
3
		} else {
4
			Constructor constructor;
4
			Constructor constructor;
5
			constructor = ClassLoaderHelper
5
			constructor = ClassLoaderHelper
6
					.findConstructor(arguments, actClass);
6
					.findConstructor(arguments, actClass);
7
			// couldn't find correct constructor
7
			// couldn't find correct constructor
8
			if (constructor == null) {
8
			if (constructor == null) {
9
				LOG.severe("Couldn't find constructor for " + className
9
				LOG.severe("Couldn't find constructor for " + className
10
						+ " with matching argument-list: ");
10
						+ " with matching argument-list: ");
11
				for (int i = 0; i < arguments.length; i++) {
11
				for (int i = 0; i < arguments.length; i++) {
12
					LOG.severe("argument[" + i + "]=" + arguments[i]);
12
					LOG.severe("argument[" + i + "]=" + arguments[i]);
13
				}
13
				}
14
				return null;
14
				return null;
15
			} else {
15
			} else {
16
				plugin = (IExtensionInterface) constructor
16
				plugin = (IExtensionInterface) constructor
17
						.newInstance(arguments);
17
						.newInstance(arguments);
18
			}
18
			}
19
		}
19
		}
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)0.5
Clones locationClones are in different classes
Number of node comparisons36
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements10
    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.6
    Clone typeType 1
    Mapped Statements
    ID Statement ID Statement
    6
    if ((arguments == null) || (arguments.length == 0))
    7
    if ((arguments == null) || (arguments.length == 0))
    7
    plugin = (IExtensionInterface)actClass.newInstance();
    8
    plugin = (IExtensionInterface)actClass.newInstance();
    else
    else
    8
    Constructor constructor;
    9
    Constructor constructor;
    9
    constructor = ClassLoaderHelper.findConstructor(arguments, actClass);
    10
    constructor = ClassLoaderHelper.findConstructor(arguments, actClass);
    10
    if (constructor == null)
    11
    if (constructor == null)
    11
    LOG.severe("Couldn't find constructor for " + className + " with matching argument-list: ");
    12
    LOG.severe("Couldn't find constructor for " + className + " with matching argument-list: ");
    12
    for (int i = 0; i < arguments.length; i++)
    13
    for (int i = 0; i < arguments.length; i++)
    13
    LOG.severe("argument[" + i + "]=" + arguments[i]);
    14
    LOG.severe("argument[" + i + "]=" + arguments[i]);
    14
    return null;
    15
    return null;
    else
    else
    15
    plugin = (IExtensionInterface)constructor.newInstance(arguments);
    16
    plugin = (IExtensionInterface)constructor.newInstance(arguments);
    Precondition Violations (1)
    Row Violation
    1Not all possible execution flows end in a return statement