提交 1e9832f5 authored 作者: noelgrandin's avatar noelgrandin

remove some dead fields and variables

上级 de91fc28
...@@ -153,7 +153,6 @@ public class TestDateStorage extends TestBase { ...@@ -153,7 +153,6 @@ public class TestDateStorage extends TestBase {
// http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6772689 // http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6772689
java.sql.Date date = java.sql.Date.valueOf(s); java.sql.Date date = java.sql.Date.valueOf(s);
long time = date.getTime(); long time = date.getTime();
int plus = 0;
while (true) { while (true) {
date = new java.sql.Date(time); date = new java.sql.Date(time);
String x = date.toString(); String x = date.toString();
...@@ -161,7 +160,6 @@ public class TestDateStorage extends TestBase { ...@@ -161,7 +160,6 @@ public class TestDateStorage extends TestBase {
break; break;
} }
time += 1000; time += 1000;
plus += 1000;
} }
if (!date.toString().equals(s)) { if (!date.toString().equals(s)) {
println(TimeZone.getDefault().getID() + " " + s + " <> " + date.toString()); println(TimeZone.getDefault().getID() + " " + s + " <> " + date.toString());
......
...@@ -128,7 +128,7 @@ public class TestMultiDimension extends TestBase { ...@@ -128,7 +128,7 @@ public class TestMultiDimension extends TestBase {
long timeMulti = 0, timeRegular = 0; long timeMulti = 0, timeRegular = 0;
int timeMax = getSize(500, 2000); int timeMax = getSize(500, 2000);
Random rand = new Random(1); Random rand = new Random(1);
for (int i = 0; timeMulti < timeMax; i++) { while (timeMulti < timeMax) {
int size = rand.nextInt(max / 10); int size = rand.nextInt(max / 10);
int minX = rand.nextInt(max - size); int minX = rand.nextInt(max - size);
int minY = rand.nextInt(max - size); int minY = rand.nextInt(max - size);
...@@ -199,7 +199,7 @@ public class TestMultiDimension extends TestBase { ...@@ -199,7 +199,7 @@ public class TestMultiDimension extends TestBase {
long timeMulti = 0, timeRegular = 0; long timeMulti = 0, timeRegular = 0;
int timeMax = getSize(500, 2000); int timeMax = getSize(500, 2000);
Random rand = new Random(1); Random rand = new Random(1);
for (int i = 0; timeMulti < timeMax; i++) { while (timeMulti < timeMax) {
int size = rand.nextInt(max / 10); int size = rand.nextInt(max / 10);
int minX = rand.nextInt(max - size); int minX = rand.nextInt(max - size);
int minY = rand.nextInt(max - size); int minY = rand.nextInt(max - size);
......
...@@ -85,7 +85,7 @@ public class TestOpenClose extends TestBase implements DatabaseEventListener { ...@@ -85,7 +85,7 @@ public class TestOpenClose extends TestBase implements DatabaseEventListener {
conn.close(); conn.close();
Thread.sleep(950); Thread.sleep(950);
long time = System.currentTimeMillis(); long time = System.currentTimeMillis();
for (int i = 0; System.currentTimeMillis() - time < 100; i++) { while (System.currentTimeMillis() - time < 100) {
conn = DriverManager.getConnection(url, user, password); conn = DriverManager.getConnection(url, user, password);
conn.close(); conn.close();
} }
......
...@@ -347,23 +347,20 @@ public class TestTableEngines extends TestBase { ...@@ -347,23 +347,20 @@ public class TestTableEngines extends TestBase {
} }
public Cursor find(TableFilter filter, SearchRow first, SearchRow last) { public Cursor find(TableFilter filter, SearchRow first, SearchRow last) {
return find(filter.getSession(), filter.getFilterCondition(), first, last); return find(filter.getFilterCondition());
} }
public Cursor find(Session session, SearchRow first, SearchRow last) { public Cursor find(Session session, SearchRow first, SearchRow last) {
return find(session, null, first, last); return find(null);
} }
/** /**
* Search within the table. * Search within the table.
* *
* @param session the session
* @param filter the table filter (optional) * @param filter the table filter (optional)
* @param first the first row (optional)
* @param last the last row (optional)
* @return the cursor * @return the cursor
*/ */
private Cursor find(Session session, Expression filter, SearchRow first, SearchRow last) { private Cursor find(Expression filter) {
if (filter != null) { if (filter != null) {
row.setValue(1, ValueString.get(filter.getSQL())); row.setValue(1, ValueString.get(filter.getSQL()));
} }
......
...@@ -55,7 +55,7 @@ public class TestTwoPhaseCommit extends TestBase { ...@@ -55,7 +55,7 @@ public class TestTwoPhaseCommit extends TestBase {
stat.execute("CREATE TABLE TEST2(ID INT)"); stat.execute("CREATE TABLE TEST2(ID INT)");
String name = "tx12345678"; String name = "tx12345678";
try { try {
for (int i = 0;; i++) { while (true) {
stat.execute("INSERT INTO TEST2 VALUES(1)"); stat.execute("INSERT INTO TEST2 VALUES(1)");
name += "x"; name += "x";
stat.execute("PREPARE COMMIT " + name); stat.execute("PREPARE COMMIT " + name);
......
...@@ -31,7 +31,6 @@ public class TestPowerOffFs2 extends TestBase { ...@@ -31,7 +31,6 @@ public class TestPowerOffFs2 extends TestBase {
private String password = "sa"; private String password = "sa";
private ArrayList<Connection> connections = New.arrayList(); private ArrayList<Connection> connections = New.arrayList();
private ArrayList<String> tables = New.arrayList(); private ArrayList<String> tables = New.arrayList();
private int openCount;
/** /**
* Run just this test. * Run just this test.
...@@ -84,7 +83,6 @@ public class TestPowerOffFs2 extends TestBase { ...@@ -84,7 +83,6 @@ public class TestPowerOffFs2 extends TestBase {
private void testCrash(int x) throws SQLException { private void testCrash(int x) throws SQLException {
connections.clear(); connections.clear();
tables.clear(); tables.clear();
openCount = 0;
Random random = new Random(x); Random random = new Random(x);
for (int i = 0;; i++) { for (int i = 0;; i++) {
if (i > 200 && connections.size() > 1 && tables.size() > 1) { if (i > 200 && connections.size() > 1 && tables.size() > 1) {
...@@ -167,7 +165,6 @@ public class TestPowerOffFs2 extends TestBase { ...@@ -167,7 +165,6 @@ public class TestPowerOffFs2 extends TestBase {
} }
private Connection openConnection() throws SQLException { private Connection openConnection() throws SQLException {
openCount++;
Connection conn = DriverManager.getConnection(url, user, password); Connection conn = DriverManager.getConnection(url, user, password);
connections.add(conn); connections.add(conn);
return conn; return conn;
......
...@@ -126,7 +126,7 @@ public class TestThreads extends TestBase implements Runnable { ...@@ -126,7 +126,7 @@ public class TestThreads extends TestBase implements Runnable {
ResultSet rs; ResultSet rs;
int max = master.getMaxId(); int max = master.getMaxId();
int rid = random.nextInt(max); int rid = random.nextInt(max);
for (int i = 0; !master.stop; i++) { while (!master.stop) {
switch (type) { switch (type) {
case INSERT: case INSERT:
max = master.incrementMaxId(); max = master.incrementMaxId();
......
...@@ -88,12 +88,10 @@ public class TestCache extends TestBase implements CacheWriter { ...@@ -88,12 +88,10 @@ public class TestCache extends TestBase implements CacheWriter {
int rc; int rc;
prep = conn.prepareStatement("select * from test where id = ?"); prep = conn.prepareStatement("select * from test where id = ?");
rc = getReadCount(stat); rc = getReadCount(stat);
int p = 0;
for (int x = 0; x < 2; x++) { for (int x = 0; x < 2; x++) {
for (int i = 0; i < 15000; i++) { for (int i = 0; i < 15000; i++) {
prep.setInt(1, i); prep.setInt(1, i);
prep.executeQuery(); prep.executeQuery();
p++;
} }
} }
int rcData = getReadCount(stat) - rc; int rcData = getReadCount(stat) - rc;
......
...@@ -159,13 +159,12 @@ public class TestCompress extends TestBase { ...@@ -159,13 +159,12 @@ public class TestCompress extends TestBase {
long time = System.currentTimeMillis(); long time = System.currentTimeMillis();
for (int i = 0; i < 1000; i++) { for (int i = 0; i < 1000; i++) {
InputStream in = FileUtils.newInputStream("memFS:compress.h2.db"); InputStream in = FileUtils.newInputStream("memFS:compress.h2.db");
int total = 0;
while (true) { while (true) {
int len = in.read(buff); int len = in.read(buff);
if (len < 0) { if (len < 0) {
break; break;
} }
total += compress.compress(buff, pageSize, test, 0); compress.compress(buff, pageSize, test, 0);
} }
in.close(); in.close();
} }
......
...@@ -44,7 +44,6 @@ public class Indexer { ...@@ -44,7 +44,6 @@ public class Indexer {
private HashMap<String, Word> words = new HashMap<String, Word>(); private HashMap<String, Word> words = new HashMap<String, Word>();
private HashSet<String> noIndex = new HashSet<String>(); private HashSet<String> noIndex = new HashSet<String>();
private ArrayList <Word>wordList; private ArrayList <Word>wordList;
private int totalAllWeights;
private PrintWriter output; private PrintWriter output;
private Page page; private Page page;
private boolean title; private boolean title;
...@@ -350,7 +349,6 @@ public class Indexer { ...@@ -350,7 +349,6 @@ public class Indexer {
word.name = token.compareTo(word.name) > 0 ? token : word.name; word.name = token.compareTo(word.name) > 0 ? token : word.name;
} }
page.totalWeight += weight; page.totalWeight += weight;
totalAllWeights += weight;
word.addPage(page, weight); word.addPage(page, weight);
} }
} }
......
...@@ -298,7 +298,7 @@ public class ModelUtils { ...@@ -298,7 +298,7 @@ public class ModelUtils {
try { try {
// delegate to static valueOf() method to parse string // delegate to static valueOf() method to parse string
Method m = modelClass.getMethod("valueOf", String.class); Method m = modelClass.getMethod("valueOf", String.class);
Object o = m.invoke(null, unquoted); m.invoke(null, unquoted);
} catch (NumberFormatException ex) { } catch (NumberFormatException ex) {
return false; return false;
} catch (Throwable t) { } catch (Throwable t) {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论