View | Details | Raw Unified | Return to bug 17388
Collapse All | Expand All

(-)jakarta-taglibs/standard/src/org/apache/taglibs/standard/tag/common/sql/QueryTagSupport.java (-1 / +10 lines)
Lines 210-224 Link Here
210
	 * if it was from the ResultSet.
210
	 * if it was from the ResultSet.
211
          */
211
          */
212
	PreparedStatement ps = null;
212
	PreparedStatement ps = null;
213
	ResulstSet        rs = null;
213
	try {
214
	try {
214
	    ps = conn.prepareStatement(sqlStatement);
215
	    ps = conn.prepareStatement(sqlStatement);
215
	    setParameters(ps, parameters);
216
	    setParameters(ps, parameters);
216
	    ResultSet rs = ps.executeQuery();
217
	    rs = ps.executeQuery();
217
	    result = new ResultImpl(rs, startRow, maxRows);
218
	    result = new ResultImpl(rs, startRow, maxRows);
218
	}
219
	}
219
	catch (Throwable e) {
220
	catch (Throwable e) {
220
	    throw new JspException(sqlStatement + ": " + e.getMessage(), e);
221
	    throw new JspException(sqlStatement + ": " + e.getMessage(), e);
221
	} finally {
222
	} finally {
223
	    if (rs != null) {
224
		try {
225
		    rs.close();
226
		} catch (SQLException sqe) {
227
		    throw new JspException(sqe.getMessage(), sqe);
228
		}
229
	    }
230
222
	    if (ps != null) {
231
	    if (ps != null) {
223
		try {
232
		try {
224
		    ps.close();
233
		    ps.close();
(-)jakarta-taglibs/standard-1.0/src/org/apache/taglibs/standard/tag/common/sql/QueryTagSupport.java (-2 / +21 lines)
Lines 209-224 Link Here
209
	 * value for isLimitedByMaxRows(); there's no way to check
209
	 * value for isLimitedByMaxRows(); there's no way to check
210
	 * if it was from the ResultSet.
210
	 * if it was from the ResultSet.
211
          */
211
          */
212
	PreparedStatement ps = null;
213
	ResultSet         rs = null;
212
	try {
214
	try {
213
	    PreparedStatement ps = conn.prepareStatement(sqlStatement);
215
	    ps = conn.prepareStatement(sqlStatement);
214
	    setParameters(ps, parameters);
216
	    setParameters(ps, parameters);
215
	    ResultSet rs = ps.executeQuery();
217
	    rs = ps.executeQuery();
216
	    result = new ResultImpl(rs, startRow, maxRows);
218
	    result = new ResultImpl(rs, startRow, maxRows);
217
            ps.close();
219
            ps.close();
218
	}
220
	}
219
	catch (Throwable e) {
221
	catch (Throwable e) {
220
	    throw new JspException(sqlStatement + ": " + e.getMessage(), e);
222
	    throw new JspException(sqlStatement + ": " + e.getMessage(), e);
221
	}
223
	}
224
	finally {
225
	    if (rs != null) {
226
		try {
227
		    rs.close();
228
		} catch (SQLException e) {
229
		    throw new JspException(e.getMessage(), e);
230
		}
231
	    }
232
233
	    if (ps != null) {
234
		try {
235
		    ps.close();
236
		} catch (SQLException e) {
237
		    throw new JspException(e.getMessage(), e);
238
		}
239
	    }
240
	}
222
	pageContext.setAttribute(var, result, scope);
241
	pageContext.setAttribute(var, result, scope);
223
	return EVAL_PAGE;
242
	return EVAL_PAGE;
224
    }
243
    }

Return to bug 17388