public class ConnectCommand implements ICommand { private static final StringManager s_stringMgr = StringManagerFactory.getStringManager(ConnectCommand.class); private final ISession _session; private final WebServicePreferences _prefs; private final WebServiceSessionProperties _sessionProps; public ConnectCommand(ISession session, WebServicePreferences prefs, WebServiceSessionProperties sessionProps) { super(); if (session == null) { throw new IllegalArgumentException("ISession == null"); } if (prefs == null) { throw new IllegalArgumentException("WebServicePreferences == null"); } if (sessionProps == null) { throw new IllegalArgumentException("WebServiceSessionProperties == null"); } _session = session; _prefs = prefs; _sessionProps = sessionProps; } /** * Connect to the web service. */ public void execute() throws BaseException { 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)
public class DisconnectCommand implements ICommand { private static final StringManager s_stringMgr = StringManagerFactory.getStringManager(DisconnectCommand.class); private final ISession _session; private final WebServicePreferences _prefs; private final WebServiceSessionProperties _sessionProps; public DisconnectCommand(ISession session, WebServicePreferences prefs, WebServiceSessionProperties sessionProps) { super(); if (session == null) { throw new IllegalArgumentException("ISession == null"); } if (prefs == null) { throw new IllegalArgumentException("WebServicePreferences == null"); } if (sessionProps == null) { throw new IllegalArgumentException("WebServiceSessionProperties == null"); } _session = session; _prefs = prefs; _sessionProps = sessionProps; } /** * Disconnect from the web service. */ public void execute() throws BaseException { 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)
Clone fragments detected by clone detection tool
File path: /sql12/plugins/sqlval/src/net/sourceforge/squirrel_sql/plugins/sqlval/cmd/ConnectCommand.java File path: /sql12/plugins/sqlval/src/net/sourceforge/squirrel_sql/plugins/sqlval/cmd/DisconnectCommand.java
Method name: Method name:
Number of AST nodes: 0 Number of AST nodes: 0
1
public class ConnectCommand implements ICommand
1
public class DisconnectCommand implements ICommand
2
{
2
{
3
	private static final StringManager s_stringMgr =
3
	private static final StringManager s_stringMgr =
4
		StringManagerFactory.getStringManager(ConnectCommand.class);
4
		StringManagerFactory.getStringManager(DisconnectCommand.class);
5
	private final ISession _session;
5
	private final ISession _session;
6
	private final WebServicePreferences _prefs;
6
	private final WebServicePreferences _prefs;
7
	private final WebServiceSessionProperties _sessionProps;
7
	private final WebServiceSessionProperties _sessionProps;
8
	public ConnectCommand(ISession session, WebServicePreferences prefs,
8
	public DisconnectCommand(ISession session, WebServicePreferences prefs,
9
							WebServiceSessionProperties sessionProps)
9
				WebServiceSessionProperties sessionProps)
10
	{
10
	{
11
		super();
11
		super();
12
		if (session == null)
12
		if (session == null)
13
		{
13
		{
14
			throw new IllegalArgumentException("ISession == null");
14
			throw new IllegalArgumentException("ISession == null");
15
		}
15
		}
16
		if (prefs == null)
16
		if (prefs == null)
17
		{
17
		{
18
			throw new IllegalArgumentException("WebServicePreferences == null");
18
			throw new IllegalArgumentException("WebServicePreferences == null");
19
		}
19
		}
20
		if (sessionProps == null)
20
		if (sessionProps == null)
21
		{
21
		{
22
			throw new IllegalArgumentException("WebServiceSessionProperties == null");
22
			throw new IllegalArgumentException("WebServiceSessionProperties == null");
23
		}
23
		}
24
		_session = session;
24
		_session = session;
25
		_prefs = prefs;
25
		_prefs = prefs;
26
		_sessionProps = sessionProps;
26
		_sessionProps = sessionProps;
27
	}
27
	}
28
	/**
28
	/**
29
	 * Connect to the web service.
29
	 * Disconnect from the web service.
30
	 */
30
	 */
31
	public void execute() throws BaseException
31
	public void execute() throws BaseException
32
	{
32
	{
33
		try
33
		try
34
		{
34
		{
35
			final WebServiceSession wss = _sessionProps.getWebServiceSession();
35
			final WebServiceSession wss = _sessionProps.getWebServiceSession();
36
			if (!wss.isOpen())
36
			if (wss.isOpen())
37
			{
37
			{
38
				wss.open();
38
				wss.close();
39
				// i18n[sqlval.connected=Connected to the SQL Validation web service]
39
				// i18n[sqlval.disconnected=Disconnected from the SQL Validation web service]
40
				_session.showMessage(s_stringMgr.getString("sqlval.connected"));
40
				_session.showMessage(s_stringMgr.getString("sqlval.disconnected"));
41
			}
41
			}
42
		}
42
		}
43
		catch (Throwable th)
43
		catch (Throwable th)
44
		{
44
		{
45
			throw new BaseException(th)
45
			throw new BaseException(th)
Summary
Number of common nesting structure subtrees0
Number of refactorable cases0
Number of non-refactorable cases0
Time elapsed for finding largest common nesting structure subtrees (ms)0.0
Clones location
Number of node comparisons0