check for nulls

git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@560694 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Robert Davies 2007-07-29 08:56:21 +00:00
parent 1e3e5b7223
commit 14180c5cb3

View File

@ -94,7 +94,7 @@ public class NetworkBridgeFilter implements DataStructure, BooleanExpression {
if(message.isAdvisory()&&message.getDataStructure()!=null if(message.isAdvisory()&&message.getDataStructure()!=null
&&message.getDataStructure().getDataStructureType()==CommandTypes.CONSUMER_INFO){ &&message.getDataStructure().getDataStructureType()==CommandTypes.CONSUMER_INFO){
ConsumerInfo info=(ConsumerInfo) message.getDataStructure(); ConsumerInfo info=(ConsumerInfo) message.getDataStructure();
hops = info.getBrokerPath() == null ? 0 : message.getBrokerPath().length; hops = info.getBrokerPath() == null ? 0 : info.getBrokerPath().length;
if(hops >= networkTTL ){ if(hops >= networkTTL ){
if (log.isTraceEnabled()){ if (log.isTraceEnabled()){
log.trace("ConsumerInfo advisory restricted to " + networkTTL + " network hops ignoring: " + message); log.trace("ConsumerInfo advisory restricted to " + networkTTL + " network hops ignoring: " + message);
@ -106,7 +106,7 @@ public class NetworkBridgeFilter implements DataStructure, BooleanExpression {
} }
public static boolean contains(BrokerId[] brokerPath,BrokerId brokerId){ public static boolean contains(BrokerId[] brokerPath,BrokerId brokerId){
if(brokerPath!=null){ if(brokerPath!=null && brokerId != null){
for(int i=0;i<brokerPath.length;i++){ for(int i=0;i<brokerPath.length;i++){
if(brokerId.equals(brokerPath[i])) if(brokerId.equals(brokerPath[i]))
return true; return true;