NetDB: Fix NPE (ticket #1619)

This commit is contained in:
zzz
2015-07-25 13:37:45 +00:00
parent fea6b8aec3
commit bfde521cf9
4 changed files with 16 additions and 3 deletions

View File

@@ -1,3 +1,7 @@
2015-07-25 zzz
* i2psnark: Fix total_size in metadata message (ticket #1618)
* NetDB: Fix NPE (ticket #1619)
2015-07-21 str4d
* Core: Throw DFE in Certificate.create() instead of AIOOBE (ticket #1016)

View File

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

View File

@@ -78,7 +78,7 @@ class ExploreJob extends SearchJob {
* @param expiration when the search should stop
* @param peer the peer to send it to
*
* @return a DatabaseLookupMessage or GarlicMessage
* @return a DatabaseLookupMessage or GarlicMessage or null on error
*/
@Override
protected I2NPMessage buildMessage(TunnelId replyTunnelId, Hash replyGateway, long expiration, RouterInfo peer) {
@@ -146,6 +146,7 @@ class ExploreJob extends SearchJob {
' ' + sess.key + ' ' + sess.tag);
msg.setReplySession(sess.key, sess.tag);
}
// may be null
outMsg = MessageWrapper.wrap(getContext(), msg, peer);
if (_log.shouldLog(Log.DEBUG))
_log.debug(getJobId() + ": Encrypted exploratory DLM for " + getState().getTarget() + " to " +

View File

@@ -445,7 +445,11 @@ class SearchJob extends JobImpl {
long expiration = getContext().clock().now() + timeout;
I2NPMessage msg = buildMessage(inTunnelId, inTunnel.getPeer(0), expiration, router);
if (msg == null) {
getContext().jobQueue().addJob(new FailedJob(getContext(), router));
return;
}
TunnelInfo outTunnel = getContext().tunnelManager().selectOutboundExploratoryTunnel(to);
if (outTunnel == null) {
_log.warn("No tunnels to send search out through! Impossible?");
@@ -480,6 +484,10 @@ class SearchJob extends JobImpl {
// use the 4-arg one so we pick up the override in ExploreJob
//I2NPMessage msg = buildMessage(expiration);
I2NPMessage msg = buildMessage(null, router.getIdentity().getHash(), expiration, router);
if (msg == null) {
getContext().jobQueue().addJob(new FailedJob(getContext(), router));
return;
}
if (_log.shouldLog(Log.DEBUG))
_log.debug(getJobId() + ": Sending router search directly to " + router.getIdentity().getHash()