mirror of https://github.com/apache/cloudstack.git
instead of using '==', use equals() to test Long value equality
This commit is contained in:
parent
e7fef86c80
commit
6d57393629
|
|
@ -168,7 +168,7 @@ public class ApiDispatcher {
|
|||
pageSize = Long.valueOf((String) pageSizeObj);
|
||||
}
|
||||
|
||||
if ((unpackedParams.get(ApiConstants.PAGE) == null) && (pageSize != null && pageSize != BaseListCmd.PAGESIZE_UNLIMITED)) {
|
||||
if ((unpackedParams.get(ApiConstants.PAGE) == null) && (pageSize != null && !pageSize.equals(BaseListCmd.PAGESIZE_UNLIMITED))) {
|
||||
ServerApiException ex = new ServerApiException(ApiErrorCode.PARAM_ERROR, "\"page\" parameter is required when \"pagesize\" is specified");
|
||||
ex.setCSErrorCode(CSExceptionErrorCode.getCSErrCode(ex.getClass().getName()));
|
||||
throw ex;
|
||||
|
|
|
|||
|
|
@ -2346,7 +2346,7 @@ public class QueryManagerImpl extends ManagerBase implements QueryService {
|
|||
// offerings
|
||||
private boolean isPermissible(Long accountDomainId, Long offeringDomainId) {
|
||||
|
||||
if (accountDomainId == offeringDomainId) {
|
||||
if (accountDomainId.equals(offeringDomainId)) {
|
||||
return true; // account and service offering in same domain
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -681,7 +681,7 @@ public class CapacityManagerImpl extends ManagerBase implements CapacityManager,
|
|||
|
||||
if ((newState == State.Starting || newState == State.Migrating || event == Event.AgentReportMigrated) && vm.getHostId() != null) {
|
||||
boolean fromLastHost = false;
|
||||
if (vm.getLastHostId() == vm.getHostId()) {
|
||||
if (vm.getLastHostId().equals(vm.getHostId())) {
|
||||
s_logger.debug("VM starting again on the last host it was stopped on");
|
||||
fromLastHost = true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ AgentBasedConsoleProxyManager {
|
|||
if (allocatedHost == null) {
|
||||
/*Is there a consoleproxy agent running in the same pod?*/
|
||||
for (HostVO hv : hosts) {
|
||||
if (hv.getType() == Host.Type.ConsoleProxy && hv.getPodId() == host.getPodId()) {
|
||||
if (hv.getType() == Host.Type.ConsoleProxy && hv.getPodId().equals(host.getPodId())) {
|
||||
allocatedHost = hv;
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1264,7 +1264,7 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService {
|
|||
throw new InvalidParameterValueException("Unable to find specified NetworkACL");
|
||||
}
|
||||
|
||||
if(vpcId != acl.getVpcId()){
|
||||
if(!vpcId.equals(acl.getVpcId())){
|
||||
throw new InvalidParameterValueException("ACL: "+aclId+" do not belong to the VPC");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -182,7 +182,7 @@ public class NetworkACLServiceImpl extends ManagerBase implements NetworkACLServ
|
|||
throw new InvalidParameterValueException("Unable to find Vpc associated with the NetworkACL");
|
||||
}
|
||||
_accountMgr.checkAccess(caller, null, true, vpc);
|
||||
if(gateway.getVpcId() != acl.getVpcId()){
|
||||
if(!gateway.getVpcId().equals(acl.getVpcId())){
|
||||
throw new InvalidParameterValueException("private gateway: "+privateGatewayId+" and ACL: "+aclId+" do not belong to the same VPC");
|
||||
}
|
||||
}
|
||||
|
|
@ -225,7 +225,7 @@ public class NetworkACLServiceImpl extends ManagerBase implements NetworkACLServ
|
|||
}
|
||||
|
||||
_accountMgr.checkAccess(caller, null, true, vpc);
|
||||
if(network.getVpcId() != acl.getVpcId()){
|
||||
if(!network.getVpcId().equals(acl.getVpcId())){
|
||||
throw new InvalidParameterValueException("Network: "+networkId+" and ACL: "+aclId+" do not belong to the same VPC");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1152,7 +1152,7 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe
|
|||
if (volumePools.isEmpty()) {
|
||||
allHosts.remove(host);
|
||||
} else {
|
||||
if (host.getClusterId() != srcHost.getClusterId() || usesLocal) {
|
||||
if (!host.getClusterId().equals(srcHost.getClusterId()) || usesLocal) {
|
||||
requiresStorageMotion.put(host, true);
|
||||
}
|
||||
}
|
||||
|
|
@ -1887,7 +1887,7 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe
|
|||
}
|
||||
|
||||
// Don't allow to modify system template
|
||||
if (id == Long.valueOf(1)) {
|
||||
if (id.equals(Long.valueOf(1))) {
|
||||
InvalidParameterValueException ex = new InvalidParameterValueException("Unable to update template/iso of specified id");
|
||||
ex.addProxyObject(template, id, "templateId");
|
||||
throw ex;
|
||||
|
|
@ -2414,7 +2414,7 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe
|
|||
public int compare(SummedCapacity arg0, SummedCapacity arg1) {
|
||||
if (arg0.getPercentUsed() < arg1.getPercentUsed()) {
|
||||
return 1;
|
||||
} else if (arg0.getPercentUsed() == arg1.getPercentUsed()) {
|
||||
} else if (arg0.getPercentUsed().equals(arg1.getPercentUsed())) {
|
||||
return 0;
|
||||
}
|
||||
return -1;
|
||||
|
|
|
|||
|
|
@ -993,7 +993,7 @@ public class TemplateManagerImpl extends ManagerBase implements TemplateManager,
|
|||
}
|
||||
|
||||
//Verify parameters
|
||||
if (sourceZoneId == destZoneId) {
|
||||
if (sourceZoneId.equals(destZoneId)) {
|
||||
throw new InvalidParameterValueException("Please specify different source and destination zones.");
|
||||
}
|
||||
|
||||
|
|
@ -1522,7 +1522,7 @@ public class TemplateManagerImpl extends ManagerBase implements TemplateManager,
|
|||
Account caller = UserContext.current().getCaller();
|
||||
Long id = cmd.getId();
|
||||
|
||||
if (id == Long.valueOf(1)) {
|
||||
if (id.equals(Long.valueOf(1))) {
|
||||
throw new PermissionDeniedException("unable to list permissions for " + cmd.getMediaType() + " with id " + id);
|
||||
}
|
||||
|
||||
|
|
@ -1614,7 +1614,7 @@ public class TemplateManagerImpl extends ManagerBase implements TemplateManager,
|
|||
throw new InvalidParameterValueException("unable to update permissions for " + mediaType + " with id " + id + " as it is removed ");
|
||||
}
|
||||
|
||||
if (id == Long.valueOf(1)) {
|
||||
if (id.equals(Long.valueOf(1))) {
|
||||
throw new InvalidParameterValueException("unable to update permissions for " + mediaType + " with id " + id);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -3708,7 +3708,7 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Use
|
|||
|
||||
List<VolumeVO> vmVolumes = _volsDao.findUsableVolumesForInstance(vm.getId());
|
||||
Map<VolumeVO, StoragePoolVO> volToPoolObjectMap = new HashMap<VolumeVO, StoragePoolVO>();
|
||||
if (!isVMUsingLocalStorage(vm) && destinationHost.getClusterId() == srcHost.getClusterId()) {
|
||||
if (!isVMUsingLocalStorage(vm) && destinationHost.getClusterId().equals(srcHost.getClusterId())) {
|
||||
if (volumeToPool.isEmpty()) {
|
||||
// If the destination host is in the same cluster and volumes do not have to be migrated across pools
|
||||
// then fail the call. migrateVirtualMachine api should have been used.
|
||||
|
|
|
|||
|
|
@ -1322,7 +1322,7 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
|
|||
if (migrationResult) {
|
||||
//if the vm is migrated to different pod in basic mode, need to reallocate ip
|
||||
|
||||
if (vm.getPodIdToDeployIn() != destPool.getPodId()) {
|
||||
if (!vm.getPodIdToDeployIn().equals(destPool.getPodId())) {
|
||||
DataCenterDeployment plan = new DataCenterDeployment(vm.getDataCenterId(), destPool.getPodId(), null, null, null, null);
|
||||
VirtualMachineProfileImpl<T> vmProfile = new VirtualMachineProfileImpl<T>(vm, null, null, null, null);
|
||||
_networkMgr.reallocate(vmProfile, plan);
|
||||
|
|
|
|||
Loading…
Reference in New Issue