Made BOB 1.4 java compliant.

This commit is contained in:
sponge
2008-10-08 16:40:07 +00:00
parent 2c048d7465
commit cb17fb8805
7 changed files with 26 additions and 29 deletions

View File

@@ -40,8 +40,8 @@ javac.classpath=\
# Space-separated list of extra javac options
javac.compilerargs=
javac.deprecation=false
javac.source=1.5
javac.target=1.5
javac.source=1.4
javac.target=1.4
javac.test.classpath=\
${javac.classpath}:\
${build.classes.dir}:\

View File

@@ -74,7 +74,7 @@ public class I2Plistener implements Runnable {
if(info.exists("INPORT")) {
tgwatch = 2;
}
while(info.get("RUNNING").equals(true)) {
while(info.get("RUNNING").equals(Boolean.TRUE)) {
try {
try {
sessSocket = serverSocket.accept();

View File

@@ -65,7 +65,7 @@ public class I2PtoTCP implements Runnable {
OutputStream Iout = I2P.getOutputStream();
I2P.setReadTimeout(0); // temp bugfix, this *SHOULD* be the default
if(info.get("QUIET").equals(false)) {
if(info.get("QUIET").equals(Boolean.FALSE)) {
// tell who is connecting
out.write(I2P.getPeerDestination().toBase64().getBytes());
out.write(10); // nl

View File

@@ -57,7 +57,7 @@ public class MUXlisten implements Runnable {
MUXlisten(nickname info, Log _log) throws I2PException, IOException {
this.info = info;
this._log = _log;
this.info.add("STARTING", true);
this.info.add("STARTING", Boolean.TRUE);
N = this.info.get("NICKNAME").toString();
prikey = new ByteArrayInputStream((byte[])info.get("KEYS"));
@@ -71,8 +71,8 @@ public class MUXlisten implements Runnable {
public void run() {
tg = new ThreadGroup(N);
info.add("RUNNING", true);
info.add("STARTING", false);
info.add("RUNNING", Boolean.TRUE);
info.add("STARTING", Boolean.FALSE);
// toss the connections to a new threads.
// will wrap with TCP and UDP when UDP works
@@ -89,7 +89,7 @@ public class MUXlisten implements Runnable {
q.start();
}
while(info.get("STOPPING").equals(false)) {
while(info.get("STOPPING").equals(Boolean.FALSE)) {
try {
Thread.sleep(1000); //sleep for 1000 ms (One second)
} catch(InterruptedException e) {
@@ -97,7 +97,7 @@ public class MUXlisten implements Runnable {
}
}
info.add("RUNNING", false);
info.add("RUNNING", Boolean.FALSE);
// wait for child threads and thread groups to die
while (tg.activeCount() + tg.activeGroupCount() != 0) {
try {
@@ -111,8 +111,8 @@ public class MUXlisten implements Runnable {
tg.destroy();
// Zap reference to the ThreadGroup so the JVM can GC it.
tg = null;
info.add("STOPPING", false);
info.add("STARTING", false);
info.add("STOPPING", Boolean.FALSE);
info.add("STARTING", Boolean.FALSE);
}
}

View File

@@ -64,7 +64,7 @@ public class TCPio implements Runnable {
int b;
byte a[] = new byte[1];
try {
while(info.get("RUNNING").equals(true)) {
while(info.get("RUNNING").equals(Boolean.TRUE)) {
b = Ain.read(a, 0, 1);
// System.out.println(info.get("NICKNAME").toString() + " " + b);
if(b > 0) {

View File

@@ -75,7 +75,7 @@ public class TCPlistener implements Runnable {
ServerSocket listener = new ServerSocket(Integer.parseInt(info.get("INPORT").toString()), backlog, InetAddress.getByName(info.get("INHOST").toString()));
Socket server = new Socket();
listener.setSoTimeout(1000);
while(info.get("RUNNING").equals(true)) {
while(info.get("RUNNING").equals(Boolean.TRUE)) {
// System.out.println("Thread count " + Thread.activeCount());
try {
server = listener.accept();

View File

@@ -31,11 +31,8 @@ import java.io.PrintStream;
import java.net.Socket;
import java.util.Properties;
import java.util.StringTokenizer;
import java.util.logging.Level;
import java.util.logging.Logger;
import net.i2p.I2PException;
import net.i2p.client.I2PClientFactory;
import net.i2p.data.DataFormatException;
import net.i2p.data.Destination;
import net.i2p.util.Log;
@@ -234,9 +231,9 @@ public class doCMDS implements Runnable {
* @return true if the tunnel is active
*/
public boolean tunnelactive(nickname Arg) {
return (Arg.get(P_STARTING).equals(true) ||
Arg.get(P_STOPPING).equals(true) ||
Arg.get(P_RUNNING).equals(true));
return (Arg.get(P_STARTING).equals(Boolean.TRUE) ||
Arg.get(P_STOPPING).equals(Boolean.TRUE) ||
Arg.get(P_RUNNING).equals(Boolean.TRUE));
}
@@ -358,7 +355,7 @@ public class doCMDS implements Runnable {
if(tunnelactive(nickinfo)) {
out.println("ERROR tunnel is active");
} else {
nickinfo.add(P_QUIET, (Boolean.parseBoolean(Arg) == true));
nickinfo.add(P_QUIET, new Boolean(Boolean.parseBoolean(Arg) == true));
out.println("OK Quiet set");
}
} else {
@@ -407,10 +404,10 @@ public class doCMDS implements Runnable {
nickinfo = new nickname();
database.add(Arg, nickinfo);
nickinfo.add(P_NICKNAME, Arg);
nickinfo.add(P_STARTING, false);
nickinfo.add(P_RUNNING, false);
nickinfo.add(P_STOPPING, false);
nickinfo.add(P_QUIET, false);
nickinfo.add(P_STARTING, Boolean.FALSE);
nickinfo.add(P_RUNNING, Boolean.FALSE);
nickinfo.add(P_STOPPING, Boolean.FALSE);
nickinfo.add(P_QUIET, Boolean.FALSE);
nickinfo.add(P_INHOST, "localhost");
nickinfo.add(P_OUTHOST, "localhost");
Properties Q = props;
@@ -468,7 +465,7 @@ public class doCMDS implements Runnable {
try {
prt = Integer.parseInt(Arg);
if(prt > 1 && prt < 65536) {
nickinfo.add(P_INPORT, prt);
nickinfo.add(P_INPORT, new Integer(prt));
}
} catch(NumberFormatException nfe) {
out.println("ERROR not a number");
@@ -495,7 +492,7 @@ public class doCMDS implements Runnable {
try {
prt = Integer.parseInt(Arg);
if(prt > 1 && prt < 65536) {
nickinfo.add(P_OUTPORT, prt);
nickinfo.add(P_OUTPORT, new Integer(prt));
}
} catch(NumberFormatException nfe) {
out.println("ERROR not a number");
@@ -550,7 +547,7 @@ public class doCMDS implements Runnable {
try {
tunnel = new MUXlisten(nickinfo, _log);
Thread t = new Thread(tunnel);
nickinfo.add(P_STARTING, true);
nickinfo.add(P_STARTING, Boolean.TRUE);
t.start();
out.println("OK tunnel starting");
} catch(I2PException e) {
@@ -565,8 +562,8 @@ public class doCMDS implements Runnable {
} else if(Command.equals(C_stop)) {
// Stop the tunnel, if it is running
if(ns) {
if(nickinfo.get(P_RUNNING).equals(true) && nickinfo.get(P_STOPPING).equals(false)) {
nickinfo.add(P_STOPPING, true);
if(nickinfo.get(P_RUNNING).equals(Boolean.TRUE) && nickinfo.get(P_STOPPING).equals(Boolean.FALSE)) {
nickinfo.add(P_STOPPING, Boolean.TRUE);
out.println("OK tunnel stopping");
} else {
out.println("ERROR tunnel is inactive");