Skip to content

Commit 4945d46

Browse files
committed
Check all warnings in core and fix where applicable, also apply autoformatting on save.
1 parent bb8b734 commit 4945d46

21 files changed

Lines changed: 640 additions & 635 deletions

core/src/com/cloud/agent/api/MigrateWithStorageAnswer.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,6 @@
2020

2121
import org.apache.cloudstack.storage.to.VolumeObjectTO;
2222

23-
import com.cloud.agent.api.to.DiskTO;
24-
import com.cloud.agent.api.to.VolumeTO;
25-
2623
public class MigrateWithStorageAnswer extends Answer {
2724

2825
List<VolumeObjectTO> volumeTos;

core/src/com/cloud/agent/api/MigrateWithStorageCompleteAnswer.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@
2020

2121
import org.apache.cloudstack.storage.to.VolumeObjectTO;
2222

23-
import com.cloud.agent.api.to.VolumeTO;
24-
2523
public class MigrateWithStorageCompleteAnswer extends Answer {
2624
List<VolumeObjectTO> volumeTos;
2725

core/src/com/cloud/agent/api/RebootCommand.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
// under the License.
1717
package com.cloud.agent.api;
1818

19-
import com.cloud.hypervisor.Hypervisor;
2019
import com.cloud.vm.VirtualMachine;
2120

2221
public class RebootCommand extends Command {

core/src/com/cloud/agent/api/routing/HealthCheckLBConfigAnswer.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020

2121
import com.cloud.agent.api.Answer;
2222
import com.cloud.agent.api.to.LoadBalancerTO;
23-
import com.cloud.agent.api.to.NicTO;
2423

2524
/**
2625
* LoadBalancerConfigCommand sends the load balancer configuration

core/src/com/cloud/agent/api/routing/HealthCheckLBConfigCommand.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
package com.cloud.agent.api.routing;
1818

1919
import com.cloud.agent.api.to.LoadBalancerTO;
20-
import com.cloud.agent.api.to.NicTO;
2120

2221
/**
2322
* LoadBalancerConfigCommand sends the load balancer configuration

core/src/com/cloud/agent/api/routing/SetNetworkACLCommand.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,7 @@
2020
import java.util.Arrays;
2121
import java.util.Collections;
2222
import java.util.Comparator;
23-
import java.util.HashSet;
2423
import java.util.List;
25-
import java.util.Set;
2624

2725
import com.cloud.agent.api.to.NetworkACLTO;
2826
import com.cloud.agent.api.to.NicTO;

core/src/com/cloud/agent/api/storage/UploadCommand.java

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -41,30 +41,30 @@ public UploadCommand(VirtualMachineTemplate template, String url, String install
4141
this.template = new TemplateTO(template);
4242
this.url = url;
4343
this.installPath = installPath;
44-
this.checksum = template.getChecksum();
45-
this.id = template.getId();
46-
this.templateSizeInBytes = sizeInBytes;
44+
checksum = template.getChecksum();
45+
id = template.getId();
46+
templateSizeInBytes = sizeInBytes;
4747

4848
}
4949

5050
public UploadCommand(String url, long id, long sizeInBytes, String installPath, Type type){
51-
this.template = null;
51+
template = null;
5252
this.url = url;
5353
this.installPath = installPath;
5454
this.id = id;
5555
this.type = type;
56-
this.templateSizeInBytes = sizeInBytes;
56+
templateSizeInBytes = sizeInBytes;
5757
}
5858

5959
protected UploadCommand() {
6060
}
6161

6262
public UploadCommand(UploadCommand that) {
63-
this.template = that.template;
64-
this.url = that.url;
65-
this.installPath = that.installPath;
66-
this.checksum = that.getChecksum();
67-
this.id = that.id;
63+
template = that.template;
64+
url = that.url;
65+
installPath = that.installPath;
66+
checksum = that.getChecksum();
67+
id = that.id;
6868
}
6969

7070
public String getDescription() {
@@ -114,7 +114,8 @@ public void setTemplateSizeInBytes(Long templateSizeInBytes) {
114114
this.templateSizeInBytes = templateSizeInBytes;
115115
}
116116

117-
public long getId() {
117+
@Override
118+
public long getId() {
118119
return id;
119120
}
120121

core/src/com/cloud/agent/resource/virtualnetwork/VirtualRoutingResource.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,6 @@ public class VirtualRoutingResource implements Manager {
108108
private String _firewallPath;
109109
private String _loadbPath;
110110
private String _dhcpEntryPath;
111-
private String _vmDataPath;
112111
private String _publicEthIf;
113112
private String _privateEthIf;
114113
private String _bumpUpPriorityPath;

core/src/com/cloud/agent/transport/Request.java

Lines changed: 24 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,6 @@
3131
import org.apache.log4j.Level;
3232
import org.apache.log4j.Logger;
3333

34-
import com.cloud.agent.api.Answer;
35-
import com.cloud.agent.api.Command;
36-
import com.cloud.agent.api.SecStorageFirewallCfgCommand.PortConfig;
37-
import com.cloud.exception.UnsupportedVersionException;
38-
import com.cloud.serializer.GsonHelper;
39-
import com.cloud.utils.NumbersUtil;
40-
import com.cloud.utils.Pair;
41-
import com.cloud.utils.exception.CloudRuntimeException;
4234
import com.google.gson.Gson;
4335
import com.google.gson.JsonArray;
4436
import com.google.gson.JsonDeserializationContext;
@@ -50,6 +42,15 @@
5042
import com.google.gson.JsonSerializer;
5143
import com.google.gson.stream.JsonReader;
5244

45+
import com.cloud.agent.api.Answer;
46+
import com.cloud.agent.api.Command;
47+
import com.cloud.agent.api.SecStorageFirewallCfgCommand.PortConfig;
48+
import com.cloud.exception.UnsupportedVersionException;
49+
import com.cloud.serializer.GsonHelper;
50+
import com.cloud.utils.NumbersUtil;
51+
import com.cloud.utils.Pair;
52+
import com.cloud.utils.exception.CloudRuntimeException;
53+
5354
/**
5455
* Request is a simple wrapper around command and answer to add sequencing,
5556
* versioning, and flags. Note that the version here represents the changes
@@ -107,7 +108,7 @@ public static Version get(final byte ver) throws UnsupportedVersionException {
107108
protected long _agentId;
108109
protected Command[] _cmds;
109110
protected String _content;
110-
111+
111112
protected Request() {
112113
}
113114

@@ -158,14 +159,14 @@ protected void setInSequence(Command[] cmds) {
158159
}
159160

160161
protected Request(final Request that, final Command[] cmds) {
161-
this._ver = that._ver;
162-
this._seq = that._seq;
162+
_ver = that._ver;
163+
_seq = that._seq;
163164
setInSequence(that.executeInSequence());
164165
setStopOnError(that.stopOnError());
165-
this._cmds = cmds;
166-
this._mgmtId = that._mgmtId;
167-
this._via = that._via;
168-
this._agentId = that._agentId;
166+
_cmds = cmds;
167+
_mgmtId = that._mgmtId;
168+
_via = that._via;
169+
_agentId = that._agentId;
169170
setFromServer(!that.isFromServer());
170171
}
171172

@@ -287,7 +288,7 @@ public static ByteBuffer doDecompress(ByteBuffer buffer, int length) {
287288
retBuff.flip();
288289
return retBuff;
289290
}
290-
291+
291292
public static ByteBuffer doCompress(ByteBuffer buffer, int length) {
292293
ByteArrayOutputStream byteOut = new ByteArrayOutputStream(length);
293294
byte[] array;
@@ -307,11 +308,11 @@ public static ByteBuffer doCompress(ByteBuffer buffer, int length) {
307308
}
308309
return ByteBuffer.wrap(byteOut.toByteArray());
309310
}
310-
311+
311312
public ByteBuffer[] toBytes() {
312313
final ByteBuffer[] buffers = new ByteBuffer[2];
313314
ByteBuffer tmp;
314-
315+
315316
if (_content == null) {
316317
_content = s_gson.toJson(_cmds, _cmds.getClass());
317318
}
@@ -372,7 +373,7 @@ public void logT(String msg, boolean logD) {
372373
}
373374
}
374375
}
375-
376+
376377
@Override
377378
public String toString() {
378379
return log("", true, Level.DEBUG);
@@ -447,7 +448,7 @@ public static Request parse(final byte[] bytes) throws ClassNotFoundException, U
447448
if (version.ordinal() != Version.v1.ordinal() && version.ordinal() != Version.v3.ordinal()) {
448449
throw new UnsupportedVersionException("This version is no longer supported: " + version.toString(), UnsupportedVersionException.IncompatibleVersion);
449450
}
450-
final byte reserved = buff.get(); // tossed away for now.
451+
buff.get();
451452
final short flags = buff.getShort();
452453
final boolean isRequest = (flags & FLAG_REQUEST) > 0;
453454

@@ -456,7 +457,7 @@ public static Request parse(final byte[] bytes) throws ClassNotFoundException, U
456457
final int size = buff.getInt();
457458
final long mgmtId = buff.getLong();
458459
final long agentId = buff.getLong();
459-
460+
460461
long via;
461462
if (version.ordinal() == Version.v1.ordinal()) {
462463
via = buff.getLong();
@@ -467,7 +468,7 @@ public static Request parse(final byte[] bytes) throws ClassNotFoundException, U
467468
if ((flags & FLAG_COMPRESSED) != 0) {
468469
buff = doDecompress(buff, size);
469470
}
470-
471+
471472
byte[] command = null;
472473
int offset = 0;
473474
if (buff.hasArray()) {
@@ -519,7 +520,7 @@ public static long getAgentId(final byte[] bytes) {
519520
public static long getViaAgentId(final byte[] bytes) {
520521
return NumbersUtil.bytesToLong(bytes, 32);
521522
}
522-
523+
523524
public static boolean fromServer(final byte[] bytes) {
524525
return (bytes[3] & FLAG_FROM_SERVER) > 0;
525526
}

core/src/com/cloud/exception/UsageServerException.java

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,20 @@
1818

1919
public class UsageServerException extends CloudException {
2020

21-
public UsageServerException() {
22-
23-
}
21+
/**
22+
*
23+
*/
24+
private static final long serialVersionUID = -8398313106067116466L;
25+
26+
public UsageServerException() {
27+
28+
}
29+
30+
public UsageServerException(String message) {
31+
super(message);
32+
}
2433

25-
public UsageServerException(String message) {
26-
super(message);
27-
}
2834

2935

30-
3136

3237
}

0 commit comments

Comments
 (0)