Bug 13239 - java.lang.NullPointerException seen in management server logs when netscaler instance is unreachable whenever network usage thread is executed

Changes:
- Added Null check for lbvserver
- Need not process the usage answer when we get some error.
This commit is contained in:
prachi 2012-01-26 16:39:59 -08:00
parent 3df53c1324
commit e48e7226bd
2 changed files with 14 additions and 11 deletions

View File

@ -1223,6 +1223,7 @@ public class NetscalerResource implements ServerResource {
for (lbvserver_stats stat_entry : stats) {
String lbvserverName = stat_entry.get_name();
lbvserver vserver = lbvserver.get(_netscalerService, lbvserverName);
if(vserver != null){
String lbVirtualServerIp = vserver.get_ipv46();
long[] bytesSentAndReceived = answer.ipBytes.get(lbVirtualServerIp);
@ -1236,6 +1237,7 @@ public class NetscalerResource implements ServerResource {
answer.ipBytes.put(lbVirtualServerIp, bytesSentAndReceived);
}
}
}
} catch (Exception e) {
s_logger.error("Failed to get bytes sent and recived statistics due to " + e);
throw new ExecutionException(e.getMessage());

View File

@ -1055,6 +1055,7 @@ public abstract class ExternalLoadBalancerDeviceManagerImpl extends AdapterBase
String details = (lbAnswer != null) ? lbAnswer.getDetails() : "details unavailable";
String msg = "Unable to get external load balancer stats for " + zone.getName() + " due to: " + details + ".";
s_logger.error(msg);
continue;
}
}