Skip to content

Commit 353060e

Browse files
committed
Revert "Findbugs: different issues solved"
This reverts commit dcda79e.
1 parent 1aa1b3e commit 353060e

9 files changed

Lines changed: 75 additions & 97 deletions

File tree

‎server/src/com/cloud/api/query/vo/UserVmJoinVO.java‎

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@
3535
import com.cloud.storage.Storage.StoragePoolType;
3636
import com.cloud.storage.Volume;
3737
import com.cloud.utils.db.GenericDao;
38-
import com.cloud.utils.exception.CloudRuntimeException;
3938
import com.cloud.vm.VirtualMachine;
4039
import com.cloud.vm.VirtualMachine.State;
4140

@@ -48,10 +47,10 @@ public class UserVmJoinVO extends BaseViewVO implements ControlledViewEntity {
4847
private long id;
4948

5049
@Column(name="name", updatable=false, nullable=false, length=255)
51-
private final String name = null;
50+
private String name = null;
5251

5352
@Column(name="display_name", updatable=false, nullable=false, length=255)
54-
private final String displayName = null;
53+
private String displayName = null;
5554

5655
@Column(name="account_id")
5756
private long accountId;
@@ -60,7 +59,7 @@ public class UserVmJoinVO extends BaseViewVO implements ControlledViewEntity {
6059
private String accountUuid;
6160

6261
@Column(name="account_name")
63-
private final String accountName = null;
62+
private String accountName = null;
6463

6564
@Column(name="account_type")
6665
private short accountType;
@@ -72,10 +71,10 @@ public class UserVmJoinVO extends BaseViewVO implements ControlledViewEntity {
7271
private String domainUuid;
7372

7473
@Column(name="domain_name")
75-
private final String domainName = null;
74+
private String domainName = null;
7675

7776
@Column(name="domain_path")
78-
private final String domainPath = null;
77+
private String domainPath = null;
7978

8079
@Column(name="instance_group_id")
8180
private long instanceGroupId;
@@ -97,7 +96,7 @@ public class UserVmJoinVO extends BaseViewVO implements ControlledViewEntity {
9796
*/
9897
@Enumerated(value=EnumType.STRING)
9998
@Column(name="state", updatable=true, nullable=false, length=32)
100-
private final State state = null;
99+
private State state = null;
101100

102101
@Column(name=GenericDao.CREATED_COLUMN)
103102
private Date created;
@@ -150,7 +149,7 @@ public class UserVmJoinVO extends BaseViewVO implements ControlledViewEntity {
150149
private String dataCenterUuid;
151150

152151
@Column(name="data_center_name")
153-
private final String dataCenterName = null;
152+
private String dataCenterName = null;
154153

155154
@Column(name="security_group_enabled")
156155
private boolean securityGroupEnabled;
@@ -226,7 +225,7 @@ public class UserVmJoinVO extends BaseViewVO implements ControlledViewEntity {
226225
private String volume_uuid;
227226

228227
@Column(name = "volume_device_id")
229-
private final Long volumeDeviceId = null;
228+
private Long volumeDeviceId = null;
230229

231230
@Column(name = "volume_type")
232231
@Enumerated(EnumType.STRING)
@@ -727,11 +726,9 @@ public Map<String, String> getDetails() {
727726
}
728727

729728
public String getDetail(String name) {
730-
if (details == null) {
731-
throw new CloudRuntimeException("No details to get. Did you forget to load the details?");
732-
}
729+
assert (details != null) : "Did you forget to load the details?";
733730

734-
return details.get(name);
731+
return details != null ? details.get(name) : null;
735732
}
736733

737734
public String getUserData() {

‎server/src/com/cloud/consoleproxy/AgentHookBase.java‎

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,6 @@
2222

2323
import org.apache.log4j.Logger;
2424

25-
import com.google.gson.Gson;
26-
import com.google.gson.GsonBuilder;
27-
28-
import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
29-
3025
import com.cloud.agent.AgentManager;
3126
import com.cloud.agent.api.AgentControlAnswer;
3227
import com.cloud.agent.api.Answer;
@@ -49,10 +44,14 @@
4944
import com.cloud.servlet.ConsoleProxyPasswordBasedEncryptor;
5045
import com.cloud.servlet.ConsoleProxyServlet;
5146
import com.cloud.utils.Ternary;
52-
import com.cloud.utils.exception.CloudRuntimeException;
5347
import com.cloud.vm.VirtualMachine;
5448
import com.cloud.vm.dao.VMInstanceDao;
5549

50+
import com.google.gson.Gson;
51+
import com.google.gson.GsonBuilder;
52+
53+
import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
54+
5655
/**
5756
* Utility class to manage interactions with agent-based console access
5857
* Extracted from ConsoleProxyManagerImpl so that other console proxy managers
@@ -73,12 +72,12 @@ public abstract class AgentHookBase implements AgentHook {
7372

7473
public AgentHookBase(VMInstanceDao instanceDao, HostDao hostDao, ConfigurationDao cfgDao, KeystoreManager ksMgr,
7574
AgentManager agentMgr, ManagementServer ms) {
76-
_instanceDao = instanceDao;
77-
_hostDao = hostDao;
78-
_agentMgr = agentMgr;
79-
_configDao = cfgDao;
80-
_ksMgr = ksMgr;
81-
_ms = ms;
75+
this._instanceDao = instanceDao;
76+
this._hostDao = hostDao;
77+
this._agentMgr = agentMgr;
78+
this._configDao = cfgDao;
79+
this._ksMgr = ksMgr;
80+
this._ms = ms;
8281
}
8382

8483
@Override
@@ -205,9 +204,7 @@ public void startAgentHttpHandlerInVM(StartupProxyCommand startupCmd) {
205204

206205
assert (ksBits != null);
207206
if (ksBits == null) {
208-
String msg = "Could not find and construct a valid SSL certificate";
209-
s_logger.error(msg);
210-
throw new CloudRuntimeException(msg);
207+
s_logger.error("Could not find and construct a valid SSL certificate");
211208
}
212209
cmd = new StartConsoleProxyAgentHttpHandlerCommand(ksBits, storePassword);
213210
cmd.setEncryptorPassword(getEncryptorPassword());

‎server/src/com/cloud/consoleproxy/ConsoleProxyManagerImpl.java‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -971,7 +971,11 @@ public boolean isZoneReady(Map<Long, ZoneHostInfo> zoneHostInfoMap, long dataCen
971971
}
972972
} else {
973973
if (s_logger.isDebugEnabled()) {
974-
s_logger.debug("Zone host is ready, but console proxy template: " + template.getId() + " is not ready on secondary storage.");
974+
if (template == null) {
975+
s_logger.debug("Zone host is ready, but console proxy template is null");
976+
} else {
977+
s_logger.debug("Zone host is ready, but console proxy template: " + template.getId() + " is not ready on secondary storage.");
978+
}
975979
}
976980
}
977981
}

‎server/src/com/cloud/dc/DedicatedResourceVO.java‎

Lines changed: 6 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020

2121
import javax.persistence.Column;
2222
import javax.persistence.Entity;
23+
2324
import javax.persistence.GeneratedValue;
2425
import javax.persistence.GenerationType;
2526
import javax.persistence.Id;
@@ -30,11 +31,6 @@
3031
@Table(name="dedicated_resources")
3132
public class DedicatedResourceVO implements DedicatedResources{
3233

33-
/**
34-
*
35-
*/
36-
private static final long serialVersionUID = -6659510127145101917L;
37-
3834
@Id
3935
@GeneratedValue(strategy = GenerationType.IDENTITY)
4036
@Column(name="id")
@@ -65,7 +61,7 @@ public class DedicatedResourceVO implements DedicatedResources{
6561
private long affinityGroupId;
6662

6763
public DedicatedResourceVO() {
68-
uuid = UUID.randomUUID().toString();
64+
this.uuid = UUID.randomUUID().toString();
6965
}
7066

7167
public DedicatedResourceVO(Long dataCenterId, Long podId, Long clusterId, Long hostId, Long domainId,
@@ -76,16 +72,14 @@ public DedicatedResourceVO(Long dataCenterId, Long podId, Long clusterId, Long h
7672
this.hostId = hostId;
7773
this.domainId = domainId;
7874
this.accountId = accountId;
79-
uuid = UUID.randomUUID().toString();
75+
this.uuid = UUID.randomUUID().toString();
8076
this.affinityGroupId = affinityGroupId;
8177
}
8278

83-
@Override
8479
public long getId() {
8580
return id;
8681
}
8782

88-
@Override
8983
public Long getDataCenterId() {
9084
return dataCenterId;
9185
}
@@ -94,7 +88,6 @@ public void setDataCenterId(long dataCenterId) {
9488
this.dataCenterId = dataCenterId;
9589
}
9690

97-
@Override
9891
public Long getPodId() {
9992
return podId;
10093
}
@@ -103,7 +96,6 @@ public void setPodId(long podId) {
10396
this.podId = podId;
10497
}
10598

106-
@Override
10799
public Long getClusterId() {
108100
return clusterId;
109101
}
@@ -112,7 +104,6 @@ public void setClusterId(long clusterId) {
112104
this.clusterId = clusterId;
113105
}
114106

115-
@Override
116107
public Long getHostId() {
117108
return hostId;
118109
}
@@ -122,10 +113,9 @@ public void setHostId(long hostId) {
122113
}
123114

124115
public DedicatedResourceVO(long dedicatedResourceId) {
125-
id = dedicatedResourceId;
116+
this.id = dedicatedResourceId;
126117
}
127118

128-
@Override
129119
public Long getDomainId() {
130120
return domainId;
131121
}
@@ -134,7 +124,6 @@ public void setDomainId(Long domainId) {
134124
this.domainId = domainId;
135125
}
136126

137-
@Override
138127
public Long getAccountId() {
139128
return accountId;
140129
}
@@ -143,24 +132,22 @@ public void setAccountId(Long accountId) {
143132
this.accountId = accountId;
144133
}
145134

146-
@Override
147135
public String getUuid() {
148-
return uuid;
136+
return this.uuid;
149137
}
150138

151139
public void setUuid(String uuid) {
152140
this.uuid = uuid;
153141
}
154142

155-
@Override
156143
public long getAffinityGroupId() {
157144
return affinityGroupId;
158145
}
159146

160147
@Override
161148
public boolean equals(Object obj) {
162149
if (obj instanceof DedicatedResourceVO) {
163-
return ((DedicatedResourceVO) obj).getId() == getId();
150+
return ((DedicatedResourceVO) obj).getId() == this.getId();
164151
} else {
165152
return false;
166153
}

0 commit comments

Comments
 (0)