File path: /jakarta-jmeter-2.3.2/src/org/apache/jmeter/gui/util/MenuFactory.java | File path: /jakarta-jmeter-2.3.2/src/org/apache/jmeter/gui/util/ReportMenuFactory.java | |||
Method name: void initializeMenus()
|
Method name: void initializeMenus()
|
|||
Number of AST nodes: 19 | Number of AST nodes: 19 | |||
1 | String name = (String) iter.next();↵ | 1 | String name = (String) iter.next();↵ | |
2 | /*↵ | 2 | /*↵ | |
3 | * JMeterTreeNode and TestBeanGUI are special GUI classes, and↵ | 3 | * JMeterTreeNode and TestBeanGUI are special GUI classes, and↵ | |
4 | * aren't intended to be added to menus↵ | 4 | * aren't intended to be added to menus↵ | |
5 | * ↵ | 5 | * ↵ | |
6 | * TODO: find a better way of checking this↵ | 6 | * TODO: find a better way of checking this↵ | |
7 | */↵ | 7 | */↵ | |
8 | if (name.endsWith("JMeterTreeNode") // $NON-NLS-1$↵ | 8 | if (name.endsWith("JMeterTreeNode")↵ | |
9 | || name.endsWith("TestBeanGUI")) {// $NON-NLS-1$↵ | 9 | || name.endsWith("TestBeanGUI")) {↵ | |
10 | continue;// Don't try to instantiate these↵ | 10 | continue;// Don't try to instantiate these↵ | |
11 | }↵ | 11 | }↵ | |
12 | JMeterGUIComponent item;↵ | 12 | JMeterGUIComponent item;↵ | |
13 | try {↵ | 13 | try {↵ | |
14 | Class c = Class.forName(name);↵ | 14 | Class c = Class.forName(name);↵ | |
15 | if (TestBean.class.isAssignableFrom(c)) {↵ | 15 | if (TestBean.class.isAssignableFrom(c)) {↵ | |
16 | item = new TestBeanGUI(c);↵ | 16 | item = new TestBeanGUI(c);↵ | |
17 | } else {↵ | 17 | } else {↵ | |
18 | item = (JMeterGUIComponent) c.newInstance();↵ | 18 | item = (JMeterGUIComponent) c.newInstance();↵ | |
19 | }↵ | 19 | }↵ | |
20 | } catch (NoClassDefFoundError e) {↵ | 20 | } catch (NoClassDefFoundError e) {↵ | |
21 | log.warn("Missing jar? Could not create " + name + ". " + e);↵ | 21 | log.warn("Missing jar? Could not create " + name + ". " + e);↵ | |
22 | continue;↵ | 22 | continue;↵ | |
23 | } catch (Throwable e) {↵ | 23 | } catch (Throwable e) {↵ | |
24 | log.warn("Could not instantiate " + name, e);↵ | 24 | log.warn("Could not instantiate " + name, e);↵ | |
25 | continue;↵ | 25 | continue;↵ | |
26 | }↵ | 26 | }↵ | |
27 | if (elementsToSkip.contains(name) || elementsToSkip.contains(item.getStaticLabel())) {↵ | 27 | if (elementsToSkip.contains(name) || elementsToSkip.contains(item.getStaticLabel())) {↵ | |
28 | log.info("Skipping " + name);↵ | 28 | log.info("Skipping " + name);↵ | |
29 | continue;↵ | 29 | continue;↵ | |
30 | } else {↵ | 30 | } else {↵ | |
31 | elementsToSkip.add(name);↵ | 31 | elementsToSkip.add(name);↵ | |
32 | }↵ | 32 | }↵ | |
33 | Collection categories = item.getMenuCategories();↵ | 33 | Collection categories = item.getMenuCategories();↵ | |
34 | if (categories == null) {↵ | 34 | if (categories == null) {↵ | |
35 | log.debug(name + " participates in no menus.");↵ | 35 | log.debug(name + " participates in no menus.");↵ | |
36 | continue;↵ | 36 | continue;↵ | |
37 | }↵ | 37 | }↵ | |
38 | if (categories.contains(TIMERS)) {↵ | 38 | if (categories.contains(POST_PROCESSORS)) {↵ | |
39 | timers.add(new MenuInfo(item.getStaticLabel(), name));↵ | 39 | postProcessors.add(new MenuInfo(item.getStaticLabel(), name));↵ | |
40 | } | 40 |
| |
See real code fragment | See real code fragment |
Number of common nesting structure subtrees | 1 |
Number of refactorable cases | 0 |
Number of non-refactorable cases | 1 |
Time elapsed for finding largest common nesting structure subtrees (ms) | 5.6 |
Clones location | Clones are in different classes |
Number of node comparisons | 61 |
Number of mapped statements | 19 |
Number of unmapped statements in the first code fragment | 0 |
Number of unmapped statements in the second code fragment | 0 |
Time elapsed for statement mapping (ms) | 73.3 |
Clone type | Type 2 |
ID | Statement | ID | Statement | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
24 | String name = (String)iter.next(); | 22 | String name = (String)iter.next(); | |||||||||||
25 | if (name.endsWith("JMeterTreeNode") || name.endsWith("TestBeanGUI")) | 23 | if (name.endsWith("JMeterTreeNode") || name.endsWith("TestBeanGUI")) | |||||||||||
26 | continue; |
| 24 | continue; | ||||||||||
27 | JMeterGUIComponent item; | 25 | JMeterGUIComponent item; | |||||||||||
28 | try | 26 | try | |||||||||||
29 | Class c = Class.forName(name); | 27 | Class c = Class.forName(name); | |||||||||||
30 | if (TestBean.class.isAssignableFrom(c)) | 28 | if (TestBean.class.isAssignableFrom(c)) | |||||||||||
31 | item = new TestBeanGUI(c); | 29 | item = new TestBeanGUI(c); | |||||||||||
else | else | |||||||||||||
32 | item = (JMeterGUIComponent)c.newInstance(); | 30 | item = (JMeterGUIComponent)c.newInstance(); | |||||||||||
33 | if (elementsToSkip.contains(name) || elementsToSkip.contains(item.getStaticLabel())) | 31 | if (elementsToSkip.contains(name) || elementsToSkip.contains(item.getStaticLabel())) | |||||||||||
34 | log.info("Skipping " + name); | 32 | log.info("Skipping " + name); | |||||||||||
35 | continue; |
| 33 | continue; | ||||||||||
else | else | |||||||||||||
36 | elementsToSkip.add(name); | 34 | elementsToSkip.add(name); | |||||||||||
37 | Collection categories = item.getMenuCategories(); | 35 | Collection categories = item.getMenuCategories(); | |||||||||||
38 | if (categories == null) | 36 | if (categories == null) | |||||||||||
39 | log.debug(name + " participates in no menus."); | 37 | log.debug(name + " participates in no menus."); | |||||||||||
40 | continue; |
| 38 | continue; | ||||||||||
41 | if (categories.contains(TIMERS)) |
| 39 | if (categories.contains(POST_PROCESSORS)) | ||||||||||
42 | timers.add(new MenuInfo(item.getStaticLabel(), name)); |
| 40 | postProcessors.add(new MenuInfo(item.getStaticLabel(), name)); |
Row | Violation |
---|---|
1 | Statement continue; without innermost loop |
2 | Statement continue; without innermost loop |
3 | Statement continue; without innermost loop |
4 | Statement continue; without innermost loop |
5 | Statement continue; without innermost loop |
6 | Statement continue; without innermost loop |
7 | Clone fragment #1 returns variables categories, name, item , while Clone fragment #2 returns variables categories, name, item |