提交 1538a750 authored 作者: noelgrandin@gmail.com's avatar noelgrandin@gmail.com

remove unnecessary throws clauses from methods

上级 88109360
......@@ -237,7 +237,7 @@ public class JdbcArray extends TraceObject implements Array {
return rs;
}
private void checkClosed() throws SQLException {
private void checkClosed() {
conn.checkClosed();
if (value == null) {
throw DbException.get(ErrorCode.OBJECT_CLOSED);
......
......@@ -313,7 +313,7 @@ public class JdbcBlob extends TraceObject implements Blob {
throw unsupported("LOB update");
}
private void checkClosed() throws SQLException {
private void checkClosed() {
conn.checkClosed();
if (value == null) {
throw DbException.get(ErrorCode.OBJECT_CLOSED);
......
......@@ -1510,7 +1510,7 @@ public class JdbcCallableStatement extends JdbcPreparedStatement implements Call
return meta;
}
private void checkIndexBounds(int parameterIndex) throws SQLException {
private void checkIndexBounds(int parameterIndex) {
checkClosed();
if (parameterIndex < 1 || parameterIndex > maxOutParameters) {
throw DbException.getInvalidValueException("parameterIndex", parameterIndex);
......
......@@ -260,7 +260,7 @@ public class JdbcClob extends TraceObject implements Clob
}
//## Java 1.6 end ##
private void checkClosed() throws SQLException {
private void checkClosed() {
conn.checkClosed();
if (value == null) {
throw DbException.get(ErrorCode.OBJECT_CLOSED);
......
......@@ -1332,9 +1332,9 @@ public class JdbcConnection extends TraceObject implements Connection {
* Check if this connection is closed.
* The next operation is a read request.
*
* @throws SQLException if the connection or session is closed
* @throws DbException if the connection or session is closed
*/
protected void checkClosed() throws SQLException {
protected void checkClosed() {
checkClosed(false);
}
......@@ -1342,9 +1342,9 @@ public class JdbcConnection extends TraceObject implements Connection {
* Check if this connection is closed.
* The next operation may be a write request.
*
* @throws SQLException if the connection or session is closed
* @throws DbException if the connection or session is closed
*/
private void checkClosedForWrite() throws SQLException {
private void checkClosedForWrite() {
checkClosed(true);
}
......@@ -1353,9 +1353,9 @@ public class JdbcConnection extends TraceObject implements Connection {
* Check if this connection is closed.
*
* @param write if the next operation is possibly writing
* @throws SQLException if the connection or session is closed
* @throws DbException if the connection or session is closed
*/
protected void checkClosed(boolean write) throws SQLException {
protected void checkClosed(boolean write) {
if (session == null) {
throw DbException.get(ErrorCode.OBJECT_CLOSED);
}
......@@ -1380,12 +1380,12 @@ public class JdbcConnection extends TraceObject implements Connection {
}
}
String getURL() throws SQLException {
String getURL() {
checkClosed();
return url;
}
String getUser() throws SQLException {
String getUser() {
checkClosed();
return user;
}
......
......@@ -2737,7 +2737,7 @@ public class JdbcDatabaseMetaData extends TraceObject implements DatabaseMetaDat
// =============================================================
private void checkClosed() throws SQLException {
private void checkClosed() {
conn.checkClosed();
}
......
......@@ -196,7 +196,7 @@ public class JdbcParameterMetaData extends TraceObject implements ParameterMetaD
}
}
private ParameterInterface getParameter(int param) throws SQLException {
private ParameterInterface getParameter(int param) {
checkClosed();
if (param < 1 || param > paramCount) {
throw DbException.getInvalidValueException("param", param);
......@@ -204,7 +204,7 @@ public class JdbcParameterMetaData extends TraceObject implements ParameterMetaD
return parameters.get(param - 1);
}
private void checkClosed() throws SQLException {
private void checkClosed() {
prep.checkClosed();
}
......
......@@ -1262,7 +1262,7 @@ public class JdbcPreparedStatement extends JdbcStatement implements PreparedStat
// =============================================================
private void setParameter(int parameterIndex, Value value) throws SQLException {
private void setParameter(int parameterIndex, Value value) {
checkClosed();
parameterIndex--;
ArrayList<? extends ParameterInterface> parameters = command.getParameters();
......@@ -1505,7 +1505,7 @@ public class JdbcPreparedStatement extends JdbcStatement implements PreparedStat
return getTraceObjectName() + ": " + command;
}
protected boolean checkClosed(boolean write) throws SQLException {
protected boolean checkClosed(boolean write) {
if (super.checkClosed(write)) {
// if the session was re-connected, re-prepare the statement
ArrayList<? extends ParameterInterface> oldParams = command.getParameters();
......
......@@ -2852,7 +2852,7 @@ public class JdbcResultSet extends TraceObject implements ResultSet {
return row;
}
private int getColumnIndex(String columnLabel) throws SQLException {
private int getColumnIndex(String columnLabel) {
checkClosed();
if (columnLabel == null) {
throw DbException.getInvalidValueException("columnLabel", null);
......@@ -2912,7 +2912,7 @@ public class JdbcResultSet extends TraceObject implements ResultSet {
throw DbException.get(ErrorCode.COLUMN_NOT_FOUND_1, columnLabel);
}
private void checkColumnIndex(int columnIndex) throws SQLException {
private void checkColumnIndex(int columnIndex) {
checkClosed();
if (columnIndex < 1 || columnIndex > columnCount) {
throw DbException.getInvalidValueException("columnIndex", columnIndex);
......@@ -2922,9 +2922,9 @@ public class JdbcResultSet extends TraceObject implements ResultSet {
/**
* Check if this result set is closed.
*
* @throws SQLException if it is closed
* @throws DbException if it is closed
*/
void checkClosed() throws SQLException {
void checkClosed() {
if (result == null) {
throw DbException.get(ErrorCode.OBJECT_CLOSED);
}
......@@ -2942,7 +2942,7 @@ public class JdbcResultSet extends TraceObject implements ResultSet {
}
}
private Value get(int columnIndex) throws SQLException {
private Value get(int columnIndex) {
checkColumnIndex(columnIndex);
checkOnValidRow();
Value[] list;
......@@ -2959,17 +2959,17 @@ public class JdbcResultSet extends TraceObject implements ResultSet {
return value;
}
private Value get(String columnLabel) throws SQLException {
private Value get(String columnLabel) {
int columnIndex = getColumnIndex(columnLabel);
return get(columnIndex);
}
private void update(String columnLabel, Value v) throws SQLException {
private void update(String columnLabel, Value v) {
int columnIndex = getColumnIndex(columnLabel);
update(columnIndex, v);
}
private void update(int columnIndex, Value v) throws SQLException {
private void update(int columnIndex, Value v) {
checkUpdatable();
checkColumnIndex(columnIndex);
if (insertRow != null) {
......@@ -3473,12 +3473,12 @@ public class JdbcResultSet extends TraceObject implements ResultSet {
}
}
private Value convertToUnknownValue(Object x) throws SQLException {
private Value convertToUnknownValue(Object x) {
checkClosed();
return DataType.convertToValue(conn.getSession(), x, Value.UNKNOWN);
}
private void checkUpdatable() throws SQLException {
private void checkUpdatable() {
checkClosed();
if (!updatable) {
throw DbException.get(ErrorCode.RESULT_SET_READONLY);
......
......@@ -413,7 +413,7 @@ public class JdbcResultSetMetaData extends TraceObject implements ResultSetMetaD
}
}
private void checkClosed() throws SQLException {
private void checkClosed() {
if (rs != null) {
rs.checkClosed();
}
......@@ -422,7 +422,7 @@ public class JdbcResultSetMetaData extends TraceObject implements ResultSetMetaD
}
}
private void checkColumnIndex(int columnIndex) throws SQLException {
private void checkColumnIndex(int columnIndex) {
checkClosed();
if (columnIndex < 1 || columnIndex > columnCount) {
throw DbException.getInvalidValueException("columnIndex", columnIndex);
......
......@@ -892,9 +892,9 @@ public class JdbcStatement extends TraceObject implements Statement {
* The next operation is a read request.
*
* @return true if the session was re-connected
* @throws SQLException if the connection or session is closed
* @throws DbException if the connection or session is closed
*/
boolean checkClosed() throws SQLException {
boolean checkClosed() {
return checkClosed(false);
}
......@@ -903,9 +903,9 @@ public class JdbcStatement extends TraceObject implements Statement {
* The next operation may be a write request.
*
* @return true if the session was re-connected
* @throws SQLException if the connection or session is closed
* @throws DbException if the connection or session is closed
*/
boolean checkClosedForWrite() throws SQLException {
boolean checkClosedForWrite() {
return checkClosed(true);
}
......@@ -915,9 +915,9 @@ public class JdbcStatement extends TraceObject implements Statement {
*
* @param write if the next operation is possibly writing
* @return true if a reconnect was required
* @throws SQLException if it is closed
* @throws DbException if it is closed
*/
protected boolean checkClosed(boolean write) throws SQLException {
protected boolean checkClosed(boolean write) {
if (conn == null) {
throw DbException.get(ErrorCode.OBJECT_CLOSED);
}
......
......@@ -452,7 +452,7 @@ public class JdbcXAConnection extends TraceObject implements XAConnection, XARes
return isClosed || super.isClosed();
}
protected synchronized void checkClosed(boolean write) throws SQLException {
protected synchronized void checkClosed(boolean write) {
if (isClosed) {
throw DbException.get(ErrorCode.OBJECT_CLOSED);
}
......
......@@ -469,7 +469,7 @@ public class TcpServer implements Service {
* @param sessionId the session id
* @param statementId the statement id
*/
void cancelStatement(String sessionId, int statementId) throws SQLException {
void cancelStatement(String sessionId, int statementId) {
for (TcpServerThread c : New.arrayList(running)) {
if (c != null) {
c.cancelStatement(sessionId, statementId);
......@@ -484,9 +484,9 @@ public class TcpServer implements Service {
*
* @param db the key to test (or database name if no key is used)
* @return the database name
* @throws SQLException if a key is set but doesn't match
* @throws DbException if a key is set but doesn't match
*/
public String checkKeyAndGetDatabaseName(String db) throws SQLException {
public String checkKeyAndGetDatabaseName(String db) {
if (key == null) {
return db;
}
......
......@@ -215,7 +215,7 @@ public class TcpServerThread implements Runnable {
}
}
private void process() throws IOException, SQLException {
private void process() throws IOException {
int operation = transfer.readInt();
switch (operation) {
case SessionRemote.SESSION_PREPARE_READ_PARAMS:
......@@ -402,7 +402,7 @@ public class TcpServerThread implements Runnable {
* @param targetSessionId the session id
* @param statementId the statement to cancel
*/
void cancelStatement(String targetSessionId, int statementId) throws SQLException {
void cancelStatement(String targetSessionId, int statementId) {
if (StringUtils.equals(targetSessionId, this.sessionId)) {
Command cmd = (Command) cache.getObject(statementId, false);
cmd.cancel();
......
......@@ -70,9 +70,8 @@ public class DeleteDbFiles extends Tool {
* @param dir the directory
* @param db the database name (null for all databases)
* @param quiet don't print progress information
* @throws SQLException
*/
public static void execute(String dir, String db, boolean quiet) throws SQLException {
public static void execute(String dir, String db, boolean quiet) {
new DeleteDbFiles().process(dir, db, quiet);
}
......@@ -82,9 +81,8 @@ public class DeleteDbFiles extends Tool {
* @param dir the directory
* @param db the database name (null for all databases)
* @param quiet don't print progress information
* @throws SQLException
*/
private void process(String dir, String db, boolean quiet) throws SQLException {
private void process(String dir, String db, boolean quiet) {
ArrayList<String> files = FileLister.getDatabaseFiles(dir, db, true);
if (files.size() == 0 && !quiet) {
printNoDatabaseFilesFound(dir, db);
......
......@@ -132,9 +132,9 @@ public class Restore extends Tool {
* @param directory the directory name
* @param db the database name (null for all databases)
* @param quiet don't print progress information
* @throws SQLException
* @throws DbException if there is an IOException
*/
public static void execute(String zipFileName, String directory, String db, boolean quiet) throws SQLException {
public static void execute(String zipFileName, String directory, String db, boolean quiet) {
InputStream in = null;
try {
if (!IOUtils.exists(zipFileName)) {
......
......@@ -79,10 +79,10 @@ public class SmallMap {
* @param id the id of the object
* @param ifAvailable only return it if available, otherwise return null
* @return the object or null
* @throws SQLException if isAvailable is false and the object has not been
* @throws DbException if isAvailable is false and the object has not been
* found
*/
public Object getObject(int id, boolean ifAvailable) throws SQLException {
public Object getObject(int id, boolean ifAvailable) {
if (id == cacheId) {
return cache;
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论