if ( log.isDebugEnabled() && warning != null ) { message = StringHelper.isNotEmpty(message) ? message : DEFAULT_WARNING_MSG; log.debug( message, warning ); } while (warning != null) { StringBuffer buf = new StringBuffer(30) .append( "SQL Warning: ") .append( warning.getErrorCode() ) .append( ", SQLState: ") .append( warning.getSQLState() ); log.warn( buf.toString() ); log.warn( warning.getMessage() ); warning = warning.getNextWarning(); }
if ( log.isErrorEnabled() ) { if ( log.isDebugEnabled() ) { message = StringHelper.isNotEmpty(message) ? message : DEFAULT_EXCEPTION_MSG; log.debug( message, ex ); } while (ex != null) { StringBuffer buf = new StringBuffer(30) .append( "SQL Error: " ) .append( ex.getErrorCode() ) .append( ", SQLState: " ) .append( ex.getSQLState() ); log.warn( buf.toString() ); log.error( ex.getMessage() ); ex = ex.getNextException(); } }
Clone fragments detected by clone detection tool
File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/util/JDBCExceptionReporter.java File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/util/JDBCExceptionReporter.java
Method name: void logWarnings(SQLWarning, String) Method name: void logExceptions(SQLException, String)
Number of AST nodes: 8 Number of AST nodes: 9
1
if ( log.isDebugEnabled() && warning != null
1
if ( log.isErrorEnabled() ) {
2
 ) {
2
			if ( log.isDebugEnabled() ) {
3
				message = StringHelper.isNotEmpty(message) ? message : DEFAULT_WARNING_MSG;
3
				message = StringHelper.isNotEmpty(message) ? message : DEFAULT_EXCEPTION_MSG;
4
				log.debug( message, warning );
4
				log.debug( message, ex );
5
			}
5
			}
6
			while (warning != null) {
6
			while (ex != null) {
7
				StringBuffer buf = new StringBuffer(30)
7
				StringBuffer buf = new StringBuffer(30)
8
				        .append( "SQL Warning: ")
8
						.append( "SQL Error: " )
9
						.append( warning.getErrorCode() )
9
				        .append( ex.getErrorCode() )
10
						.append( ", SQLState: ")
10
				        .append( ", SQLState: " )
11
						.append( warning.getSQLState() );
11
				        .append( ex.getSQLState() );
12
				log.warn( buf.toString() );
12
				log.warn( buf.toString() );
13
				log.warn( warning.getMessage() );
13
				log.error( ex.getMessage() );
14
				warning = warning.getNextWarning();
14
				ex = ex.getNextException();
15
			}
15
			}
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.2
Clones locationClones are declared in the same class
Number of node comparisons29
  1. {Non-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)2.3
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    5
    while (warning != null)
    5
    while (warning != null)
    5
    while (ex != null)
    Differences
    Expression1Expression2Difference
    warningexVARIABLE_NAME_MISMATCH
    java.sql.SQLWarningjava.sql.SQLExceptionSUBCLASS_TYPE_MISMATCH
    5
    while (ex != null)
    6
    StringBuffer buf = new StringBuffer(30).append("SQL Warning: ").append(warning.getErrorCode()).append(", SQLState: ").append(warning.getSQLState());
    6
    StringBuffer buf = new StringBuffer(30).append("SQL Warning: ").append(warning.getErrorCode()).append(", SQLState: ").append(warning.getSQLState());
    6
    StringBuffer buf = new StringBuffer(30).append("SQL Error: ").append(ex.getErrorCode()).append(", SQLState: ").append(ex.getSQLState());
    Differences
    Expression1Expression2Difference
    warningexVARIABLE_NAME_MISMATCH
    java.sql.SQLWarningjava.sql.SQLExceptionSUBCLASS_TYPE_MISMATCH
    warningexVARIABLE_NAME_MISMATCH
    java.sql.SQLWarningjava.sql.SQLExceptionSUBCLASS_TYPE_MISMATCH
    "SQL Warning: ""SQL Error: "LITERAL_VALUE_MISMATCH
    6
    StringBuffer buf = new StringBuffer(30).append("SQL Error: ").append(ex.getErrorCode()).append(", SQLState: ").append(ex.getSQLState());
    7
    log.warn(buf.toString());
    7
    log.warn(buf.toString());
    8
    log.warn(warning.getMessage());
    8
    log.warn(warning.getMessage());
    8
    log.error(ex.getMessage());
    Differences
    Expression1Expression2Difference
    warnerrorMETHOD_INVOCATION_NAME_MISMATCH
    warningexVARIABLE_NAME_MISMATCH
    java.sql.SQLWarningjava.sql.SQLExceptionSUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Expression log.warn(warning.getMessage()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression log.error(ex.getMessage()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression log.warn(warning.getMessage()) is a void method call, and thus it cannot be parameterized
    Expression log.error(ex.getMessage()) is a void method call, and thus it cannot be parameterized
    8
    log.error(ex.getMessage());
    9
    warning = warning.getNextWarning();
    9
    warning = warning.getNextWarning();
    9
    ex = ex.getNextException();
    Differences
    Expression1Expression2Difference
    warningexVARIABLE_NAME_MISMATCH
    java.sql.SQLWarningjava.sql.SQLExceptionSUBCLASS_TYPE_MISMATCH
    getNextWarninggetNextExceptionMETHOD_INVOCATION_NAME_MISMATCH
    warningexVARIABLE_NAME_MISMATCH
    java.sql.SQLWarningjava.sql.SQLExceptionSUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Expression warning.getNextWarning() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression ex.getNextException() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    9
    ex = ex.getNextException();
    Precondition Violations (6)
    Row Violation
    1Expression log.warn(warning.getMessage()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression log.error(ex.getMessage()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Expression log.warn(warning.getMessage()) is a void method call, and thus it cannot be parameterized
    4Expression log.error(ex.getMessage()) is a void method call, and thus it cannot be parameterized
    5Expression warning.getNextWarning() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    6Expression ex.getNextException() cannot be parameterized, because it has dependencies to/from statements that will be extracted