Author: markt Date: Fri Jul 26 13:47:37 2013 New Revision: 1507310 URL: http://svn.apache.org/r1507310 Log: Make constructors private to ensure creation of DelegatingResultSet instances is always via the static wrapResultSet(...) methods.
Modified: commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp2/DelegatingResultSet.java Modified: commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp2/DelegatingResultSet.java URL: http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp2/DelegatingResultSet.java?rev=1507310&r1=1507309&r2=1507310&view=diff ============================================================================== --- commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp2/DelegatingResultSet.java (original) +++ commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp2/DelegatingResultSet.java Fri Jul 26 13:47:37 2013 @@ -5,9 +5,9 @@ * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -77,12 +77,12 @@ public class DelegatingResultSet extends * @param stmt Statement which created this ResultSet * @param res ResultSet to wrap */ - public DelegatingResultSet(Statement stmt, ResultSet res) { + private DelegatingResultSet(Statement stmt, ResultSet res) { super((AbandonedTrace)stmt); this._stmt = stmt; this._res = res; } - + /** * Create a wrapper for the ResultSet which traces this * ResultSet to the Connection which created it (via, for @@ -91,12 +91,12 @@ public class DelegatingResultSet extends * @param conn Connection which created this ResultSet * @param res ResultSet to wrap */ - public DelegatingResultSet(Connection conn, ResultSet res) { + private DelegatingResultSet(Connection conn, ResultSet res) { super((AbandonedTrace)conn); this._conn = conn; this._res = res; } - + public static ResultSet wrapResultSet(Statement stmt, ResultSet rset) { if(null == rset) { return null; @@ -167,7 +167,7 @@ public class DelegatingResultSet extends } return r; } - + @Override public Statement getStatement() throws SQLException { return _stmt; @@ -209,7 +209,7 @@ public class DelegatingResultSet extends } @Override - public boolean next() throws SQLException + public boolean next() throws SQLException { try { return _res.next(); } catch (SQLException e) { handleException(e); return false; } } @Override