mirror of
				https://github.com/apache/cloudstack.git
				synced 2025-10-26 08:42:29 +01:00 
			
		
		
		
	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:
		
							parent
							
								
									3df53c1324
								
							
						
					
					
						commit
						e48e7226bd
					
				| @ -1223,17 +1223,19 @@ public class NetscalerResource implements ServerResource { | ||||
|             for (lbvserver_stats stat_entry : stats) { | ||||
|                 String lbvserverName = stat_entry.get_name(); | ||||
|                 lbvserver vserver = lbvserver.get(_netscalerService, lbvserverName); | ||||
|                 String lbVirtualServerIp = vserver.get_ipv46(); | ||||
| 
 | ||||
|                 long[] bytesSentAndReceived = answer.ipBytes.get(lbVirtualServerIp); | ||||
|                 if (bytesSentAndReceived == null) { | ||||
|                     bytesSentAndReceived = new long[]{0, 0}; | ||||
|                 } | ||||
|                 bytesSentAndReceived[0] += stat_entry.get_totalrequestbytes(); | ||||
|                 bytesSentAndReceived[1] += stat_entry.get_totalresponsebytes(); | ||||
| 
 | ||||
|                 if (bytesSentAndReceived[0] >= 0 && bytesSentAndReceived[1] >= 0) { | ||||
|                     answer.ipBytes.put(lbVirtualServerIp, bytesSentAndReceived); | ||||
|                 if(vserver != null){ | ||||
|                     String lbVirtualServerIp = vserver.get_ipv46(); | ||||
|      | ||||
|                     long[] bytesSentAndReceived = answer.ipBytes.get(lbVirtualServerIp); | ||||
|                     if (bytesSentAndReceived == null) { | ||||
|                         bytesSentAndReceived = new long[]{0, 0}; | ||||
|                     } | ||||
|                     bytesSentAndReceived[0] += stat_entry.get_totalrequestbytes(); | ||||
|                     bytesSentAndReceived[1] += stat_entry.get_totalresponsebytes(); | ||||
|      | ||||
|                     if (bytesSentAndReceived[0] >= 0 && bytesSentAndReceived[1] >= 0) { | ||||
|                         answer.ipBytes.put(lbVirtualServerIp, bytesSentAndReceived); | ||||
|                     } | ||||
|                 } | ||||
|             } | ||||
|         } catch (Exception e) { | ||||
|  | ||||
| @ -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; | ||||
|                             } | ||||
|                         } | ||||
| 
 | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user