try { boolean result = getResultSet().first(); prepareCurrentRow(result); return result; } catch (SQLException sqle) { throw JDBCExceptionHelper.convert( getSession().getFactory().getSQLExceptionConverter(), sqle, "could not advance using first()" ); }
try { boolean result = getResultSet().last(); prepareCurrentRow(result); return result; } catch (SQLException sqle) { throw JDBCExceptionHelper.convert( getSession().getFactory().getSQLExceptionConverter(), sqle, "could not advance using last()" ); }
Clone fragments detected by clone detection tool
File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/impl/ScrollableResultsImpl.java File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/impl/ScrollableResultsImpl.java
Method name: boolean first() Method name: boolean last()
Number of AST nodes: 4 Number of AST nodes: 4
1
try {
1
try {
2
			boolean result = getResultSet().first();
2
			boolean result = getResultSet().last();
3
			prepareCurrentRow(result);
3
			prepareCurrentRow(result);
4
			return result;
4
			return result;
5
		}
5
		}
6
		catch (SQLException sqle) {
6
		catch (SQLException sqle) {
7
			throw JDBCExceptionHelper.convert(
7
			throw JDBCExceptionHelper.convert(
8
					getSession().getFactory().getSQLExceptionConverter(),
8
					getSession().getFactory().getSQLExceptionConverter(),
9
					sqle,
9
					sqle,
10
					"could not advance using first()"
10
					"could not advance using last()"
11
				);
11
				);
12
		}
12
		}
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.3
Clones locationClones are declared in the same class
Number of node comparisons16
  1. {Refactorable}
    Mapping Summary
    Number of mapped statements4
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)0.6
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    try
    1
    try
    1
    try
    Differences
    Expression1Expression2Difference
    "could not advance using first()""could not advance using last()"LITERAL_VALUE_MISMATCH
    1
    try
    2
    boolean result = getResultSet().first();
    2
    boolean result = getResultSet().first();
    2
    boolean result = getResultSet().last();
    Differences
    Expression1Expression2Difference
    firstlastMETHOD_INVOCATION_NAME_MISMATCH
    2
    boolean result = getResultSet().last();
    3
    prepareCurrentRow(result);
    3
    prepareCurrentRow(result);
    4
    return result;
    4
    return result;
    Precondition Violations (0)
    Row Violation