提交 26f5e81f authored 作者: Thomas Mueller's avatar Thomas Mueller

--no commit message

--no commit message
上级 8e6fb47b
...@@ -12,7 +12,6 @@ import org.h2.engine.Right; ...@@ -12,7 +12,6 @@ import org.h2.engine.Right;
import org.h2.engine.RightOwner; import org.h2.engine.RightOwner;
import org.h2.engine.Role; import org.h2.engine.Role;
import org.h2.engine.Session; import org.h2.engine.Session;
import org.h2.jdbc.JdbcSQLException;
import org.h2.message.Message; import org.h2.message.Message;
import org.h2.table.Table; import org.h2.table.Table;
import org.h2.util.ObjectArray; import org.h2.util.ObjectArray;
...@@ -52,7 +51,7 @@ public class GrantRevoke extends DefineCommand { ...@@ -52,7 +51,7 @@ public class GrantRevoke extends DefineCommand {
roleNames.add(roleName); roleNames.add(roleName);
} }
public void setGranteeName(String granteeName) throws JdbcSQLException { public void setGranteeName(String granteeName) throws SQLException {
Database db = session.getDatabase(); Database db = session.getDatabase();
grantee = db.findUser(granteeName); grantee = db.findUser(granteeName);
if (grantee == null) { if (grantee == null) {
......
...@@ -15,7 +15,6 @@ import org.h2.expression.ExpressionColumn; ...@@ -15,7 +15,6 @@ import org.h2.expression.ExpressionColumn;
import org.h2.expression.ExpressionVisitor; import org.h2.expression.ExpressionVisitor;
import org.h2.expression.Parameter; import org.h2.expression.Parameter;
import org.h2.expression.ValueExpression; import org.h2.expression.ValueExpression;
import org.h2.jdbc.JdbcSQLException;
import org.h2.message.Message; import org.h2.message.Message;
import org.h2.result.LocalResult; import org.h2.result.LocalResult;
import org.h2.result.SortOrder; import org.h2.result.SortOrder;
...@@ -50,7 +49,7 @@ public class SelectUnion extends Query { ...@@ -50,7 +49,7 @@ public class SelectUnion extends Query {
this.unionType = type; this.unionType = type;
} }
public void setRight(Query select) throws JdbcSQLException { public void setRight(Query select) throws SQLException {
right = select; right = select;
} }
......
...@@ -21,7 +21,6 @@ import org.h2.constant.SysProperties; ...@@ -21,7 +21,6 @@ import org.h2.constant.SysProperties;
import org.h2.index.Cursor; import org.h2.index.Cursor;
import org.h2.index.Index; import org.h2.index.Index;
import org.h2.index.IndexType; import org.h2.index.IndexType;
import org.h2.jdbc.JdbcSQLException;
import org.h2.log.LogSystem; import org.h2.log.LogSystem;
import org.h2.log.UndoLogRecord; import org.h2.log.UndoLogRecord;
import org.h2.message.Message; import org.h2.message.Message;
...@@ -378,7 +377,7 @@ public class Database implements DataHandler { ...@@ -378,7 +377,7 @@ public class Database implements DataHandler {
return store; return store;
} }
public void checkFilePasswordHash(String c, byte[] hash) throws JdbcSQLException { public void checkFilePasswordHash(String c, byte[] hash) throws SQLException {
if (!ByteUtils.compareSecure(hash, filePasswordHash) || !StringUtils.equals(c, cipher)) { if (!ByteUtils.compareSecure(hash, filePasswordHash) || !StringUtils.equals(c, cipher)) {
throw Message.getSQLException(ErrorCode.WRONG_USER_OR_PASSWORD); throw Message.getSQLException(ErrorCode.WRONG_USER_OR_PASSWORD);
} }
......
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
42S21=Doppelter Feldname {0} 42S21=Doppelter Feldname {0}
42S22=Feld {0} nicht gefunden 42S22=Feld {0} nicht gefunden
42S32=Einstellung {0} nicht gefunden 42S32=Einstellung {0} nicht gefunden
90000=Funktion {0} muss einen Zeilen zur\u00FCckgeben 90000=Funktion {0} muss Zeilen zur\u00FCckgeben
90001=Methode nicht zul\u00E4ssig f\u00FCr eine Abfrage. Erlaubt sind execute oder executeQuery, nicht jedoch executeUpdate 90001=Methode nicht zul\u00E4ssig f\u00FCr eine Abfrage. Erlaubt sind execute oder executeQuery, nicht jedoch executeUpdate
90002=Methode nur zul\u00E4ssig for eine Abfrage. Erlaubt sind execute oder executeUpdate, nicht jedoch executeQuery 90002=Methode nur zul\u00E4ssig for eine Abfrage. Erlaubt sind execute oder executeUpdate, nicht jedoch executeQuery
90003=Hexadezimal Zahl mit einer ungeraden Anzahl Zeichen\: {0} 90003=Hexadezimal Zahl mit einer ungeraden Anzahl Zeichen\: {0}
......
...@@ -17,7 +17,6 @@ import org.h2.engine.DbObjectBase; ...@@ -17,7 +17,6 @@ import org.h2.engine.DbObjectBase;
import org.h2.engine.Session; import org.h2.engine.Session;
import org.h2.engine.User; import org.h2.engine.User;
import org.h2.index.Index; import org.h2.index.Index;
import org.h2.jdbc.JdbcSQLException;
import org.h2.message.Message; import org.h2.message.Message;
import org.h2.message.Trace; import org.h2.message.Trace;
import org.h2.table.Table; import org.h2.table.Table;
...@@ -222,7 +221,7 @@ public class Schema extends DbObjectBase { ...@@ -222,7 +221,7 @@ public class Schema extends DbObjectBase {
return table; return table;
} }
public Index getIndex(String name) throws JdbcSQLException { public Index getIndex(String name) throws SQLException {
Index index = (Index) indexes.get(name); Index index = (Index) indexes.get(name);
if (index == null) { if (index == null) {
throw Message.getSQLException(ErrorCode.INDEX_NOT_FOUND_1, name); throw Message.getSQLException(ErrorCode.INDEX_NOT_FOUND_1, name);
......
...@@ -9,7 +9,6 @@ import java.sql.SQLException; ...@@ -9,7 +9,6 @@ import java.sql.SQLException;
import org.h2.constant.ErrorCode; import org.h2.constant.ErrorCode;
import org.h2.engine.DbObject; import org.h2.engine.DbObject;
import org.h2.engine.Session; import org.h2.engine.Session;
import org.h2.jdbc.JdbcSQLException;
import org.h2.message.Message; import org.h2.message.Message;
import org.h2.message.Trace; import org.h2.message.Trace;
import org.h2.table.Table; import org.h2.table.Table;
...@@ -44,8 +43,8 @@ public class Sequence extends SchemaObjectBase { ...@@ -44,8 +43,8 @@ public class Sequence extends SchemaObjectBase {
return increment; return increment;
} }
public void setIncrement(long inc) throws JdbcSQLException { public void setIncrement(long inc) throws SQLException {
if (increment == 0) { if (inc == 0) {
throw Message.getSQLException(ErrorCode.INVALID_VALUE_2, new String[] { "0", "INCREMENT" }, null); throw Message.getSQLException(ErrorCode.INVALID_VALUE_2, new String[] { "0", "INCREMENT" }, null);
} }
this.increment = inc; this.increment = inc;
......
...@@ -17,7 +17,6 @@ import java.util.Properties; ...@@ -17,7 +17,6 @@ import java.util.Properties;
import org.h2.constant.ErrorCode; import org.h2.constant.ErrorCode;
import org.h2.constant.SysProperties; import org.h2.constant.SysProperties;
import org.h2.jdbc.JdbcSQLException;
import org.h2.message.Message; import org.h2.message.Message;
import org.h2.message.Trace; import org.h2.message.Trace;
import org.h2.message.TraceSystem; import org.h2.message.TraceSystem;
...@@ -314,7 +313,7 @@ public class FileLock { ...@@ -314,7 +313,7 @@ public class FileLock {
return Message.getSQLException(ErrorCode.DATABASE_ALREADY_OPEN_1, reason); return Message.getSQLException(ErrorCode.DATABASE_ALREADY_OPEN_1, reason);
} }
public static int getFileLockMethod(String method) throws JdbcSQLException { public static int getFileLockMethod(String method) throws SQLException {
if (method == null || method.equalsIgnoreCase("FILE")) { if (method == null || method.equalsIgnoreCase("FILE")) {
return FileLock.LOCK_FILE; return FileLock.LOCK_FILE;
} else if (method.equalsIgnoreCase("NO")) { } else if (method.equalsIgnoreCase("NO")) {
......
...@@ -50,17 +50,25 @@ public class ByteUtils { ...@@ -50,17 +50,25 @@ public class ByteUtils {
} }
len /= 2; len /= 2;
byte[] buff = new byte[len]; byte[] buff = new byte[len];
try { for (int i = 0; i < len; i++) {
for (int i = 0; i < len; i++) { buff[i] = (byte) ((getHexDigit(s, i + i) << 4) | getHexDigit(s, i + i + 1));
buff[i] = (byte) ((Character.digit(s.charAt(i + i), 16) << 4) | (Character.digit(s.charAt(i + i + 1),
16)));
}
} catch (NumberFormatException e) {
throw Message.getSQLException(ErrorCode.HEX_STRING_WRONG_1, s);
} }
return buff; return buff;
} }
private static int getHexDigit(String s, int i) throws SQLException {
char c = s.charAt(i);
if (c >= '0' && c <= '9') {
return c - '0';
} else if (c >= 'a' && c <= 'f') {
return c - 'a' + 0xa;
} else if (c >= 'A' && c <= 'F') {
return c - 'A' + 0xa;
} else {
throw Message.getSQLException(ErrorCode.HEX_STRING_WRONG_1, s);
}
}
public static int getByteArrayHash(byte[] value) { public static int getByteArrayHash(byte[] value) {
int h = 1; int h = 1;
for (int i = 0; i < value.length;) { for (int i = 0; i < value.length;) {
......
...@@ -24,7 +24,6 @@ import org.h2.engine.SessionInterface; ...@@ -24,7 +24,6 @@ import org.h2.engine.SessionInterface;
import org.h2.jdbc.JdbcBlob; import org.h2.jdbc.JdbcBlob;
import org.h2.jdbc.JdbcClob; import org.h2.jdbc.JdbcClob;
import org.h2.jdbc.JdbcConnection; import org.h2.jdbc.JdbcConnection;
import org.h2.jdbc.JdbcSQLException;
import org.h2.message.Message; import org.h2.message.Message;
import org.h2.util.ObjectArray; import org.h2.util.ObjectArray;
import org.h2.util.ObjectUtils; import org.h2.util.ObjectUtils;
...@@ -740,7 +739,7 @@ public class DataType { ...@@ -740,7 +739,7 @@ public class DataType {
} }
public static Object convertTo(SessionInterface session, JdbcConnection conn, Value v, Class paramClass) public static Object convertTo(SessionInterface session, JdbcConnection conn, Value v, Class paramClass)
throws JdbcSQLException { throws SQLException {
if (paramClass == java.sql.Blob.class) { if (paramClass == java.sql.Blob.class) {
return new JdbcBlob(session, conn, v, 0); return new JdbcBlob(session, conn, v, 0);
} else if (paramClass == Clob.class) { } else if (paramClass == Clob.class) {
......
...@@ -150,6 +150,8 @@ java org.h2.test.TestAll timer ...@@ -150,6 +150,8 @@ java org.h2.test.TestAll timer
/* /*
orphan?
javadoc: design patterns javadoc: design patterns
sourceforge h2 database sourceforge h2 database
update wikipedia update wikipedia
...@@ -164,6 +166,8 @@ Roadmap: ...@@ -164,6 +166,8 @@ Roadmap:
Move Maven 2 repository from hsql.sf.net to h2database.sf.net Move Maven 2 repository from hsql.sf.net to h2database.sf.net
History: History:
The exception "Hexadecimal string contains non-hex character" was not always thrown when it should have been. Fixed.
The H2 Console now provides a link to the documentation when an error occurs (H2 databases only so far).
Test Recovery with MAX_LOG_FILE_SIZE=1; test with various log file sizes Test Recovery with MAX_LOG_FILE_SIZE=1; test with various log file sizes
......
...@@ -113,7 +113,11 @@ public class TestFileSystem extends TestBase { ...@@ -113,7 +113,11 @@ public class TestFileSystem extends TestBase {
random.nextBytes(buffer); random.nextBytes(buffer);
fo.write(buffer, 0, 10000); fo.write(buffer, 0, 10000);
fo.close(); fo.close();
check(fs.getLastModified(fsBase + "/test") >= time); long lastMod = fs.getLastModified(fsBase + "/test");
if (lastMod < time - 999) {
// at most 1 second difference
check(lastMod, time);
}
check(fs.length(fsBase + "/test"), 10000); check(fs.length(fsBase + "/test"), 10000);
list = fs.listFiles(fsBase); list = fs.listFiles(fsBase);
check(list.length, 1); check(list.length, 1);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论