if (writer != null) { try { writer.close(); } catch (Exception e) { s_log.error("closeReader: Unable to close FileWriter - " + e.getMessage(), e); } }
try { con.rollback(); } catch (Exception e) { e.printStackTrace(); }
Clone fragments detected by clone detection tool
File path: /sql12/fw/src/net/sourceforge/squirrel_sql/fw/util/IOUtilitiesImpl.java File path: /sql12/test/mockobjects/net/sourceforge/squirrel_sql/client/session/MockSession.java
Method name: void closeWriter(Writer) Method name: void rollback()
Number of AST nodes: 3 Number of AST nodes: 2
1
if (writer != null)
2
		{
3
			try
4
			{
5
				writer.close();
6
			}
7
			catch (Exception e)
8
			{
9
				s_log.error("closeReader: Unable to close FileWriter - " + e.getMessage(), e);
10
			}
11
		
1
try {
2
            con.rollback();
3
        } catch (Exception e) {
4
            e.printStackTrace();
12
}
5
        }
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.3
Clones locationClones are in different classes
Number of node comparisons4
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements1
    Number of unmapped statements in the first code fragment1
    Number of unmapped statements in the second code fragment1
    Time elapsed for statement mapping (ms)6.3
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    2
    try
    2
    try
    1
    try
    Differences
    Expression1Expression2Difference
    errorprintStackTraceMETHOD_INVOCATION_NAME_MISMATCH
    s_logeVARIABLE_NAME_MISMATCH
    net.sourceforge.squirrel_sql.fw.util.log.ILoggerjava.lang.ExceptionVARIABLE_TYPE_MISMATCH
    s_log.error("closeReader: Unable to close FileWriter - " + e.getMessage(),e)e.printStackTrace()ARGUMENT_NUMBER_MISMATCH
    Preondition Violations
    Expression s_log.error("closeReader: Unable to close FileWriter - " + e.getMessage(),e) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression e.printStackTrace() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression s_log.error("closeReader: Unable to close FileWriter - " + e.getMessage(),e) is a void method call, and thus it cannot be parameterized
    Expression e.printStackTrace() is a void method call, and thus it cannot be parameterized
    Expression e cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Type net.sourceforge.squirrel_sql.fw.util.log.ILogger of variable s_log does not match with type java.lang.Exception of variable e
    • Make classes net.sourceforge.squirrel_sql.fw.util.log.ILogger and java.lang.Exception extend a common superclass
    Expression s_log.error("closeReader: Unable to close FileWriter - " + e.getMessage(),e) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression e.printStackTrace() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression s_log.error("closeReader: Unable to close FileWriter - " + e.getMessage(),e) is a void method call, and thus it cannot be parameterized
    Expression e.printStackTrace() is a void method call, and thus it cannot be parameterized
    1
    try
                                        
    2
    con.rollback();
    Preondition Violations
    Unmatched statement con.rollback(); 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
    2
    con.rollback();
    3
    writer.close();
    3
    writer.close();
    Preondition Violations
    Unmatched statement writer.close(); 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
                                        
    Precondition Violations (13)
    Row Violation
    1Expression s_log.error("closeReader: Unable to close FileWriter - " + e.getMessage(),e) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression e.printStackTrace() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Expression s_log.error("closeReader: Unable to close FileWriter - " + e.getMessage(),e) is a void method call, and thus it cannot be parameterized
    4Expression e.printStackTrace() is a void method call, and thus it cannot be parameterized
    5Expression e cannot be parameterized, because it has dependencies to/from statements that will be extracted
    6Type net.sourceforge.squirrel_sql.fw.util.log.ILogger of variable s_log does not match with type java.lang.Exception of variable e
    7Expression s_log.error("closeReader: Unable to close FileWriter - " + e.getMessage(),e) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    8Expression e.printStackTrace() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    9Expression s_log.error("closeReader: Unable to close FileWriter - " + e.getMessage(),e) is a void method call, and thus it cannot be parameterized
    10Expression e.printStackTrace() is a void method call, and thus it cannot be parameterized
    11Unmatched statement con.rollback(); 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 writer.close(); 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
    13The refactoring of the clones is infeasible, because classes net.sourceforge.squirrel_sql.fw.util.IOUtilitiesImpl and net.sourceforge.squirrel_sql.client.session.MockSession do not have a common superclass