JMeterGUIComponent comp; Class c; try { c = Class.forName(objClass); if (TestBean.class.isAssignableFrom(c)) { comp = getGuiFromCache(TestBeanGUI.class, c); } else { comp = getGuiFromCache(c, null); } comp.clearGui(); TestElement node = comp.createTestElement(); nodesToGui.put(node, comp); return node; } catch (NoClassDefFoundError e) { log.error("Problem retrieving gui for " + objClass, e); String msg="Cannot find class: "+e.getMessage(); JOptionPane.showMessageDialog(null, msg, "Missing jar? See log file." , JOptionPane.ERROR_MESSAGE); throw new RuntimeException(e.toString()); // Probably a missing // jar } catch (ClassNotFoundException e) { log.error("Problem retrieving gui for " + objClass, e); throw new RuntimeException(e.toString()); // Programming error: // bail out. } catch (InstantiationException e) { log.error("Problem retrieving gui for " + objClass, e); throw new RuntimeException(e.toString()); // Programming error: // bail out. } catch (IllegalAccessException e) { log.error("Problem retrieving gui for " + objClass, e); throw new RuntimeException(e.toString()); // Programming error: // bail out. }
JMeterGUIComponent comp; Class c; try { c = Class.forName(objClass); if (TestBean.class.isAssignableFrom(c)) { comp = getGuiFromCache(TestBeanGUI.class, c); } else { comp = getGuiFromCache(c, null); } comp.clearGui(); TestElement node = comp.createTestElement(); nodesToGui.put(node, comp); return node; } catch (NoClassDefFoundError e) { log.error("Problem retrieving gui for " + objClass, e); throw new RuntimeException(e.toString()); // Probably a missing // jar } catch (ClassNotFoundException e) { log.error("Problem retrieving gui for " + objClass, e); throw new RuntimeException(e.toString()); // Programming error: // bail out. } catch (InstantiationException e) { log.error("Problem retrieving gui for " + objClass, e); throw new RuntimeException(e.toString()); // Programming error: // bail out. } catch (IllegalAccessException e) { log.error("Problem retrieving gui for " + objClass, e); throw new RuntimeException(e.toString()); // Programming error: // bail out. }
Clone fragments detected by clone detection tool
File path: /jakarta-jmeter-2.3.2/src/org/apache/jmeter/gui/GuiPackage.java File path: /jakarta-jmeter-2.3.2/src/org/apache/jmeter/gui/ReportGuiPackage.java
Method name: TestElement createTestElement(String) Method name: TestElement createTestElement(String)
Number of AST nodes: 11 Number of AST nodes: 11
1
JMeterGUIComponent comp;
1
JMeterGUIComponent comp;
2
		Class c;
2
		Class c;
3
		try {
3
		try {
4
			c = Class.forName(objClass);
4
			c = Class.forName(objClass);
5
			if (TestBean.class.isAssignableFrom(c)) {
5
			if (TestBean.class.isAssignableFrom(c)) {
6
				comp = getGuiFromCache(TestBeanGUI.class, c);
6
				comp = getGuiFromCache(TestBeanGUI.class, c);
7
			} else {
7
			} else {
8
				comp = getGuiFromCache(c, null);
8
				comp = getGuiFromCache(c, null);
9
			}
9
			}
10
			comp.clearGui();
10
			comp.clearGui();
11
			TestElement node = comp.createTestElement();
11
			TestElement node = comp.createTestElement();
12
			nodesToGui.put(node, comp);
12
			nodesToGui.put(node, comp);
13
			return node;
13
			return node;
14
		} catch (NoClassDefFoundError e) {
14
		} catch (NoClassDefFoundError e) {
15
			log.error("Problem retrieving gui for " + objClass, e);
15
			log.error("Problem retrieving gui for " + objClass, e);
16
            String msg="Cannot find class: "+e.getMessage();
17
            JOptionPane.showMessageDialog(null,
18
                    msg,
19
                    "Missing jar? See log file." , 
20
                    JOptionPane.ERROR_MESSAGE);
21
			throw new RuntimeException(e.toString()); // Probably a missing
16
			throw new RuntimeException(e.toString()); // Probably a missing
22
														// jar
17
														// jar
23
		} catch (ClassNotFoundException e) {
18
		} catch (ClassNotFoundException e) {
24
			log.error("Problem retrieving gui for " + objClass, e);
19
			log.error("Problem retrieving gui for " + objClass, e);
25
			throw new RuntimeException(e.toString()); // Programming error:
20
			throw new RuntimeException(e.toString()); // Programming error:
26
														// bail out.
21
														// bail out.
27
		} catch (InstantiationException e) {
22
		} catch (InstantiationException e) {
28
			log.error("Problem retrieving gui for " + objClass, e);
23
			log.error("Problem retrieving gui for " + objClass, e);
29
			throw new RuntimeException(e.toString()); // Programming error:
24
			throw new RuntimeException(e.toString()); // Programming error:
30
														// bail out.
25
														// bail out.
31
		} catch (IllegalAccessException e) {
26
		} catch (IllegalAccessException e) {
32
			log.error("Problem retrieving gui for " + objClass, e);
27
			log.error("Problem retrieving gui for " + objClass, e);
33
			throw new RuntimeException(e.toString()); // Programming error:
28
			throw new RuntimeException(e.toString()); // Programming error:
34
														// bail out.
29
														// bail out.
35
		}
30
		}
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 comparisons11
  1. {Refactorable}
    Mapping Summary
    Number of mapped statements4
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)2.3
    Clone typeType 1
    Mapped Statements
    ID Statement ID Statement
    4
    c = Class.forName(objClass);
    4
    c = Class.forName(objClass);
    5
    if (TestBean.class.isAssignableFrom(c))
    5
    if (TestBean.class.isAssignableFrom(c))
    6
    comp = getGuiFromCache(TestBeanGUI.class, c);
    6
    comp = getGuiFromCache(TestBeanGUI.class, c);
    else
    else
    7
    comp = getGuiFromCache(c, null);
    7
    comp = getGuiFromCache(c, null);
    Precondition Violations (0)
    Row Violation