try { final WebServiceSession wss = _sessionProps.getWebServiceSession(); if (wss.isOpen()) { wss.close(); // i18n[sqlval.disconnected=Disconnected from the SQL Validation web service] _session.showMessage(s_stringMgr.getString("sqlval.disconnected")); } } catch (Throwable th) { throw new BaseException(th); }
try { final WebServiceSession wss = _sessionProps.getWebServiceSession(); if (!wss.isOpen()) { wss.open(); // i18n[sqlval.connected=Connected to the SQL Validation web service] _session.showMessage(s_stringMgr.getString("sqlval.connected")); } } catch (Throwable th) { throw new BaseException(th); }
Clone fragments detected by clone detection tool
File path: /sql12/plugins/sqlval/src/net/sourceforge/squirrel_sql/plugins/sqlval/cmd/DisconnectCommand.java File path: /sql12/plugins/sqlval/src/net/sourceforge/squirrel_sql/plugins/sqlval/cmd/ConnectCommand.java
Method name: void execute() Method name: void execute()
Number of AST nodes: 5 Number of AST nodes: 5
1
try
1
try
2
		{
2
		{
3
			final WebServiceSession wss = _sessionProps.getWebServiceSession();
3
			final WebServiceSession wss = _sessionProps.getWebServiceSession();
4
			if (wss.isOpen())
4
			if (!wss.isOpen())
5
			{
5
			{
6
				wss.close();
6
				wss.open();
7
				// i18n[sqlval.disconnected=Disconnected from the SQL Validation web service]
7
				// i18n[sqlval.connected=Connected to the SQL Validation web service]
8
				_session.showMessage(s_stringMgr.getString("sqlval.disconnected"));
8
				_session.showMessage(s_stringMgr.getString("sqlval.connected"));
9
			}
9
			}
10
		}
10
		}
11
		catch (Throwable th)
11
		catch (Throwable th)
12
		{
12
		{
13
			throw new BaseException(th);
13
			throw new BaseException(th);
14
		}
14
		}
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 in different classes
Number of node comparisons13
  1. {Refactorable}
    Mapping Summary
    Number of mapped statements5
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)6.2
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    try
    1
    try
    2
    final WebServiceSession wss = _sessionProps.getWebServiceSession();
    2
    final WebServiceSession wss = _sessionProps.getWebServiceSession();
    3
    if (wss.isOpen())
    3
    if (wss.isOpen())
    3
    if (!wss.isOpen())
    Differences
    Expression1Expression2Difference
    wss.isOpen()!wss.isOpen()TYPE_COMPATIBLE_REPLACEMENT
    Preondition Violations
    Expression wss.isOpen() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression !wss.isOpen() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3
    if (!wss.isOpen())
    4
    wss.close();
    4
    wss.close();
    4
    wss.open();
    Differences
    Expression1Expression2Difference
    closeopenMETHOD_INVOCATION_NAME_MISMATCH
    Preondition Violations
    Expression wss.close() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression wss.open() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression wss.close() is a void method call, and thus it cannot be parameterized
    Expression wss.open() is a void method call, and thus it cannot be parameterized
    4
    wss.open();
    5
    _session.showMessage(s_stringMgr.getString("sqlval.disconnected"));
    5
    _session.showMessage(s_stringMgr.getString("sqlval.disconnected"));
    5
    _session.showMessage(s_stringMgr.getString("sqlval.connected"));
    Differences
    Expression1Expression2Difference
    "sqlval.disconnected""sqlval.connected"LITERAL_VALUE_MISMATCH
    5
    _session.showMessage(s_stringMgr.getString("sqlval.connected"));
    Precondition Violations (6)
    Row Violation
    1Expression wss.isOpen() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression !wss.isOpen() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Expression wss.close() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4Expression wss.open() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    5Expression wss.close() is a void method call, and thus it cannot be parameterized
    6Expression wss.open() is a void method call, and thus it cannot be parameterized