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. } } /** * Get an instance of the specified JMeterGUIComponent class. If an instance * of the GUI class has previously been created and it is not marked as an * {@link UnsharedComponent}, that shared instance will be returned. * Otherwise, a new instance of the component will be created, and shared * components will be cached for future retrieval. * * @param guiClass * the fully qualified class name of the GUI component. This * class must implement JMeterGUIComponent. * @param testClass * the fully qualified class name of the test elements edited by * this GUI component. This class must implement TestElement. * @return an instance of the specified class * * @throws InstantiationException * if an instance of the object cannot be created * @throws IllegalAccessException * if access rights do not allow the default constructor to be * called * @throws ClassNotFoundException * if the specified GUI class cannot be found */ private JMeterGUIComponent getGuiFromCache(Class guiClass, Class testClass) throws InstantiationException, IllegalAccessException { JMeterGUIComponent comp; if (guiClass == TestBeanGUI.class) { comp = (TestBeanGUI) testBeanGUIs.get(testClass); if (comp == null) { comp = new TestBeanGUI(testClass); testBeanGUIs.put(testClass, comp); } } else { comp = (JMeterGUIComponent) guis.get(guiClass); if (comp == null) { comp = (JMeterGUIComponent) guiClass.newInstance(); if (!(comp instanceof UnsharedComponent)) { guis.put(guiClass, comp); } } } return comp; } /** * Update the GUI for the currently selected node. The GUI component is * configured to reflect the settings in the current tree node. * */ public void updateCurrentGui() { updateCurrentNode(); currentNode = treeListener.getCurrentNode(); TestElement element = currentNode.getTestElement(); JMeterGUIComponent comp = getGui(element); comp.configure(element); currentNodeUpdated = false; } /** * This method should be called in order for GuiPackage to change the * current node. This will save any changes made to the earlier node before * choosing the new node. */ public void updateCurrentNode() { try { if (currentNode != null && !currentNodeUpdated) { log.debug("Updating current node " + currentNode.getName()); JMeterGUIComponent comp = getGui(currentNode.getTestElement()); TestElement el = currentNode.getTestElement(); comp.modifyTestElement(el); }
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. } } /** * Get an instance of the specified JMeterGUIComponent class. If an instance * of the GUI class has previously been created and it is not marked as an * {@link UnsharedComponent}, that shared instance will be returned. * Otherwise, a new instance of the component will be created, and shared * components will be cached for future retrieval. * * @param guiClass * the fully qualified class name of the GUI component. This * class must implement JMeterGUIComponent. * @param testClass * the fully qualified class name of the test elements edited by * this GUI component. This class must implement TestElement. * @return an instance of the specified class * * @throws InstantiationException * if an instance of the object cannot be created * @throws IllegalAccessException * if access rights do not allow the default constructor to be * called * @throws ClassNotFoundException * if the specified GUI class cannot be found */ private JMeterGUIComponent getGuiFromCache(Class guiClass, Class testClass) throws InstantiationException, IllegalAccessException { JMeterGUIComponent comp; if (guiClass == TestBeanGUI.class) { comp = (TestBeanGUI) testBeanGUIs.get(testClass); if (comp == null) { comp = new TestBeanGUI(testClass); testBeanGUIs.put(testClass, comp); } } else { comp = (JMeterGUIComponent) guis.get(guiClass); if (comp == null) { comp = (JMeterGUIComponent) guiClass.newInstance(); if (!(comp instanceof UnsharedComponent)) { guis.put(guiClass, comp); } } } return comp; } /** * Update the GUI for the currently selected node. The GUI component is * configured to reflect the settings in the current tree node. * */ public void updateCurrentGui() { updateCurrentNode(); currentNode = treeListener.getCurrentNode(); TestElement element = currentNode.getTestElement(); JMeterGUIComponent comp = getGui(element); comp.configure(element); currentNodeUpdated = false; } /** * This method should be called in order for GuiPackage to change the * current node. This will save any changes made to the earlier node before * choosing the new node. */ public void updateCurrentNode() { try { if (currentNode != null && !currentNodeUpdated) { log.debug("Updating current node " + currentNode.getName()); JMeterGUIComponent comp = getGui(currentNode.getTestElement()); TestElement el = currentNode.getTestElement(); comp.modifyTestElement(el); }
Clone fragments detected by clone detection tool
File path: /jakarta-jmeter-2.3.2/src/org/apache/jmeter/gui/ReportGuiPackage.java File path: /jakarta-jmeter-2.3.2/src/org/apache/jmeter/gui/GuiPackage.java
Method name: Method name:
Number of AST nodes: 0 Number of AST nodes: 0
1
catch (ClassNotFoundException e) {
1
catch (ClassNotFoundException e) {
2
			log.error("Problem retrieving gui for " + objClass, e);
2
			log.error("Problem retrieving gui for " + objClass, e);
3
			throw new RuntimeException(e.toString()); // Programming error:
3
			throw new RuntimeException(e.toString()); // Programming error:
4
														// bail out.
4
														// bail out.
5
		} catch (InstantiationException e) {
5
		} catch (InstantiationException e) {
6
			log.error("Problem retrieving gui for " + objClass, e);
6
			log.error("Problem retrieving gui for " + objClass, e);
7
			throw new RuntimeException(e.toString()); // Programming error:
7
			throw new RuntimeException(e.toString()); // Programming error:
8
														// bail out.
8
														// bail out.
9
		} catch (IllegalAccessException e) {
9
		} catch (IllegalAccessException e) {
10
			log.error("Problem retrieving gui for " + objClass, e);
10
			log.error("Problem retrieving gui for " + objClass, e);
11
			throw new RuntimeException(e.toString()); // Programming error:
11
			throw new RuntimeException(e.toString()); // Programming error:
12
														// bail out.
12
														// bail out.
13
		}
13
		}
14
	}
14
	}
15
	/**
15
	/**
16
	 * Get an instance of the specified JMeterGUIComponent class. If an instance
16
	 * Get an instance of the specified JMeterGUIComponent class. If an instance
17
	 * of the GUI class has previously been created and it is not marked as an
17
	 * of the GUI class has previously been created and it is not marked as an
18
	 * {@link UnsharedComponent}, that shared instance will be returned.
18
	 * {@link UnsharedComponent}, that shared instance will be returned.
19
	 * Otherwise, a new instance of the component will be created, and shared
19
	 * Otherwise, a new instance of the component will be created, and shared
20
	 * components will be cached for future retrieval.
20
	 * components will be cached for future retrieval.
21
	 * 
21
	 * 
22
	 * @param guiClass
22
	 * @param guiClass
23
	 *            the fully qualified class name of the GUI component. This
23
	 *            the fully qualified class name of the GUI component. This
24
	 *            class must implement JMeterGUIComponent.
24
	 *            class must implement JMeterGUIComponent.
25
	 * @param testClass
25
	 * @param testClass
26
	 *            the fully qualified class name of the test elements edited by
26
	 *            the fully qualified class name of the test elements edited by
27
	 *            this GUI component. This class must implement TestElement.
27
	 *            this GUI component. This class must implement TestElement.
28
	 * @return an instance of the specified class
28
	 * @return an instance of the specified class
29
	 * 
29
	 * 
30
	 * @throws InstantiationException
30
	 * @throws InstantiationException
31
	 *             if an instance of the object cannot be created
31
	 *             if an instance of the object cannot be created
32
	 * @throws IllegalAccessException
32
	 * @throws IllegalAccessException
33
	 *             if access rights do not allow the default constructor to be
33
	 *             if access rights do not allow the default constructor to be
34
	 *             called
34
	 *             called
35
	 * @throws ClassNotFoundException
35
	 * @throws ClassNotFoundException
36
	 *             if the specified GUI class cannot be found
36
	 *             if the specified GUI class cannot be found
37
	 */
37
	 */
38
	private JMeterGUIComponent getGuiFromCache(Class guiClass, Class testClass) throws InstantiationException,
38
	private JMeterGUIComponent getGuiFromCache(Class guiClass, Class testClass) throws InstantiationException,
39
			IllegalAccessException {
39
			IllegalAccessException {
40
		JMeterGUIComponent comp;
40
		JMeterGUIComponent comp;
41
		if (guiClass == TestBeanGUI.class) {
41
		if (guiClass == TestBeanGUI.class) {
42
			comp = (TestBeanGUI) testBeanGUIs.get(testClass);
42
			comp = (TestBeanGUI) testBeanGUIs.get(testClass);
43
			if (comp == null) {
43
			if (comp == null) {
44
				comp = new TestBeanGUI(testClass);
44
				comp = new TestBeanGUI(testClass);
45
				testBeanGUIs.put(testClass, comp);
45
				testBeanGUIs.put(testClass, comp);
46
			}
46
			}
47
		} else {
47
		} else {
48
			comp = (JMeterGUIComponent) guis.get(guiClass);
48
			comp = (JMeterGUIComponent) guis.get(guiClass);
49
			if (comp == null) {
49
			if (comp == null) {
50
				comp = (JMeterGUIComponent) guiClass.newInstance();
50
				comp = (JMeterGUIComponent) guiClass.newInstance();
51
				if (!(comp instanceof UnsharedComponent)) {
51
				if (!(comp instanceof UnsharedComponent)) {
52
					guis.put(guiClass, comp);
52
					guis.put(guiClass, comp);
53
				}
53
				}
54
			}
54
			}
55
		}
55
		}
56
		return comp;
56
		return comp;
57
	}
57
	}
58
	/**
58
	/**
59
	 * Update the GUI for the currently selected node. The GUI component is
59
	 * Update the GUI for the currently selected node. The GUI component is
60
	 * configured to reflect the settings in the current tree node.
60
	 * configured to reflect the settings in the current tree node.
61
	 * 
61
	 * 
62
	 */
62
	 */
63
	public void updateCurrentGui() {
63
	public void updateCurrentGui() {
64
		updateCurrentNode();
64
		updateCurrentNode();
65
		currentNode = treeListener.getCurrentNode();
65
		currentNode = treeListener.getCurrentNode();
66
		TestElement element = currentNode.getTestElement();
66
		TestElement element = currentNode.getTestElement();
67
		JMeterGUIComponent comp = getGui(element);
67
		JMeterGUIComponent comp = getGui(element);
68
		comp.configure(element);
68
		comp.configure(element);
69
		currentNodeUpdated = false;
69
		currentNodeUpdated = false;
70
	}
70
	}
71
	/**
71
	/**
72
	 * This method should be called in order for GuiPackage to change the
72
	 * This method should be called in order for GuiPackage to change the
73
	 * current node. This will save any changes made to the earlier node before
73
	 * current node. This will save any changes made to the earlier node before
74
	 * choosing the new node.
74
	 * choosing the new node.
75
	 */
75
	 */
76
	public void updateCurrentNode() {
76
	public void updateCurrentNode() {
77
		try {
77
		try {
78
			if (currentNode != null && !currentNodeUpdated) {
78
			if (currentNode != null && !currentNodeUpdated) {
79
				log.debug("Updating current node " + currentNode.getName());
79
				log.debug("Updating current node " + currentNode.getName());
80
				JMeterGUIComponent comp = getGui(currentNode.getTestElement());
80
				JMeterGUIComponent comp = getGui(currentNode.getTestElement());
81
				TestElement el = currentNode.getTestElement();
81
				TestElement el = currentNode.getTestElement();
82
				comp.modifyTestElement(el);
82
				comp.modifyTestElement(el);
83
			}
83
			}
Summary
Number of common nesting structure subtrees0
Number of refactorable cases0
Number of non-refactorable cases0
Time elapsed for finding largest common nesting structure subtrees (ms)0.0
Clones location
Number of node comparisons0