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: 9 | Number of AST nodes: 9 | |||
1 | if ( log.isWarnEnabled() ) {↵ | 1 | if ( log.isErrorEnabled() ) {↵ | |
2 | if ( log.isDebugEnabled() && warning != null ) {↵ | 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 | } | 16 |
| |
See real code fragment | See real code fragment |
Number of common nesting structure subtrees | 1 |
Number of refactorable cases | 0 |
Number of non-refactorable cases | 1 |
Time elapsed for finding largest common nesting structure subtrees (ms) | 0.2 |
Clones location | Clones are declared in the same class |
Number of node comparisons | 29 |
Number of mapped statements | 6 |
Number of unmapped statements in the first code fragment | 3 |
Number of unmapped statements in the second code fragment | 3 |
Time elapsed for statement mapping (ms) | 2.9 |
Clone type | Type 3 |
ID | Statement | ID | Statement | |||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | if (log.isWarnEnabled()) |
| 1 | if (log.isErrorEnabled()) | ||||||||||||||||||||||||
| 2 | if (log.isDebugEnabled()) | ||||||||||||||||||||||||||
| 3 | message = StringHelper.isNotEmpty(message) ? message : DEFAULT_EXCEPTION_MSG; | ||||||||||||||||||||||||||
| 4 | log.debug(message, ex); | ||||||||||||||||||||||||||
2 | if (log.isDebugEnabled() && warning != null) | | ||||||||||||||||||||||||||
3 | message = StringHelper.isNotEmpty(message) ? message : DEFAULT_WARNING_MSG; | | ||||||||||||||||||||||||||
4 | log.debug(message, warning); | | ||||||||||||||||||||||||||
5 | while (warning != null) |
| 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 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.error(ex.getMessage()); | ||||||||||||||||||||||||
9 | warning = warning.getNextWarning(); |
| 9 | ex = ex.getNextException(); |
Row | Violation |
---|---|
1 | Expression log.warn(warning.getMessage()) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
2 | Expression log.error(ex.getMessage()) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
3 | Expression log.warn(warning.getMessage()) is a void method call, and thus it cannot be parameterized |
4 | Expression log.error(ex.getMessage()) is a void method call, and thus it cannot be parameterized |
5 | Expression warning.getNextWarning() cannot be parameterized, because it has dependencies to/from statements that will be extracted |
6 | Expression ex.getNextException() cannot be parameterized, because it has dependencies to/from statements that will be extracted |