Skip to content

Commit

Permalink
Router: fix NPE in ClientManager, reduce log level of error in Client…
Browse files Browse the repository at this point in the history
…ConnectionRunner
  • Loading branch information
eyedeekay committed Oct 12, 2023
1 parent 79d456a commit 7d0c857
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1190,8 +1190,8 @@ public FloodfillNetworkDatabaseFacade getFloodfillNetworkDatabaseFacade() {
if (_log.shouldLog(Log.DEBUG))
_log.debug("getFloodfillNetworkDatabaseFacade is getting the subDb for dbid: " + this.getDestHash());
if (_floodfillNetworkDatabaseFacade == null) {
if (_log.shouldLog(Log.ERROR))
_log.error("getFloodfillNetworkDatabaseFacade is null for runner", new Exception());
if (_log.shouldLog(Log.WARN))
_log.warn("getFloodfillNetworkDatabaseFacade is null for runner");
return _context.netDb();
}
return this._floodfillNetworkDatabaseFacade;
Expand Down
12 changes: 10 additions & 2 deletions router/java/src/net/i2p/router/client/ClientManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -785,6 +785,11 @@ public FloodfillNetworkDatabaseFacade getClientFloodfillNetworkDatabaseFacade(Ha
if (_log.shouldLog(Log.DEBUG))
_log.debug("Getting subDb for desthash: " + destHash);
ClientConnectionRunner runner = getRunner(destHash);
if (runner == null){
if (_log.shouldLog(Log.WARN))
_log.warn("ClientManager got a null runner in getClientFloodfillNetworkDatabaseFacade for " + destHash);
return null;
}
if (_log.shouldLog(Log.DEBUG))
_log.debug("ClientManager got a runner in getClientFloodfillNetworkDatabaseFacade for " + destHash);
return runner.getFloodfillNetworkDatabaseFacade();
Expand All @@ -800,8 +805,11 @@ public FloodfillNetworkDatabaseFacade getClientFloodfillNetworkDatabaseFacade(Ha
public Set<FloodfillNetworkDatabaseFacade> getClientFloodfillNetworkDatabaseFacades() {
Set<FloodfillNetworkDatabaseFacade> rv = new HashSet<FloodfillNetworkDatabaseFacade>();
for (ClientConnectionRunner runner : _runners.values()) {
if (runner != null)
rv.add(runner.getFloodfillNetworkDatabaseFacade());
if (runner != null){
FloodfillNetworkDatabaseFacade fndf = runner.getFloodfillNetworkDatabaseFacade();
if (fndf != null)
rv.add(fndf);
}
}
return rv;
}
Expand Down

0 comments on commit 7d0c857

Please sign in to comment.