if (_transIsolation != null) { try { conn.setTransactionIsolation(_transIsolation.intValue()); } catch (SQLException ex) { s_log.error("Error restoring transaction isolation", ex); if (msgHandler == null) { throw ex; } msgHandler.showErrorMessage(ex, null); } }
if (_catalog != null) { try { conn.setCatalog(_catalog); } catch (SQLException ex) { s_log.error("Error restoring current catalog", ex); if (msgHandler == null) { throw ex; } msgHandler.showErrorMessage(ex, null); } }
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 restoreState(ISQLConnection, IMessageHandler) Method name: void restoreState(ISQLConnection, IMessageHandler)
Number of AST nodes: 3 Number of AST nodes: 3
1
if (_transIsolation != null)
1
if (_catalog != null)
2
		{
2
		{
3
			try
3
			try
4
			{
4
			{
5
				conn.setTransactionIsolation(_transIsolation.intValue());
5
				conn.setCatalog(_catalog);
6
			}
6
			}
7
			catch (SQLException ex)
7
			catch (SQLException ex)
8
			{
8
			{
9
				s_log.error("Error restoring transaction isolation", ex);
9
				s_log.error("Error restoring current catalog", ex);
10
				if (msgHandler == null)
10
				if (msgHandler == null)
11
				{
11
				{
12
					throw ex;
12
					throw ex;
13
				}
13
				}
14
				msgHandler.showErrorMessage(ex, null);
14
				msgHandler.showErrorMessage(ex, null);
15
			}
15
			}
16
		}
16
		}
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.5
Clones locationClones are in the same method
Number of node comparisons5
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements2
    Number of unmapped statements in the first code fragment1
    Number of unmapped statements in the second code fragment1
    Time elapsed for statement mapping (ms)1.0
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    3
    if (_transIsolation != null)
    3
    if (_transIsolation != null)
    6
    if (_catalog != null)
    Differences
    Expression1Expression2Difference
    _transIsolation_catalogVARIABLE_NAME_MISMATCH
    java.lang.Integerjava.lang.StringVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.lang.Integer of variable _transIsolation does not match with type java.lang.String of variable _catalog
    • Make classes java.lang.Integer and java.lang.String extend a common superclass
    6
    if (_catalog != null)
    4
    try
    4
    try
    7
    try
    Differences
    Expression1Expression2Difference
    "Error restoring transaction isolation""Error restoring current catalog"LITERAL_VALUE_MISMATCH
    7
    try
    5
    conn.setTransactionIsolation(_transIsolation.intValue());
    5
    conn.setTransactionIsolation(_transIsolation.intValue());
    Preondition Violations
    Unmatched statement conn.setTransactionIsolation(_transIsolation.intValue()); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    Unmatched statement conn.setTransactionIsolation(_transIsolation.intValue()); 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
    conn.setCatalog(_catalog);
    Preondition Violations
    Unmatched statement conn.setCatalog(_catalog); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    Unmatched statement conn.setCatalog(_catalog); 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
    conn.setCatalog(_catalog);
    Precondition Violations (5)
    Row Violation
    1Type java.lang.Integer of variable _transIsolation does not match with type java.lang.String of variable _catalog
    2Unmatched statement conn.setTransactionIsolation(_transIsolation.intValue()); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    3Unmatched statement conn.setTransactionIsolation(_transIsolation.intValue()); 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 conn.setCatalog(_catalog); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    5Unmatched statement conn.setCatalog(_catalog); 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