mirror of https://github.com/apache/cloudstack.git
findbugs: unnecesarry null return in utility function removed;
Category BAD_PRACTICE
This commit is contained in:
parent
cb02a32f79
commit
9f8a40acd5
|
|
@ -177,7 +177,7 @@ public class BigSwitchBcfUtils {
|
|||
|
||||
// handle external network first, only if NAT service is enabled
|
||||
if(networks != null) {
|
||||
if(!(networks.isEmpty()) && isNatEnabled()!=null && isNatEnabled()){
|
||||
if (!(networks.isEmpty()) && isNatEnabled()) {
|
||||
// get public net info - needed to set up source nat gateway
|
||||
NetworkVO pubNet = getPublicNetwork(physicalNetworkId);
|
||||
|
||||
|
|
@ -440,7 +440,7 @@ public class BigSwitchBcfUtils {
|
|||
|
||||
public String syncTopologyToBcfHost(HostVO bigswitchBcfHost){
|
||||
SyncBcfTopologyCommand syncCmd;
|
||||
if(isNatEnabled()!=null && isNatEnabled()){
|
||||
if (isNatEnabled()) {
|
||||
syncCmd = new SyncBcfTopologyCommand(true, true);
|
||||
} else {
|
||||
syncCmd = new SyncBcfTopologyCommand(true, false);
|
||||
|
|
@ -519,12 +519,12 @@ public class BigSwitchBcfUtils {
|
|||
});
|
||||
}
|
||||
|
||||
public Boolean isNatEnabled(){
|
||||
public boolean isNatEnabled() {
|
||||
List<BigSwitchBcfDeviceVO> devices = _bigswitchBcfDao.listAll();
|
||||
if(devices != null && !devices.isEmpty()){
|
||||
return devices.get(0).getNat();
|
||||
} else {
|
||||
return null;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -30,25 +30,26 @@ import javax.ejb.Local;
|
|||
import javax.inject.Inject;
|
||||
import javax.naming.ConfigurationException;
|
||||
|
||||
import org.apache.commons.net.util.SubnetUtils;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import org.apache.cloudstack.network.ExternalNetworkDeviceManager.NetworkDevice;
|
||||
import org.apache.commons.net.util.SubnetUtils;
|
||||
|
||||
import com.cloud.agent.AgentManager;
|
||||
import com.cloud.agent.api.BcfAnswer;
|
||||
import com.cloud.agent.api.UpdateBcfRouterCommand;
|
||||
import com.cloud.agent.api.CreateBcfAttachmentCommand;
|
||||
import com.cloud.agent.api.CreateBcfStaticNatCommand;
|
||||
import com.cloud.agent.api.DeleteBcfAttachmentCommand;
|
||||
import com.cloud.agent.api.DeleteBcfStaticNatCommand;
|
||||
import com.cloud.agent.api.StartupBigSwitchBcfCommand;
|
||||
import com.cloud.agent.api.StartupCommand;
|
||||
import com.cloud.agent.api.UpdateBcfRouterCommand;
|
||||
import com.cloud.api.ApiDBUtils;
|
||||
import com.cloud.api.commands.AddBigSwitchBcfDeviceCmd;
|
||||
import com.cloud.api.commands.BcfConstants;
|
||||
import com.cloud.api.commands.DeleteBigSwitchBcfDeviceCmd;
|
||||
import com.cloud.api.commands.ListBigSwitchBcfDevicesCmd;
|
||||
import com.cloud.api.commands.BcfConstants;
|
||||
import com.cloud.api.response.BigSwitchBcfDeviceResponse;
|
||||
import com.cloud.configuration.ConfigurationManager;
|
||||
import com.cloud.dc.DataCenterVO;
|
||||
|
|
@ -451,8 +452,7 @@ NetworkACLServiceProvider, FirewallServiceProvider, ResourceStateAdapter {
|
|||
zoneName = String.valueOf(zoneId);
|
||||
}
|
||||
|
||||
Boolean natNow = _bcfUtils.isNatEnabled();
|
||||
if( natNow != null)
|
||||
boolean natNow = _bcfUtils.isNatEnabled();
|
||||
if (!nat && natNow){
|
||||
throw new CloudRuntimeException("NAT is enabled in existing controller. Enable NAT for new controller or remove existing controller first.");
|
||||
} else if (nat && !natNow){
|
||||
|
|
|
|||
Loading…
Reference in New Issue