提交 93c4c62d authored 作者: noelgrandin@gmail.com's avatar noelgrandin@gmail.com

fix some javadoc @throws comments

上级 21d04c85
...@@ -93,7 +93,7 @@ public abstract class Command implements CommandInterface { ...@@ -93,7 +93,7 @@ public abstract class Command implements CommandInterface {
* Execute an updating statement, if this is possible. * Execute an updating statement, if this is possible.
* *
* @return the update count * @return the update count
* @throws SQLException if the command is not an updating statement * @throws DbException if the command is not an updating statement
*/ */
public int update() { public int update() {
throw DbException.get(ErrorCode.METHOD_NOT_ALLOWED_FOR_QUERY); throw DbException.get(ErrorCode.METHOD_NOT_ALLOWED_FOR_QUERY);
...@@ -104,7 +104,7 @@ public abstract class Command implements CommandInterface { ...@@ -104,7 +104,7 @@ public abstract class Command implements CommandInterface {
* *
* @param maxrows the maximum number of rows returned * @param maxrows the maximum number of rows returned
* @return the local result set * @return the local result set
* @throws SQLException if the command is not a query * @throws DbException if the command is not a query
*/ */
public ResultInterface query(int maxrows) { public ResultInterface query(int maxrows) {
throw DbException.get(ErrorCode.METHOD_ONLY_ALLOWED_FOR_QUERY); throw DbException.get(ErrorCode.METHOD_ONLY_ALLOWED_FOR_QUERY);
...@@ -126,7 +126,7 @@ public abstract class Command implements CommandInterface { ...@@ -126,7 +126,7 @@ public abstract class Command implements CommandInterface {
/** /**
* Check if this command has been canceled, and throw an exception if yes. * Check if this command has been canceled, and throw an exception if yes.
* *
* @throws SQLException if the statement has been canceled * @throws DbException if the statement has been canceled
*/ */
protected void checkCanceled() { protected void checkCanceled() {
if (cancel) { if (cancel) {
......
...@@ -153,7 +153,7 @@ public abstract class Prepared { ...@@ -153,7 +153,7 @@ public abstract class Prepared {
/** /**
* Check if all parameters have been set. * Check if all parameters have been set.
* *
* @throws SQLException if any parameter has not been set * @throws DbException if any parameter has not been set
*/ */
protected void checkParameters() { protected void checkParameters() {
if (parameters != null) { if (parameters != null) {
...@@ -195,7 +195,7 @@ public abstract class Prepared { ...@@ -195,7 +195,7 @@ public abstract class Prepared {
* Execute the statement. * Execute the statement.
* *
* @return the update count * @return the update count
* @throws SQLException if it is a query * @throws DbException if it is a query
*/ */
public int update() { public int update() {
throw DbException.get(ErrorCode.METHOD_NOT_ALLOWED_FOR_QUERY); throw DbException.get(ErrorCode.METHOD_NOT_ALLOWED_FOR_QUERY);
...@@ -206,7 +206,7 @@ public abstract class Prepared { ...@@ -206,7 +206,7 @@ public abstract class Prepared {
* *
* @param maxrows the maximum number of rows to return * @param maxrows the maximum number of rows to return
* @return the result set * @return the result set
* @throws SQLException if it is not a query * @throws DbException if it is not a query
*/ */
public ResultInterface query(int maxrows) { public ResultInterface query(int maxrows) {
throw DbException.get(ErrorCode.METHOD_ONLY_ALLOWED_FOR_QUERY); throw DbException.get(ErrorCode.METHOD_ONLY_ALLOWED_FOR_QUERY);
...@@ -269,7 +269,7 @@ public abstract class Prepared { ...@@ -269,7 +269,7 @@ public abstract class Prepared {
/** /**
* Check if this statement was canceled. * Check if this statement was canceled.
* *
* @throws SQLException if it was canceled * @throws DbException if it was canceled
*/ */
public void checkCanceled() { public void checkCanceled() {
session.checkCanceled(); session.checkCanceled();
......
...@@ -894,7 +894,7 @@ public class Database implements DataHandler { ...@@ -894,7 +894,7 @@ public class Database implements DataHandler {
* *
* @param name the user name * @param name the user name
* @return the user * @return the user
* @throws SQLException if the user does not exist * @throws DbException if the user does not exist
*/ */
public User getUser(String name) { public User getUser(String name) {
User user = findUser(name); User user = findUser(name);
...@@ -909,7 +909,7 @@ public class Database implements DataHandler { ...@@ -909,7 +909,7 @@ public class Database implements DataHandler {
* *
* @param user the user * @param user the user
* @return the session * @return the session
* @throws SQLException if the database is in exclusive mode * @throws DbException if the database is in exclusive mode
*/ */
synchronized Session createSession(User user) { synchronized Session createSession(User user) {
if (exclusiveSession != null) { if (exclusiveSession != null) {
...@@ -1433,7 +1433,7 @@ public class Database implements DataHandler { ...@@ -1433,7 +1433,7 @@ public class Database implements DataHandler {
* *
* @param schemaName the name of the schema * @param schemaName the name of the schema
* @return the schema * @return the schema
* @throws SQLException no schema with that name exists * @throws DbException no schema with that name exists
*/ */
public Schema getSchema(String schemaName) { public Schema getSchema(String schemaName) {
Schema schema = findSchema(schemaName); Schema schema = findSchema(schemaName);
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
package org.h2.engine; package org.h2.engine;
import java.util.ArrayList; import java.util.ArrayList;
import org.h2.message.DbException;
import org.h2.table.Table; import org.h2.table.Table;
/** /**
...@@ -167,7 +168,7 @@ public interface DbObject { ...@@ -167,7 +168,7 @@ public interface DbObject {
/** /**
* Check if renaming is allowed. Does nothing when allowed. * Check if renaming is allowed. Does nothing when allowed.
* *
* @throws SQLException if renaming is not allowed * @throws DbException if renaming is not allowed
*/ */
void checkRename(); void checkRename();
......
...@@ -255,7 +255,7 @@ public class Engine implements SessionFactory { ...@@ -255,7 +255,7 @@ public class Engine implements SessionFactory {
* stack trace to see if the user name was wrong or the password. * stack trace to see if the user name was wrong or the password.
* *
* @param correct if the user name or the password was correct * @param correct if the user name or the password was correct
* @throws SQLException the exception 'wrong user or password' * @throws DbException the exception 'wrong user or password'
*/ */
private void validateUserAndPassword(boolean correct) { private void validateUserAndPassword(boolean correct) {
int min = SysProperties.DELAY_WRONG_PASSWORD_MIN; int min = SysProperties.DELAY_WRONG_PASSWORD_MIN;
......
...@@ -205,7 +205,7 @@ public class Session extends SessionWithState { ...@@ -205,7 +205,7 @@ public class Session extends SessionWithState {
* Add a local temporary table to this session. * Add a local temporary table to this session.
* *
* @param table the table to add * @param table the table to add
* @throws SQLException if a table with this name already exists * @throws DbException if a table with this name already exists
*/ */
public void addLocalTempTable(Table table) { public void addLocalTempTable(Table table) {
if (localTempTables == null) { if (localTempTables == null) {
...@@ -256,7 +256,7 @@ public class Session extends SessionWithState { ...@@ -256,7 +256,7 @@ public class Session extends SessionWithState {
* Add a local temporary index to this session. * Add a local temporary index to this session.
* *
* @param index the index to add * @param index the index to add
* @throws SQLException if a index with this name already exists * @throws DbException if a index with this name already exists
*/ */
public void addLocalTempTableIndex(Index index) { public void addLocalTempTableIndex(Index index) {
if (localTempTableIndexes == null) { if (localTempTableIndexes == null) {
...@@ -313,7 +313,7 @@ public class Session extends SessionWithState { ...@@ -313,7 +313,7 @@ public class Session extends SessionWithState {
* Add a local temporary constraint to this session. * Add a local temporary constraint to this session.
* *
* @param constraint the constraint to add * @param constraint the constraint to add
* @throws SQLException if a constraint with the same name already exists * @throws DbException if a constraint with the same name already exists
*/ */
public void addLocalTempTableConstraint(Constraint constraint) { public void addLocalTempTableConstraint(Constraint constraint) {
if (localTempTableConstraints == null) { if (localTempTableConstraints == null) {
...@@ -880,7 +880,7 @@ public class Session extends SessionWithState { ...@@ -880,7 +880,7 @@ public class Session extends SessionWithState {
* Check if the current transaction is canceled by calling * Check if the current transaction is canceled by calling
* Statement.cancel() or because a session timeout was set and expired. * Statement.cancel() or because a session timeout was set and expired.
* *
* @throws SQLException if the transaction is canceled * @throws DbException if the transaction is canceled
*/ */
public void checkCanceled() { public void checkCanceled() {
throttle(); throttle();
......
...@@ -473,7 +473,7 @@ public class SessionRemote extends SessionWithState implements DataHandler { ...@@ -473,7 +473,7 @@ public class SessionRemote extends SessionWithState implements DataHandler {
/** /**
* Check if this session is closed and throws an exception if so. * Check if this session is closed and throws an exception if so.
* *
* @throws SQLException if the session is closed * @throws DbException if the session is closed
*/ */
public void checkClosed() { public void checkClosed() {
if (isClosed()) { if (isClosed()) {
...@@ -522,7 +522,7 @@ public class SessionRemote extends SessionWithState implements DataHandler { ...@@ -522,7 +522,7 @@ public class SessionRemote extends SessionWithState implements DataHandler {
* the server and throws any exception the server sent. * the server and throws any exception the server sent.
* *
* @param transfer the transfer object * @param transfer the transfer object
* @throws SQLException if the server sent an exception * @throws DbException if the server sent an exception
* @throws IOException if there is a communication problem between client * @throws IOException if there is a communication problem between client
* and server * and server
*/ */
......
...@@ -91,7 +91,7 @@ public class User extends RightOwner { ...@@ -91,7 +91,7 @@ public class User extends RightOwner {
* *
* @param table the database object * @param table the database object
* @param rightMask the rights required * @param rightMask the rights required
* @throws SQLException if this user does not have the required rights * @throws DbException if this user does not have the required rights
*/ */
public void checkRight(Table table, int rightMask) { public void checkRight(Table table, int rightMask) {
if (!hasRight(table, rightMask)) { if (!hasRight(table, rightMask)) {
...@@ -192,7 +192,7 @@ public class User extends RightOwner { ...@@ -192,7 +192,7 @@ public class User extends RightOwner {
* Check if this user has admin rights. An exception is thrown if he does * Check if this user has admin rights. An exception is thrown if he does
* not have them. * not have them.
* *
* @throws SQLException if this user is not an admin * @throws DbException if this user is not an admin
*/ */
public void checkAdmin() { public void checkAdmin() {
if (!admin) { if (!admin) {
...@@ -240,7 +240,7 @@ public class User extends RightOwner { ...@@ -240,7 +240,7 @@ public class User extends RightOwner {
* Check that this user does not own any schema. An exception is thrown if he * Check that this user does not own any schema. An exception is thrown if he
* owns one or more schemas. * owns one or more schemas.
* *
* @throws SQLException if this user owns a schema * @throws DbException if this user owns a schema
*/ */
public void checkOwnsNoSchemas() { public void checkOwnsNoSchemas() {
for (Schema s : database.getAllSchemas()) { for (Schema s : database.getAllSchemas()) {
......
...@@ -1546,7 +1546,7 @@ public class Function extends Expression implements FunctionCall { ...@@ -1546,7 +1546,7 @@ public class Function extends Expression implements FunctionCall {
* Check if the parameter count is correct. * Check if the parameter count is correct.
* *
* @param len the number of parameters set * @param len the number of parameters set
* @throws SQLException if the parameter count is incorrect * @throws DbException if the parameter count is incorrect
*/ */
protected void checkParameterCount(int len) { protected void checkParameterCount(int len) {
int min = 0, max = Integer.MAX_VALUE; int min = 0, max = Integer.MAX_VALUE;
...@@ -1612,7 +1612,7 @@ public class Function extends Expression implements FunctionCall { ...@@ -1612,7 +1612,7 @@ public class Function extends Expression implements FunctionCall {
* This method is called after all the parameters have been set. * This method is called after all the parameters have been set.
* It checks if the parameter count is correct. * It checks if the parameter count is correct.
* *
* @throws SQLException if the parameter count is incorrect. * @throws DbException if the parameter count is incorrect.
*/ */
public void doneWithParameters() { public void doneWithParameters() {
if (info.parameterCount == VAR_ARGS) { if (info.parameterCount == VAR_ARGS) {
......
...@@ -107,7 +107,7 @@ public abstract class BaseIndex extends SchemaObjectBase implements Index { ...@@ -107,7 +107,7 @@ public abstract class BaseIndex extends SchemaObjectBase implements Index {
* @param higherThan the lower limit (excluding) * @param higherThan the lower limit (excluding)
* @param last the last row, or null for no limit * @param last the last row, or null for no limit
* @return the cursor * @return the cursor
* @throws SQLException * @throws DbException
*/ */
public Cursor findNext(Session session, SearchRow higherThan, SearchRow last) { public Cursor findNext(Session session, SearchRow higherThan, SearchRow last) {
throw DbException.throwInternalError(); throw DbException.throwInternalError();
......
...@@ -394,7 +394,7 @@ public class Schema extends DbObjectBase { ...@@ -394,7 +394,7 @@ public class Schema extends DbObjectBase {
* @param session the session * @param session the session
* @param name the table or view name * @param name the table or view name
* @return the table or view * @return the table or view
* @throws SQLException if no such object exists * @throws DbException if no such object exists
*/ */
public Table getTableOrView(Session session, String name) { public Table getTableOrView(Session session, String name) {
Table table = tablesAndViews.get(name); Table table = tablesAndViews.get(name);
...@@ -414,7 +414,7 @@ public class Schema extends DbObjectBase { ...@@ -414,7 +414,7 @@ public class Schema extends DbObjectBase {
* *
* @param name the index name * @param name the index name
* @return the index * @return the index
* @throws SQLException if no such object exists * @throws DbException if no such object exists
*/ */
public Index getIndex(String name) { public Index getIndex(String name) {
Index index = indexes.get(name); Index index = indexes.get(name);
...@@ -429,7 +429,7 @@ public class Schema extends DbObjectBase { ...@@ -429,7 +429,7 @@ public class Schema extends DbObjectBase {
* *
* @param name the constraint name * @param name the constraint name
* @return the constraint * @return the constraint
* @throws SQLException if no such object exists * @throws DbException if no such object exists
*/ */
public Constraint getConstraint(String name) { public Constraint getConstraint(String name) {
Constraint constraint = constraints.get(name); Constraint constraint = constraints.get(name);
...@@ -444,7 +444,7 @@ public class Schema extends DbObjectBase { ...@@ -444,7 +444,7 @@ public class Schema extends DbObjectBase {
* *
* @param constantName the constant name * @param constantName the constant name
* @return the constant * @return the constant
* @throws SQLException if no such object exists * @throws DbException if no such object exists
*/ */
public Constant getConstant(String constantName) { public Constant getConstant(String constantName) {
Constant constant = constants.get(constantName); Constant constant = constants.get(constantName);
...@@ -459,7 +459,7 @@ public class Schema extends DbObjectBase { ...@@ -459,7 +459,7 @@ public class Schema extends DbObjectBase {
* *
* @param sequenceName the sequence name * @param sequenceName the sequence name
* @return the sequence * @return the sequence
* @throws SQLException if no such object exists * @throws DbException if no such object exists
*/ */
public Sequence getSequence(String sequenceName) { public Sequence getSequence(String sequenceName) {
Sequence sequence = sequences.get(sequenceName); Sequence sequence = sequences.get(sequenceName);
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
package org.h2.store; package org.h2.store;
import java.sql.Connection; import java.sql.Connection;
import org.h2.message.DbException;
import org.h2.util.SmallLRUCache; import org.h2.util.SmallLRUCache;
import org.h2.util.TempFileDeleter; import org.h2.util.TempFileDeleter;
...@@ -37,14 +38,14 @@ public interface DataHandler { ...@@ -37,14 +38,14 @@ public interface DataHandler {
* Check if the simulated power failure occurred. * Check if the simulated power failure occurred.
* This call will decrement the countdown. * This call will decrement the countdown.
* *
* @throws SQLException if the simulated power failure occurred * @throws DbException if the simulated power failure occurred
*/ */
void checkPowerOff(); void checkPowerOff();
/** /**
* Check if writing is allowed. * Check if writing is allowed.
* *
* @throws SQLException if it is not allowed * @throws DbException if it is not allowed
*/ */
void checkWritingAllowed(); void checkWritingAllowed();
...@@ -52,7 +53,7 @@ public interface DataHandler { ...@@ -52,7 +53,7 @@ public interface DataHandler {
* Free up disk space if possible. * Free up disk space if possible.
* This method is called if more space is needed. * This method is called if more space is needed.
* *
* @throws SQLException if no more space could be freed * @throws DbException if no more space could be freed
*/ */
void freeUpDiskSpace(); void freeUpDiskSpace();
......
...@@ -121,7 +121,7 @@ public class FileLock implements Runnable { ...@@ -121,7 +121,7 @@ public class FileLock implements Runnable {
* Lock the file if possible. A file may only be locked once. * Lock the file if possible. A file may only be locked once.
* *
* @param fileLockMethod the file locking method to use * @param fileLockMethod the file locking method to use
* @throws SQLException if locking was not successful * @throws DbException if locking was not successful
*/ */
public synchronized void lock(int fileLockMethod) { public synchronized void lock(int fileLockMethod) {
this.fs = FileSystem.getInstance(fileName); this.fs = FileSystem.getInstance(fileName);
...@@ -461,7 +461,7 @@ public class FileLock implements Runnable { ...@@ -461,7 +461,7 @@ public class FileLock implements Runnable {
* *
* @param method the method name * @param method the method name
* @return the method type * @return the method type
* @throws SQLException if the method name is unknown * @throws DbException if the method name is unknown
*/ */
public static int getFileLockMethod(String method) { public static int getFileLockMethod(String method) {
if (method == null || method.equalsIgnoreCase("FILE")) { if (method == null || method.equalsIgnoreCase("FILE")) {
......
...@@ -479,7 +479,7 @@ public abstract class Table extends SchemaObjectBase { ...@@ -479,7 +479,7 @@ public abstract class Table extends SchemaObjectBase {
* *
* @param session the session * @param session the session
* @param col the column * @param col the column
* @throws SQLException if the column is referenced by multi-column * @throws DbException if the column is referenced by multi-column
* constraints or indexes * constraints or indexes
*/ */
public void dropSingleColumnConstraintsAndIndexes(Session session, Column col) { public void dropSingleColumnConstraintsAndIndexes(Session session, Column col) {
...@@ -577,7 +577,7 @@ public abstract class Table extends SchemaObjectBase { ...@@ -577,7 +577,7 @@ public abstract class Table extends SchemaObjectBase {
* *
* @param columnName the column name * @param columnName the column name
* @return the column * @return the column
* @throws SQLException if the column was not found * @throws DbException if the column was not found
*/ */
public Column getColumn(String columnName) { public Column getColumn(String columnName) {
Column column = columnMap.get(columnName); Column column = columnMap.get(columnName);
......
...@@ -263,7 +263,7 @@ public class Utils { ...@@ -263,7 +263,7 @@ public class Utils {
* *
* @param data the byte array * @param data the byte array
* @return the object * @return the object
* @throws SQLException * @throws DbException if serialization fails
*/ */
public static Object deserialize(byte[] data) { public static Object deserialize(byte[] data) {
try { try {
......
...@@ -1041,7 +1041,7 @@ public abstract class Value { ...@@ -1041,7 +1041,7 @@ public abstract class Value {
* *
* @param op the operation * @param op the operation
* @return never returns normally * @return never returns normally
* @throws the exception * @throws DbException the exception
*/ */
protected DbException throwUnsupportedExceptionForType(String op) { protected DbException throwUnsupportedExceptionForType(String op) {
throw DbException.getUnsupportedException(DataType.getDataType(getType()).name + " " + op); throw DbException.getUnsupportedException(DataType.getDataType(getType()).name + " " + op);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论