Commit 1d42ddf1 authored by dchinmay's avatar dchinmay Committed by Christian Schudt

NullPointerException in RoutingTableImpl.

In #routeToComponent, it is first checked if the component is being hosted in the local JVM. If it was not found, then all nodes in the ComponentsCache are checked to find if the component is hosted by one of those. In this process, the local routing table is again searched for the component, because it may have been added after the previous check. However, after this search, there is no null check done for the searched route. This results in an NPE when the component was not found locally and the #process(packet) method is called on the object. 

This also prevents the code from searching other nodes that may have been in the nodes set. Added a null check to prevent this scenario.
parent 1315b8c4
......@@ -418,9 +418,12 @@ public class RoutingTableImpl extends BasicModule implements RoutingTable, Clust
// This is a route to a local component hosted in this node (route
// could have been added after our previous check)
try {
localRoutingTable.getRoute(jid.getDomain()).process(packet);
RoutableChannelHandler localRoute = localRoutingTable.getRoute(jid.getDomain());
if (localRoute != null) {
localRoute.process(packet);
routed = true;
break;
}
} catch (UnauthorizedException e) {
Log.error("Unable to route packet " + packet.toXML(), e);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment