if (url == null) { url = HelpSet.findHelpSet(loader, helpsetName, ".hs", Locale .getDefault()); if (url == null) { // could not find it! JOptionPane.showMessageDialog(FrameManager.getInstance() .getActiveFrame(), "HelpSet not found", "Error", JOptionPane.ERROR_MESSAGE); return; } }
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; } }
Clone fragments detected by clone detection tool
File path: /columba-1.4-src/core/src/main/java/org/columba/core/help/HelpManager.java File path: /columba-1.4-src/mail/src/main/java/org/columba/mail/gui/config/account/OutgoingServerPanel.java
Method name: void HelpManager() Method name: void actionPerformed(ActionEvent)
Number of AST nodes: 5 Number of AST nodes: 5
1
if (url == null) {
2
			url = HelpSet.findHelpSet(loader, helpsetName, ".hs", Locale
3
					.getDefault
1
while (!configPath.equals(defaultConfigPath)) {
4
());
2
					configPath = configPath.getParentFile();
5
			if (url == null) {
3
					if (configPath == null) {
6
				// could not find it!
4
				
7
				JOptionPane.showMessageDialog(FrameManager.getInstance()
5
		JOptionPane.showMessageDialog(
8
						.getActiveFrame(), "HelpSet not found
6
dialog,
7
								MailResourceLoader.getString("dialog",
8
										"password", "warn_save_msg"),
9
",
9
								MailResourceLoader.getString("dialog",
10
						"Error", 
10
										"password", "warn_save_title"),
11
JOptionPane.ERROR_MESSAGE);
11
								JOptionPane.WARNING_MESSAGE);
12
				return;
12
						return;
13
			}
13
			
14
		}
14
		}
15
				}
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.2
Clones locationClones are in different classes
Number of node comparisons11
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements2
    Number of unmapped statements in the first code fragment2
    Number of unmapped statements in the second code fragment2
    Time elapsed for statement mapping (ms)17.0
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    4
    url = HelpSet.findHelpSet(loader, helpsetName, ".hs", Locale.getDefault());
                                                                                                                                                      
                                                                                        
    28
    configPath = configPath.getParentFile();
    Preondition Violations
    Unmatched statement configPath=configPath.getParentFile(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    28
    configPath = configPath.getParentFile();
    5
    if (url == null)
    5
    if (url == null)
    29
    if (configPath == null)
    Differences
    Expression1Expression2Difference
    urlconfigPathVARIABLE_NAME_MISMATCH
    java.net.URLjava.io.FileVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.net.URL of variable url does not match with type java.io.File of variable configPath
    • Make classes java.net.URL and java.io.File extend a common superclass
    29
    if (configPath == null)
    6
    JOptionPane.showMessageDialog(FrameManager.getInstance().getActiveFrame(), "HelpSet not found", "Error", JOptionPane.ERROR_MESSAGE);
    6
    JOptionPane.showMessageDialog(FrameManager.getInstance().getActiveFrame(), "HelpSet not found", "Error", JOptionPane.ERROR_MESSAGE);
    Preondition Violations
    Unmatched statement JOptionPane.showMessageDialog(FrameManager.getInstance().getActiveFrame(),"HelpSet not found","Error",JOptionPane.ERROR_MESSAGE); cannot be moved before or after the extracted code, because it throws exception(s) that should be caught by a try block that will be extracted
                                                                                                                                                                                                                                                                            
                                                                                                                                                                                                                                                                                                                                                                                                                            
    30
    JOptionPane.showMessageDialog(dialog, MailResourceLoader.getString("dialog", "password", "warn_save_msg"), MailResourceLoader.getString("dialog", "password", "warn_save_title"), JOptionPane.WARNING_MESSAGE);
    Preondition Violations
    Unmatched statement JOptionPane.showMessageDialog(dialog,MailResourceLoader.getString("dialog","password","warn_save_msg"),MailResourceLoader.getString("dialog","password","warn_save_title"),JOptionPane.WARNING_MESSAGE); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    Unmatched statement JOptionPane.showMessageDialog(dialog,MailResourceLoader.getString("dialog","password","warn_save_msg"),MailResourceLoader.getString("dialog","password","warn_save_title"),JOptionPane.WARNING_MESSAGE); cannot be moved before or after the extracted code, because it throws exception(s) that should be caught by a try block that will be extracted
    30
    JOptionPane.showMessageDialog(dialog, MailResourceLoader.getString("dialog", "password", "warn_save_msg"), MailResourceLoader.getString("dialog", "password", "warn_save_title"), JOptionPane.WARNING_MESSAGE);
    7
    return;
    7
    return;
    31
    return;
    Preondition Violations
    Conditional return;
    Conditional return;
    31
    return;
    Precondition Violations (7)
    Row Violation
    1Unmatched statement configPath=configPath.getParentFile(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    2Type java.net.URL of variable url does not match with type java.io.File of variable configPath
    3Unmatched statement JOptionPane.showMessageDialog(FrameManager.getInstance().getActiveFrame(),"HelpSet not found","Error",JOptionPane.ERROR_MESSAGE); cannot be moved before or after the extracted code, because it throws exception(s) that should be caught by a try block that will be extracted
    4Unmatched statement JOptionPane.showMessageDialog(dialog,MailResourceLoader.getString("dialog","password","warn_save_msg"),MailResourceLoader.getString("dialog","password","warn_save_title"),JOptionPane.WARNING_MESSAGE); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    5Unmatched statement JOptionPane.showMessageDialog(dialog,MailResourceLoader.getString("dialog","password","warn_save_msg"),MailResourceLoader.getString("dialog","password","warn_save_title"),JOptionPane.WARNING_MESSAGE); cannot be moved before or after the extracted code, because it throws exception(s) that should be caught by a try block that will be extracted
    6Conditional return;
    7Conditional return;