Fix other stupid string comparsions

This commit is contained in:
Frank 2011-05-06 10:21:05 -07:00
parent cbe368ef69
commit 4e2935dc37
2 changed files with 2 additions and 2 deletions

View File

@ -513,7 +513,7 @@ public class ConfigurationServerImpl implements ConfigurationServer {
String already = _configDao.getValue("ssh.privatekey");
String homeDir = Script.runSimpleBashScript("echo ~");
String userid = System.getProperty("user.name");
if (homeDir == "~") {
if (homeDir != null && homeDir.equalsIgnoreCase("~")) {
s_logger.error("No home directory was detected. Set the HOME environment variable to point to your user profile or home directory.");
throw new CloudRuntimeException("No home directory was detected. Set the HOME environment variable to point to your user profile or home directory.");
}

View File

@ -1450,7 +1450,7 @@ public class UserVmManagerImpl implements UserVmManager, UserVmService, Manager
throw new CloudRuntimeException("Unable to find storage pools in zone " + zoneId);
}
pool = storagePools.get(0);
if (snapshot.getVersion() == "2.1") {
if (snapshot.getVersion() != null && snapshot.getVersion().equalsIgnoreCase("2.1")) {
VolumeVO volume = _volsDao.findByIdIncludingRemoved(volumeId);
if (volume == null) {
throw new CloudRuntimeException("failed to upgrade snapshot " + snapshotId + " due to unable to find orignal volume:" + volumeId + ", try it later ");