if (comp == null) { throw new IllegalArgumentException("Component == null"); } switch (menuId) { case IMenuIDs.PLUGINS_MENU : { _pluginsMenu.add(comp); break; } case IMenuIDs.SESSION_MENU : { _sessionMenu.add(comp); break; } default : { throw new IllegalArgumentException("Invalid menuId passed: " + menuId); } }
if (menu == null) { throw new IllegalArgumentException("Null JMenu passed"); } switch (menuId) { case IMenuIDs.PLUGINS_MENU : { _pluginsMenu.add(menu); break; } case IMenuIDs.SESSION_MENU : { _sessionMenu.add(menu); break; } default: { throw new IllegalArgumentException("Invalid menuId passed: " + menuId); } }
Clone fragments detected by clone detection tool
File path: /sql12/app/src/net/sourceforge/squirrel_sql/client/gui/mainframe/MainFrameMenuBar.java File path: /sql12/app/src/net/sourceforge/squirrel_sql/client/gui/mainframe/MainFrameMenuBar.java
Method name: void addToMenu(int, Component) Method name: void addToMenu(int, JMenu)
Number of AST nodes: 11 Number of AST nodes: 11
1
if (comp == null)
1
if (menu == null)
2
		{
2
		{
3
			throw new IllegalArgumentException("Component == null");
3
			throw new IllegalArgumentException("Null JMenu passed");
4
		}
4
		}
5
		switch (menuId)
5
		switch (menuId)
6
		{
6
		{
7
			case IMenuIDs.PLUGINS_MENU :
7
			case IMenuIDs.PLUGINS_MENU :
8
			{
8
			{
9
				_pluginsMenu.add(comp);
9
				_pluginsMenu.add(menu);
10
				break;
10
				break;
11
			}
11
			}
12
			case IMenuIDs.SESSION_MENU :
12
			case IMenuIDs.SESSION_MENU :
13
			{
13
			{
14
				_sessionMenu.add(comp);
14
				_sessionMenu.add(menu);
15
				break;
15
				break;
16
			}
16
			}
17
			default :
17
			default:
18
			{
18
			{
19
				throw new IllegalArgumentException("Invalid menuId passed: " + menuId);
19
				throw new IllegalArgumentException("Invalid menuId passed: " + menuId);
20
			}
20
			}
21
		}
21
		}
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.3
Clones locationClones are declared in the same class
Number of node comparisons50
  1. {Refactorable}
    Mapping Summary
    Number of mapped statements11
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)3.5
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    if (comp == null)
    1
    if (comp == null)
    1
    if (menu == null)
    Differences
    Expression1Expression2Difference
    compmenuVARIABLE_NAME_MISMATCH
    java.awt.Componentjavax.swing.JMenuSUBCLASS_TYPE_MISMATCH
    1
    if (menu == null)
    2
    throw new IllegalArgumentException("Component == null");
    2
    throw new IllegalArgumentException("Component == null");
    2
    throw new IllegalArgumentException("Null JMenu passed");
    Differences
    Expression1Expression2Difference
    "Component == null""Null JMenu passed"LITERAL_VALUE_MISMATCH
    2
    throw new IllegalArgumentException("Null JMenu passed");
    3
    switch (menuId)
    3
    switch (menuId)
    4
    case IMenuIDs.PLUGINS_MENU:
    4
    case IMenuIDs.PLUGINS_MENU:
    5
    _pluginsMenu.add(comp);
    5
    _pluginsMenu.add(comp);
    5
    _pluginsMenu.add(menu);
    Differences
    Expression1Expression2Difference
    compmenuVARIABLE_NAME_MISMATCH
    java.awt.Componentjavax.swing.JMenuSUBCLASS_TYPE_MISMATCH
    5
    _pluginsMenu.add(menu);
    6
    break;
    6
    break;
    7
    case IMenuIDs.SESSION_MENU:
    7
    case IMenuIDs.SESSION_MENU:
    8
    _sessionMenu.add(comp);
    8
    _sessionMenu.add(comp);
    8
    _sessionMenu.add(menu);
    Differences
    Expression1Expression2Difference
    compmenuVARIABLE_NAME_MISMATCH
    java.awt.Componentjavax.swing.JMenuSUBCLASS_TYPE_MISMATCH
    8
    _sessionMenu.add(menu);
    9
    break;
    9
    break;
    10
    default:
    10
    default:
    11
    throw new IllegalArgumentException("Invalid menuId passed: " + menuId);
    11
    throw new IllegalArgumentException("Invalid menuId passed: " + menuId);
    Precondition Violations (0)
    Row Violation