Skip to content

Commit e26442f

Browse files
author
Mice Xia
committed
instead of '==', use equals() to compare two strings in cloud-server
1 parent 6d57393 commit e26442f

3 files changed

Lines changed: 4 additions & 4 deletions

File tree

‎server/src/com/cloud/configuration/ConfigurationManagerImpl.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2491,7 +2491,7 @@ public Vlan createVlanAndPublicIpRange(CreateVlanIpRangeCmd cmd) throws Insuffic
24912491
if ( vlans != null && vlans.size() > 0 ) {
24922492
if ( vlanId == null ) {
24932493
vlanId = vlan.getVlanTag();
2494-
} else if ( vlan.getVlanTag() != vlanId ) {
2494+
} else if (!vlan.getVlanTag().equals(vlanId)) {
24952495
throw new InvalidParameterValueException("there is already one vlan " + vlan.getVlanTag() + " on network :" +
24962496
+ network.getId() + ", only one vlan is allowed on guest network");
24972497
}

‎server/src/com/cloud/test/DatabaseConfig.java‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -792,14 +792,14 @@ private void saveVlan() {
792792
}
793793

794794
// If a netmask was provided, check that the startIP, endIP, and gateway all belong to the same subnet
795-
if (netmask != null && netmask != "") {
795+
if (netmask != null && !netmask.equals("")) {
796796
if (endIP != null) {
797797
if (!IPRangeConfig.sameSubnet(startIP, endIP, netmask)) {
798798
printError("Start and end IPs for the public IP range must be in the same subnet, as per the provided netmask.");
799799
}
800800
}
801801

802-
if (gateway != null && gateway != "") {
802+
if (gateway != null && !gateway.equals("")) {
803803
if (!IPRangeConfig.sameSubnet(startIP, gateway, netmask)) {
804804
printError("The start IP for the public IP range must be in the same subnet as the gateway, as per the provided netmask.");
805805
}

‎server/src/com/cloud/vm/UserVmManagerImpl.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1673,7 +1673,7 @@ public UserVm updateVirtualMachine(UpdateVMCmd cmd)
16731673

16741674
String description = "";
16751675

1676-
if (displayName != vmInstance.getDisplayName()) {
1676+
if (!displayName.equals(vmInstance.getDisplayName())) {
16771677
description += "New display name: " + displayName + ". ";
16781678
}
16791679

0 commit comments

Comments
 (0)