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: 16 | Number of AST nodes: 17 | |||
1 | if (className == null)↵ | 1 | if (className == null)↵ | |
2 | throw new IllegalArgumentException("className == null");↵ | 2 | throw new IllegalArgumentException("className == null");↵ | |
3 | IExtensionInterface plugin = null;↵ | 3 | IExtensionInterface plugin = null;↵ | |
4 | // use our global class loader↵ | |||
5 | ClassLoader loader = Main.mainClassLoader;↵ | |||
6 | ↵ | |||
4 | Class actClass;↵ | 7 | Class actClass;↵ | |
5 | actClass = loader.loadClass(className);↵ | 8 | actClass = loader.loadClass(className);↵ | |
6 | //↵ | 9 | //↵ | |
7 | // we can't just load the first constructor↵ | 10 | // we can't just load the first constructor↵ | |
8 | // -> go find the correct constructor based↵ | 11 | // -> go find the correct constructor based↵ | |
9 | // -> based on the arguments↵ | 12 | // -> based on the arguments↵ | |
10 | //↵ | 13 | //↵ | |
11 | if ((arguments == null) || (arguments.length == 0)) {↵ | 14 | if ((arguments == null) || (arguments.length == 0)) {↵ | |
12 | plugin = (IExtensionInterface) actClass.newInstance();↵ | 15 | plugin = (IExtensionInterface) actClass.newInstance();↵ | |
13 | } else {↵ | 16 | } else {↵ | |
14 | Constructor constructor;↵ | 17 | Constructor constructor;↵ | |
15 | constructor = ClassLoaderHelper↵ | 18 | constructor = ClassLoaderHelper↵ | |
16 | .findConstructor(arguments, actClass);↵ | 19 | .findConstructor(arguments, actClass);↵ | |
17 | // couldn't find correct constructor↵ | 20 | // couldn't find correct constructor↵ | |
18 | if (constructor == null) {↵ | 21 | if (constructor == null) {↵ | |
19 | LOG.severe("Couldn't find constructor for " + className↵ | 22 | LOG.severe("Couldn't find constructor for " + className↵ | |
20 | + " with matching argument-list: ");↵ | 23 | + " with matching argument-list: ");↵ | |
21 | for (int i = 0; i < arguments.length; i++) {↵ | 24 | for (int i = 0; i < arguments.length; i++) {↵ | |
22 | LOG.severe("argument[" + i + "]=" + arguments[i]);↵ | 25 | LOG.severe("argument[" + i + "]=" + arguments[i]);↵ | |
23 | }↵ | 26 | }↵ | |
24 | return null;↵ | 27 | return null;↵ | |
25 | } else {↵ | 28 | } else {↵ | |
26 | plugin = (IExtensionInterface) constructor↵ | 29 | plugin = (IExtensionInterface) constructor↵ | |
27 | .newInstance(arguments);↵ | 30 | .newInstance(arguments);↵ | |
28 | }↵ | 31 | }↵ | |
29 | }↵ | 32 | }↵ | |
30 | return plugin; | 33 |
| |
See real code fragment | See real code fragment |
Number of common nesting structure subtrees | 1 |
Number of refactorable cases | 1 |
Number of non-refactorable cases | 0 |
Time elapsed for finding largest common nesting structure subtrees (ms) | 1.0 |
Clones location | Clones are in different classes |
Number of node comparisons | 61 |
Number of mapped statements | 16 |
Number of unmapped statements in the first code fragment | 0 |
Number of unmapped statements in the second code fragment | 1 |
Time elapsed for statement mapping (ms) | 9.6 |
Clone type | Type 3 |
ID | Statement | ID | Statement | |
---|---|---|---|---|
1 | if (className == null) | 1 | if (className == null) | |
2 | throw new IllegalArgumentException("className == null"); | 2 | throw new IllegalArgumentException("className == null"); | |
3 | IExtensionInterface plugin = null; | 3 | IExtensionInterface plugin = null; | |
| 4 | ClassLoader loader = Main.mainClassLoader; | ||
4 | Class actClass; | 5 | Class actClass; | |
5 | actClass = loader.loadClass(className); | 6 | actClass = loader.loadClass(className); | |
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); | |
16 | return plugin; | 17 | return plugin; |
Row | Violation |
---|