try { final SheetHandler hdl = new SheetHandler(_app, _sqlAlias, _createSession, _callback); if (SwingUtilities.isEventDispatchThread()) { createConnectionInternalFrame(hdl); } else { SwingUtilities.invokeLater(new Runnable() { public void run() { createConnectionInternalFrame(hdl); } }); } } catch (Exception ex) { _app.showErrorDialog(ex); }
try { if (!_fullyCreated) { createUserInterface(destClassName, null); _fullyCreated = true; } Runnable run = new UIUpdater(_viewer, ds); SwingUtilities.invokeLater(run); } catch (Exception ex) { s_log.error("Error", ex); }
Clone fragments detected by clone detection tool
File path: /sql12/app/src/net/sourceforge/squirrel_sql/client/mainframe/action/ConnectToAliasCommand.java File path: /sql12/fw/src/net/sourceforge/squirrel_sql/fw/datasetviewer/DataSetScrollingPanel.java
Method name: void execute() Method name: void load(IDataSet, String)
Number of AST nodes: 5 Number of AST nodes: 6
1
try
1
try
2
		{
2
		{
3
			final SheetHandler hdl = new SheetHandler(_app, _sqlAlias, _createSession, _callback
3
			if (!_fullyCreated)
4
			{
4
);
5
				createUserInterface(destClassName, null);
5
			
6
			
6
            if (SwingUtilities.isEventDispatchThread()) {
7
                createConnectionInternalFrame(hdl);
8
            } else {
9
                SwingUtilities.invokeLater(new Runnable() {
10
                    public void run() {
11
                        createConnectionInternalFrame(hdl);
12
                    }
13
                });
14
            }
7
	_fullyCreated = true;
8
			}
9
			Runnable run = new UIUpdater(_viewer, ds);
10
			SwingUtilities.invokeLater(run);
15
		}
11
		}
16
		catch (Exception ex)
12
		catch (Exception ex)
17
		{
13
		{
18
			_app.showErrorDialog(ex);
14
			s_log.error("Error", ex);
19
		}
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.1
Clones locationClones are in different classes
Number of node comparisons7
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements1
    Number of unmapped statements in the first code fragment4
    Number of unmapped statements in the second code fragment5
    Time elapsed for statement mapping (ms)102.4
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
    1
    try
    1
    try
    1
    try
    Differences
    Expression1Expression2Difference
    showErrorDialogerrorMETHOD_INVOCATION_NAME_MISMATCH
    _apps_logVARIABLE_NAME_MISMATCH
    net.sourceforge.squirrel_sql.client.IApplicationnet.sourceforge.squirrel_sql.fw.util.log.ILoggerVARIABLE_TYPE_MISMATCH
    _app.showErrorDialog(ex)s_log.error("Error",ex)ARGUMENT_NUMBER_MISMATCH
    Preondition Violations
    Expression _app.showErrorDialog(ex) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression s_log.error("Error",ex) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression _app.showErrorDialog(ex) is a void method call, and thus it cannot be parameterized
    Expression s_log.error("Error",ex) is a void method call, and thus it cannot be parameterized
    Type net.sourceforge.squirrel_sql.client.IApplication of variable _app does not match with type net.sourceforge.squirrel_sql.fw.util.log.ILogger of variable s_log
    • Make classes net.sourceforge.squirrel_sql.client.IApplication and net.sourceforge.squirrel_sql.fw.util.log.ILogger extend a common superclass
    Expression _app.showErrorDialog(ex) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression s_log.error("Error",ex) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression _app.showErrorDialog(ex) is a void method call, and thus it cannot be parameterized
    Expression s_log.error("Error",ex) is a void method call, and thus it cannot be parameterized
    1
    try
                                              
    2
    if (!_fullyCreated)
                                                                                          
    3
    createUserInterface(destClassName, null);
    Preondition Violations
    Unmatched statement createUserInterface(destClassName,null); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    Unmatched statement createUserInterface(destClassName,null); 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
    3
    createUserInterface(destClassName, null);
                                                
    4
    _fullyCreated = true;
    Preondition Violations
    Unmatched statement _fullyCreated=true; cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    4
    _fullyCreated = true;
    2
    final SheetHandler hdl = new SheetHandler(_app, _sqlAlias, _createSession, _callback);
    2
    final SheetHandler hdl = new SheetHandler(_app, _sqlAlias, _createSession, _callback);
    Preondition Violations
    Unmatched statement final SheetHandler hdl=new SheetHandler(_app,_sqlAlias,_createSession,_callback); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    Unmatched statement final SheetHandler hdl=new SheetHandler(_app,_sqlAlias,_createSession,_callback); 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
                                                                                                                                                                            
    3
    if (SwingUtilities.isEventDispatchThread())
                                                                                              
    4
    createConnectionInternalFrame(hdl);
                                                                                
    else
            
    5
    SwingUtilities.invokeLater(new Runnable() {...});
                                                                                                                                                                                                                                          
                                                                                        
    5
    Runnable run = new UIUpdater(_viewer, ds);
    Preondition Violations
    Unmatched statement Runnable run=new UIUpdater(_viewer,ds); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    5
    Runnable run = new UIUpdater(_viewer, ds);
                                                                          
    6
    SwingUtilities.invokeLater(run);
    Precondition Violations (16)
    Row Violation
    1Expression _app.showErrorDialog(ex) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression s_log.error("Error",ex) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Expression _app.showErrorDialog(ex) is a void method call, and thus it cannot be parameterized
    4Expression s_log.error("Error",ex) is a void method call, and thus it cannot be parameterized
    5Type net.sourceforge.squirrel_sql.client.IApplication of variable _app does not match with type net.sourceforge.squirrel_sql.fw.util.log.ILogger of variable s_log
    6Expression _app.showErrorDialog(ex) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    7Expression s_log.error("Error",ex) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    8Expression _app.showErrorDialog(ex) is a void method call, and thus it cannot be parameterized
    9Expression s_log.error("Error",ex) is a void method call, and thus it cannot be parameterized
    10Unmatched statement createUserInterface(destClassName,null); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    11Unmatched statement createUserInterface(destClassName,null); 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
    12Unmatched statement _fullyCreated=true; cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    13Unmatched statement final SheetHandler hdl=new SheetHandler(_app,_sqlAlias,_createSession,_callback); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    14Unmatched statement final SheetHandler hdl=new SheetHandler(_app,_sqlAlias,_createSession,_callback); 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
    15Unmatched statement Runnable run=new UIUpdater(_viewer,ds); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    16The refactoring of the clones is infeasible, because classes net.sourceforge.squirrel_sql.client.mainframe.action.ConnectToAliasCommand and net.sourceforge.squirrel_sql.fw.datasetviewer.DataSetScrollingPanel do not have a common superclass