try { _transIsolation = Integer.valueOf(conn.getTransactionIsolation()); } catch (SQLException ex) { String msg = "Error saving transaction isolation.\n" + "This might happen when reconnecting a Session to restore a broken connection.\n" + "The new connection will use the default transaction isolation."; s_log.error(msg, ex); if (msgHandler == null) { throw ex; } msgHandler.showErrorMessage(msg); }
try { // In case the connection won't be able to tell its Auto Commit state, // this is the best default we have. _autoCommit = sessionProperties.getAutoCommit(); _autoCommit = conn.getAutoCommit(); } catch (SQLException ex) { String msg = "Error saving autocommit state.\n" + "This might happen when reconnecting a Session to restore a broken connection.\n" + "The new connection will use the autocommit state."; s_log.error(msg, ex); if (msgHandler == null) { throw ex; } msgHandler.showErrorMessage(msg); }
Clone fragments detected by clone detection tool
File path: /sql12/fw/src/net/sourceforge/squirrel_sql/fw/sql/SQLConnectionState.java File path: /sql12/fw/src/net/sourceforge/squirrel_sql/fw/sql/SQLConnectionState.java
Method name: void saveState(ISQLConnection, ISessionProperties, IMessageHandler) Method name: void saveState(ISQLConnection, ISessionProperties, IMessageHandler)
Number of AST nodes: 2 Number of AST nodes: 3
1
try
1
try
2
		{
2
		{
3
			_transIsolation = Integer.valueOf(conn.getTransactionIsolation()
3
         // In case the connection won't be able to tell its Auto Commit state,
4
         // this is the best default we have.
5
         _autoCommit = sessionProperties.getAutoCommit();
4
);
6
         _autoCommit = conn.getAutoCommit();
5
		}
7
		}
6
		catch (SQLException ex)
8
		catch (SQLException ex)
7
		{
9
		{
8
			String msg =
10
			String msg =
9
				"Error saving transaction isolation.\n" +
11
				"Error saving autocommit state.\n" +
10
				"This might happen when reconnecting a Session to restore a broken connection.\n" +
12
				"This might happen when reconnecting a Session to restore a broken connection.\n" +
11
				"The new connection will use the default transaction isolation.";
13
				"The new connection will use the autocommit state.";
12
			s_log.error(msg, ex);
14
			s_log.error(msg, ex);
13
			if (msgHandler == null)
15
			if (msgHandler == null)
14
			{
16
			{
15
				throw ex;
17
				throw ex;
16
			}
18
			}
17
			msgHandler.showErrorMessage(msg);
19
			msgHandler.showErrorMessage(msg);
18
		}
20
		}
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.4
Clones locationClones are in the same method
Number of node comparisons6
  1. {Refactorable}
    Mapping Summary
    Number of mapped statements1
    Number of unmapped statements in the first code fragment1
    Number of unmapped statements in the second code fragment2
    Time elapsed for statement mapping (ms)0.9
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
    3
    try
    3
    try
    7
    try
    Differences
    Expression1Expression2Difference
    "The new connection will use the default transaction isolation.""The new connection will use the autocommit state."LITERAL_VALUE_MISMATCH
    "Error saving transaction isolation.\n""Error saving autocommit state.\n"LITERAL_VALUE_MISMATCH
    7
    try
    4
    _transIsolation = Integer.valueOf(conn.getTransactionIsolation());
    4
    _transIsolation = Integer.valueOf(conn.getTransactionIsolation());
    Preondition Violations
    Unmatched statement _transIsolation=Integer.valueOf(conn.getTransactionIsolation()); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    Unmatched statement _transIsolation=Integer.valueOf(conn.getTransactionIsolation()); 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
                                                                                                                                          
                                                                                                      
    8
    _autoCommit = sessionProperties.getAutoCommit();
    Preondition Violations
    Unmatched statement _autoCommit=sessionProperties.getAutoCommit(); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    8
    _autoCommit = sessionProperties.getAutoCommit();
                                                                            
    9
    _autoCommit = conn.getAutoCommit();
    Preondition Violations
    Unmatched statement _autoCommit=conn.getAutoCommit(); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    Unmatched statement _autoCommit=conn.getAutoCommit(); 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
    9
    _autoCommit = conn.getAutoCommit();
    Precondition Violations (5)
    Row Violation
    1Unmatched statement _transIsolation=Integer.valueOf(conn.getTransactionIsolation()); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    2Unmatched statement _transIsolation=Integer.valueOf(conn.getTransactionIsolation()); 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
    3Unmatched statement _autoCommit=sessionProperties.getAutoCommit(); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    4Unmatched statement _autoCommit=conn.getAutoCommit(); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    5Unmatched statement _autoCommit=conn.getAutoCommit(); 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