提交 4e085985 authored 作者: Thomas Mueller's avatar Thomas Mueller

--no commit message

--no commit message
上级 efb95058
......@@ -31,7 +31,7 @@ Downloads
<a href="http://www.h2database.com/h2-${stableVersionDate}.zip">Platform-Independent Zip</a><br />
</p>
<h3>Download Older Versions</h3>
<h3>Download Mirror and Older Versions</h3>
<p>
<a href="http://code.google.com/p/h2database/downloads/list">Platform-Independent Zip</a><br />
</p>
......
......@@ -44,7 +44,7 @@ Welcome to H2, the Java SQL database. The main feature of H2 are:
<tr><td style="border: 0px; background-color: #eee;">
<a href="http://www.h2database.com/h2-${versionDate}.zip"><img border="1" src="images/download.png" alt="download" /></a>
</td><td style="vertical-align: middle; border: 0px; background-color: #eee;">
<a href="http://www.h2database.com/h2-${versionDate}.zip">All platforms (zip, 4.6 MB)</a>
<a href="http://www.h2database.com/h2-${versionDate}.zip">All platforms (zip, 4.7 MB)</a>
</td></tr>
<tr><td style="border: 0px; background-color: #eee;" colspan="2">
<a href="download.html">All Downloads (including Stable)</a>
......
......@@ -215,7 +215,7 @@ public class RuleFixed implements Rule {
default:
throw new Error("type=" + type);
}
if (s == query) {
if (s.equals(query)) {
return false;
}
sentence.setQuery(s);
......
......@@ -64,7 +64,7 @@ public class RuleRepeat implements Rule {
String old = sentence.getQuery();
while (true) {
rule.addNextTokenList(sentence);
if (!rule.matchRemove(sentence) || old == sentence.getQuery()) {
if (!rule.matchRemove(sentence) || old.equals(sentence.getQuery())) {
break;
}
}
......
......@@ -183,7 +183,7 @@ public class Sentence {
* @param query the query string
*/
public void setQuery(String query) {
if (this.query != query) {
if (!this.query.equals(query)) {
this.query = query;
this.queryUpper = StringUtils.toUpperEnglish(query);
}
......
......@@ -235,8 +235,8 @@ public class CommandRemote implements CommandInterface {
trace.error("close", e);
}
}
session = null;
}
session = null;
int len = parameters.size();
try {
for (int i = 0; i < len; i++) {
......
......@@ -299,8 +299,8 @@ public class JdbcConnection extends TraceObject implements Connection {
return;
}
session.cancel();
synchronized (session) {
try {
try {
synchronized (session) {
if (!session.isClosed()) {
try {
rollbackInternal();
......@@ -319,9 +319,9 @@ public class JdbcConnection extends TraceObject implements Connection {
session.close();
}
}
} finally {
session = null;
}
} finally {
session = null;
}
} catch (Exception e) {
throw logAndConvert(e);
......
......@@ -144,16 +144,16 @@ public class ResultRemote implements ResultInterface {
return;
}
// TODO result sets: no reset possible for larger remote result sets
synchronized (session) {
try {
try {
synchronized (session) {
session.traceOperation("RESULT_CLOSE", id);
transfer.writeInt(SessionRemote.RESULT_CLOSE).writeInt(id);
} catch (IOException e) {
session.getTrace().error("close", e);
} finally {
transfer = null;
session = null;
}
} catch (IOException e) {
session.getTrace().error("close", e);
} finally {
transfer = null;
session = null;
}
}
......
......@@ -667,7 +667,6 @@ public class TestLob extends TestBase {
checkStream(new ByteArrayInputStream(data), rs.getBinaryStream("TEXT"), -1);
prep = conn.prepareStatement("UPDATE TEST SET TEXT = ?");
s = new String(getRandomChars(10201, 1));
prep.setBinaryStream(1, new ByteArrayInputStream(data), 0);
prep.execute();
......
......@@ -152,10 +152,9 @@ public class TestMultiConn extends TestBase implements DatabaseEventListener {
}
public void setProgress(int state, String name, int x, int max) {
while (wait > 0) {
if (wait > 0) {
try {
Thread.sleep(wait);
wait = 0;
} catch (InterruptedException e) {
TestBase.logError("sleep", e);
}
......
......@@ -27,7 +27,7 @@ public class TestCancel extends TestBase {
/**
* This thread cancels a statement after some time.
*/
class CancelThread extends Thread {
static class CancelThread extends Thread {
private Statement cancel;
private int wait;
private volatile boolean stop;
......
......@@ -35,6 +35,15 @@ public class TestResultSet extends TestBase {
private Connection conn;
private Statement stat;
/**
* Run just this test.
*
* @param a ignored
*/
public static void main(String[] a) throws Exception {
TestBase.createCaller().init().test();
}
public void test() throws SQLException {
deleteDb("resultSet");
......@@ -654,8 +663,8 @@ public class TestResultSet extends TestBase {
assertEquals(date.getTime(), java.sql.Timestamp.valueOf("2011-11-11 00:00:00.0").getTime());
assertEquals(time.getTime(), java.sql.Timestamp.valueOf("1970-01-01 00:00:00.0").getTime());
assertEquals(ts.getTime(), java.sql.Timestamp.valueOf("2011-11-11 00:00:00.0").getTime());
assertTrue(date.equals(java.sql.Timestamp.valueOf("2011-11-11 00:00:00.0")));
assertTrue(time.equals(java.sql.Timestamp.valueOf("1970-01-01 00:00:00.0")));
assertTrue(date.equals(java.sql.Date.valueOf("2011-11-11")));
assertTrue(time.equals(java.sql.Time.valueOf("00:00:00")));
assertTrue(ts.equals(java.sql.Timestamp.valueOf("2011-11-11 00:00:00.0")));
assertFalse(rs.wasNull());
o = rs.getObject(2);
......
......@@ -295,7 +295,7 @@ public class TestRecover {
int id = rs.getInt("ID");
String name = rs.getString("NAME");
int value = Integer.parseInt(name);
if (value % 2 == 1) {
if (value % 2 == 0) {
throw new Exception("unexpected odd entry " + id);
}
max = Math.max(max, id);
......
......@@ -77,7 +77,7 @@ public class TestHaltApp extends TestHalt {
rs.next();
int count = rs.getInt(1);
System.out.println("count: " + count);
if (count % 2 == 1) {
if (count % 2 == 0) {
traceOperation("row count: " + count);
throw new SQLException("Unexpected odd row count");
}
......
......@@ -60,7 +60,7 @@ public class TestThreads extends TestBase implements Runnable {
for (int i = 0; i < threadCount; i++) {
String table = random.nextBoolean() ? null : getRandomTable();
int op = random.nextInt(OP_TYPES);
op = i % 2 == 1 ? RECONNECT : CHECKPOINT;
op = i % 2 == 0 ? RECONNECT : CHECKPOINT;
threads[i] = new Thread(new TestThreads(this, op, table));
}
for (int i = 0; i < threadCount; i++) {
......
......@@ -62,12 +62,14 @@ public class FtpClient {
private void readLine() throws IOException {
message = reader.readLine();
int idx = message.indexOf(' ');
if (idx < 0) {
code = 0;
} else {
code = Integer.parseInt(message.substring(0, idx));
message = message.substring(idx + 1);
if (message != null) {
int idx = message.indexOf(' ');
if (idx < 0) {
code = 0;
} else {
code = Integer.parseInt(message.substring(0, idx));
message = message.substring(idx + 1);
}
}
}
......
......@@ -203,7 +203,7 @@ public class TestServlet extends TestBase {
// listener must be stopped
try {
conn2 = DriverManager.getConnection("jdbc:h2:tcp://localhost:8888/" + baseDir + "/servlet", getUser(), getPassword());
DriverManager.getConnection("jdbc:h2:tcp://localhost:8888/" + baseDir + "/servlet", getUser(), getPassword());
fail();
} catch (SQLException e) {
assertKnownException(e);
......
......@@ -49,7 +49,7 @@ public class TestStringCache extends TestBase {
private void runBenchmark() {
returnNew = false;
for (int i = 0; i < 6; i++) {
useIntern = (i % 2) == 1;
useIntern = (i % 2) == 0;
long time = System.currentTimeMillis();
testSingleThread(100000);
time = System.currentTimeMillis() - time;
......
......@@ -93,7 +93,7 @@ public class TestTools extends TestBase {
result = runServer(new String[]{"-tcpShutdown", "ssl://localhost:9001", "-tcpPassword", "abcdef"}, 0);
assertTrue(result.indexOf("Shutting down") >= 0);
try {
conn = DriverManager.getConnection("jdbc:h2:ssl://localhost:9001/mem:", "sa", "sa");
DriverManager.getConnection("jdbc:h2:ssl://localhost:9001/mem:", "sa", "sa");
fail();
} catch (SQLException e) {
assertKnownException(e);
......@@ -418,7 +418,7 @@ public class TestTools extends TestBase {
conn = DriverManager.getConnection("jdbc:h2:tcp://localhost:9192/test", "sa", "");
conn.close();
server.stop();
server = Server.createTcpServer(
Server.createTcpServer(
new String[] { "-ifExists", "-tcpPassword", "abc", "-baseDir", baseDir, "-tcpPort", "9192" }).start();
try {
conn = DriverManager.getConnection("jdbc:h2:tcp://localhost:9192/test2", "sa", "");
......
......@@ -278,7 +278,7 @@ public class BuildBase {
File f = (File) files.get(i);
File t = new File(target, removeBase(basePath, f.getPath()));
byte[] data = readFile(f);
t.getParentFile().mkdirs();
mkdirs(t.getParentFile());
writeFile(t, data);
}
}
......@@ -388,7 +388,7 @@ public class BuildBase {
if (targetFile.exists()) {
return;
}
targetFile.getAbsoluteFile().getParentFile().mkdirs();
mkdirs(targetFile.getAbsoluteFile().getParentFile());
ByteArrayOutputStream buff = new ByteArrayOutputStream();
try {
println("Downloading " + fileURL);
......@@ -589,7 +589,7 @@ public class BuildBase {
}
});
}
new File(destFile).getAbsoluteFile().getParentFile().mkdirs();
mkdirs(new File(destFile).getAbsoluteFile().getParentFile());
// normalize the path (replace / with \ if required)
basePath = new File(basePath).getPath();
try {
......@@ -709,12 +709,16 @@ public class BuildBase {
throw new Error("Can not create directory " + dir + " because a file with this name exists");
}
} else {
if (!f.mkdirs()) {
throw new Error("Can not create directory " + dir);
}
mkdirs(f);
}
}
private void mkdirs(File f) {
if (!f.mkdirs()) {
throw new Error("Can not create directory " + f.getAbsolutePath());
}
}
/**
* Delete all files in the given directory and all subdirectories.
*
......
......@@ -85,37 +85,41 @@ public class PropertiesToUTF8 {
return;
}
LineNumberReader reader = new LineNumberReader(new InputStreamReader(new FileInputStream(source), "UTF-8"));
Properties prop = new SortedProperties();
StringBuffer buff = new StringBuffer();
String key = null;
boolean found = false;
while (true) {
String line = reader.readLine();
if (line == null) {
break;
}
line = line.trim();
if (line.length() == 0) {
continue;
}
if (line.startsWith("@")) {
if (key != null) {
prop.setProperty(key, buff.toString());
buff.setLength(0);
try {
Properties prop = new SortedProperties();
StringBuffer buff = new StringBuffer();
String key = null;
boolean found = false;
while (true) {
String line = reader.readLine();
if (line == null) {
break;
}
found = true;
key = line.substring(1);
} else {
if (buff.length() > 0) {
buff.append(System.getProperty("line.separator"));
line = line.trim();
if (line.length() == 0) {
continue;
}
if (line.startsWith("@")) {
if (key != null) {
prop.setProperty(key, buff.toString());
buff.setLength(0);
}
found = true;
key = line.substring(1);
} else {
if (buff.length() > 0) {
buff.append(System.getProperty("line.separator"));
}
buff.append(line);
}
buff.append(line);
}
if (found) {
prop.setProperty(key, buff.toString());
}
storeProperties(prop, target);
} finally {
reader.close();
}
if (found) {
prop.setProperty(key, buff.toString());
}
storeProperties(prop, target);
}
private static void convert(String source) throws Exception {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论