Fix NPE in TCPtoI2P when a lookup fails, report the error to the stream.

Fix setkeys bug in DoCMDS, forgot to create the object before calling t's methods, which threw an NPE.
This commit is contained in:
sponge
2010-01-30 05:26:30 +00:00
parent f86f2701ff
commit 390981e10c
5 changed files with 15 additions and 7 deletions

View File

@ -1,8 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project-private xmlns="http://www.netbeans.org/ns/project-private/1"> <project-private xmlns="http://www.netbeans.org/ns/project-private/1">
<editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/1"/> <editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/1"/>
<open-files xmlns="http://www.netbeans.org/ns/projectui-open-files/1">
<file>file:/usblv/NetBeansProjects/i2p.i2p/apps/BOB/src/net/i2p/BOB/I2PtoTCP.java</file>
<file>file:/usblv/NetBeansProjects/i2p.i2p/apps/BOB/src/net/i2p/BOB/MUXlisten.java</file>
</open-files>
</project-private> </project-private>

View File

@ -691,6 +691,7 @@ public class DoCMDS implements Runnable {
try { try {
prikey = new ByteArrayOutputStream(); prikey = new ByteArrayOutputStream();
prikey.write(net.i2p.data.Base64.decode(Arg)); prikey.write(net.i2p.data.Base64.decode(Arg));
d = new Destination();
d.fromBase64(Arg); d.fromBase64(Arg);
} catch (Exception ex) { } catch (Exception ex) {
Arg = ""; Arg = "";

View File

@ -146,8 +146,14 @@ public class TCPtoI2P implements Runnable {
input = line.toLowerCase(); input = line.toLowerCase();
Destination dest = null; Destination dest = null;
if (input.endsWith(".i2p")) { if (input.endsWith(".i2p")) {
dest = I2PTunnel.destFromName(input); try {
line = dest.toBase64(); dest = I2PTunnel.destFromName(input);
line = dest.toBase64();
} catch (NullPointerException npe) {
// Could not find the destination!?
Emsg("Can't find destination: " + input, out);
return;
}
} }
dest = new Destination(); dest = new Destination();
dest.fromBase64(line); dest.fromBase64(line);

View File

@ -1,3 +1,8 @@
2010-01-30 sponge
* Fix NPE in TCPtoI2P when a lookup fails, report the error to the stream.
* Fix setkeys bug in DoCMDS, forgot to create the object before calling
it's methods, which threw an NPE.
2010-01-29 zzz 2010-01-29 zzz
* build.xml: Add a debian-source target * build.xml: Add a debian-source target
* Data structures: * Data structures:

View File

@ -18,7 +18,7 @@ public class RouterVersion {
/** deprecated */ /** deprecated */
public final static String ID = "Monotone"; public final static String ID = "Monotone";
public final static String VERSION = CoreVersion.VERSION; public final static String VERSION = CoreVersion.VERSION;
public final static long BUILD = 4; public final static long BUILD = 5;
/** for example "-test" */ /** for example "-test" */
public final static String EXTRA = ""; public final static String EXTRA = "";