if (action.equals("CHECK_AUTHMETHODS")) { fetchSupportedAuthenticationMechanisms(); } else if (action.equals("SAVE")) { if (!storePasswordCheckBox.isSelected()) { return; } else { File configPath = DefaultConfigDirectory.getInstance().getCurrentPath(); File defaultConfigPath = DefaultConfigDirectory.getDefaultPath(); while (!configPath.equals(defaultConfigPath)) { configPath = configPath.getParentFile(); if (configPath == null) { JOptionPane.showMessageDialog(dialog, MailResourceLoader.getString("dialog", "password", "warn_save_msg"), MailResourceLoader.getString("dialog", "password", "warn_save_title"), JOptionPane.WARNING_MESSAGE); return; } } } }
if (action.equals("CANCEL")) { bool = false; dispose(); } else if (action.equals("SAVE")) { if (!checkbox.isSelected()) { return; } else { File configPath = DefaultConfigDirectory.getInstance().getCurrentPath(); File defaultConfigPath = DefaultConfigDirectory.getDefaultPath(); while (!configPath.equals(defaultConfigPath)) { configPath = configPath.getParentFile(); if (configPath == null) { JOptionPane.showMessageDialog(this, MailResourceLoader .getString("dialog", "password", "warn_save_msg"), MailResourceLoader .getString("dialog", "password", "warn_save_title"), JOptionPane.WARNING_MESSAGE); return; } } } }
Clone fragments detected by clone detection tool
File path: /columba-1.4-src/mail/src/main/java/org/columba/mail/gui/config/account/OutgoingServerPanel.java File path: /columba-1.4-src/mail/src/main/java/org/columba/mail/gui/util/PasswordDialog.java
Method name: void actionPerformed(ActionEvent) Method name: void actionPerformed(ActionEvent)
Number of AST nodes: 12 Number of AST nodes: 13
1
if (action.equals("CHECK_AUTHMETHODS")) {
1
if (action.equals("C
2
			fetchSupportedAuthenticationMechanisms
2
ANCEL")) {
3
			bool = false;
3
();
4
			dispose();
4
		} else if (action.equals("SAVE")) {
5
		} else if (action.equals("SAVE")) {
5
			if (!storePasswordCheckBox.isSelected()) {
6
			if (!checkbox.isSelected()) {
6
				return;
7
				return;
7
			} else {
8
			} else {
8
				File configPath = DefaultConfigDirectory.getInstance().getCurrentPath();
9
				File configPath = DefaultConfigDirectory.getInstance().getCurrentPath();
9
				File defaultConfigPath = DefaultConfigDirectory.getDefaultPath();
10
				File defaultConfigPath = DefaultConfigDirectory.getDefaultPath();
10
				while (!configPath.equals(defaultConfigPath)) {
11
				while (!configPath.equals(defaultConfigPath)) {
11
					configPath = configPath.getParentFile();
12
					configPath = configPath.getParentFile();
12
					if (configPath == null) {
13
					if (configPath == null) {
13
						JOptionPane.showMessageDialog(dialog,
14
						JOptionPane.showMessageDialog(
14
								MailResourceLoader
15
this, MailResourceLoader
15
.getString("dialog",
16
								.getString("dialog",
16
										"password", 
17
 "password",
17
"warn_save_msg"),
18
										"warn_save_msg"),
18
								MailResourceLoader
19
 MailResourceLoader
19
.getString("dialog",
20
								.getString("dialog",
20
										"password", 
21
 "password",
21
"warn_save_title"),
22
										"warn_save_title"),
22
								JOptionPane.WARNING_MESSAGE);
23
								JOptionPane.WARNING_MESSAGE);
23
						return;
24
						return;
24
					}
25
					}
25
				}
26
				}
26
			}
27
			}
27
		}
28
		}
Summary
Number of common nesting structure subtrees1
Number of refactorable cases0
Number of non-refactorable cases1
Time elapsed for finding largest common nesting structure subtrees (ms)0.6
Clones locationClones are in different classes having the same super class
Number of node comparisons36
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements12
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment1
    Time elapsed for statement mapping (ms)5.8
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
    20
    else if (action.equals("CHECK_AUTHMETHODS"))
    20
    else if (action.equals("CHECK_AUTHMETHODS"))
    6
    else if (action.equals("CANCEL"))
    Differences
    Expression1Expression2Difference
    "CHECK_AUTHMETHODS""CANCEL"LITERAL_VALUE_MISMATCH
    6
    else if (action.equals("CANCEL"))
                                
    7
    bool = false;
    Preondition Violations
    Unmatched statement bool=false; cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    7
    bool = false;
    21
    fetchSupportedAuthenticationMechanisms();
    21
    fetchSupportedAuthenticationMechanisms();
    8
    dispose();
    Differences
    Expression1Expression2Difference
    fetchSupportedAuthenticationMechanismsdisposeMETHOD_INVOCATION_NAME_MISMATCH
    Preondition Violations
    Expression fetchSupportedAuthenticationMechanisms() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    • Inline private method fetchSupportedAuthenticationMechanisms
    Expression fetchSupportedAuthenticationMechanisms() is a void method call, and thus it cannot be parameterized
    Expression dispose() is a void method call, and thus it cannot be parameterized
    8
    dispose();
    22
    else if (action.equals("SAVE"))
    9
    else if (action.equals("SAVE"))
    23
    if (!storePasswordCheckBox.isSelected())
    23
    if (!storePasswordCheckBox.isSelected())
    10
    if (!checkbox.isSelected())
    Differences
    Expression1Expression2Difference
    storePasswordCheckBoxcheckboxVARIABLE_NAME_MISMATCH
    10
    if (!checkbox.isSelected())
    24
    return;
    24
    return;
    11
    return;
    Preondition Violations
    Conditional return;
    Conditional return;
    11
    return;
    else
    else
    25
    File configPath = DefaultConfigDirectory.getInstance().getCurrentPath();
    12
    File configPath = DefaultConfigDirectory.getInstance().getCurrentPath();
    26
    File defaultConfigPath = DefaultConfigDirectory.getDefaultPath();
    13
    File defaultConfigPath = DefaultConfigDirectory.getDefaultPath();
    27
    while (!configPath.equals(defaultConfigPath))
    14
    while (!configPath.equals(defaultConfigPath))
    28
    configPath = configPath.getParentFile();
    15
    configPath = configPath.getParentFile();
    29
    if (configPath == null)
    16
    if (configPath == null)
    30
    JOptionPane.showMessageDialog(dialog, MailResourceLoader.getString("dialog", "password", "warn_save_msg"), MailResourceLoader.getString("dialog", "password", "warn_save_title"), JOptionPane.WARNING_MESSAGE);
    30
    JOptionPane.showMessageDialog(dialog, MailResourceLoader.getString("dialog", "password", "warn_save_msg"), MailResourceLoader.getString("dialog", "password", "warn_save_title"), JOptionPane.WARNING_MESSAGE);
    17
    JOptionPane.showMessageDialog(this, MailResourceLoader.getString("dialog", "password", "warn_save_msg"), MailResourceLoader.getString("dialog", "password", "warn_save_title"), JOptionPane.WARNING_MESSAGE);
    Differences
    Expression1Expression2Difference
    javax.swing.JDialogorg.columba.mail.gui.util.PasswordDialogSUBCLASS_TYPE_MISMATCH
    dialogthisTYPE_COMPATIBLE_REPLACEMENT
    17
    JOptionPane.showMessageDialog(this, MailResourceLoader.getString("dialog", "password", "warn_save_msg"), MailResourceLoader.getString("dialog", "password", "warn_save_title"), JOptionPane.WARNING_MESSAGE);
    31
    return;
    31
    return;
    18
    return;
    Preondition Violations
    Conditional return;
    Conditional return;
    18
    return;
    Precondition Violations (9)
    Row Violation
    1Unmatched statement bool=false; cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    2Expression fetchSupportedAuthenticationMechanisms() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Expression fetchSupportedAuthenticationMechanisms() is a void method call, and thus it cannot be parameterized
    4Expression dispose() is a void method call, and thus it cannot be parameterized
    5Conditional return;
    6Conditional return;
    7Conditional return;
    8Conditional return;
    9The refactoring of the clones is infeasible, because classes org.columba.mail.gui.config.account.OutgoingServerPanel and org.columba.mail.gui.util.PasswordDialog do not have a common superclass