Skip to content

Commit 43162bf

Browse files
committed
Error Prone integration - Added error prone to the build
1 parent 6a324da commit 43162bf

File tree

43 files changed

+165
-142
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+165
-142
lines changed

agent/src/main/java/com/cloud/agent/mockvm/MockVmMgr.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ public void freeVncPort(int port) {
249249
public MockVm createVmFromSpec(VirtualMachineTO vmSpec) {
250250
String vmName = vmSpec.getName();
251251
long ramSize = vmSpec.getMinRam();
252-
int utilizationPercent = randSeed.nextInt() % 100;
252+
int utilizationPercent = randSeed.nextInt(100);
253253
MockVm vm = null;
254254

255255
synchronized (this) {

api/src/main/java/org/apache/cloudstack/api/command/admin/backup/UpdateBackupOfferingCmd.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ public Boolean getAllowUserDrivenBackups() {
8383
public void execute() {
8484
try {
8585
if (StringUtils.isAllEmpty(getName(), getDescription()) && getAllowUserDrivenBackups() == null) {
86-
throw new InvalidParameterValueException(String.format("Can't update Backup Offering [id: %s] because there are no parameters to be updated, at least one of the",
86+
throw new InvalidParameterValueException(String.format("Can't update Backup Offering [id: %s] because there are no parameters to be updated, at least one of the " +
8787
"following should be informed: name, description or allowUserDrivenBackups.", id));
8888
}
8989

core/src/main/java/com/cloud/agent/resource/virtualnetwork/facade/AbstractConfigItemFacade.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ public abstract class AbstractConfigItemFacade {
106106

107107
public static AbstractConfigItemFacade getInstance(final Class<? extends NetworkElementCommand> key) {
108108
if (!flyweight.containsKey(key)) {
109-
throw new CloudRuntimeException("Unable to process the configuration for " + key.getClass().getName());
109+
throw new CloudRuntimeException("Unable to process the configuration for " + key.getName());
110110
}
111111

112112
final AbstractConfigItemFacade instance = flyweight.get(key);

core/src/main/java/com/cloud/network/HAProxyConfigurator.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -514,7 +514,7 @@ private List<String> getRulesForPool(final LoadBalancerTO lbTO, final boolean ke
514514
}
515515
dstSubRule.add(sb.toString());
516516
if (stickinessSubRule != null) {
517-
sb.append(" cookie ").append(dest.getDestIp().replace(".", "_")).append('-').append(dest.getDestPort()).toString();
517+
sb.append(" cookie ").append(dest.getDestIp().replace(".", "_")).append('-').append(dest.getDestPort());
518518
dstWithCookieSubRule.add(sb.toString());
519519
}
520520
destsAvailable = true;

core/src/main/java/com/cloud/resource/RequestWrapper.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ protected CommandWrapper<Command, Answer, ServerResource> retrieveCommands(final
8686

8787
keepCommandClass = commandClass2;
8888
} catch (final ClassCastException e) {
89-
throw new CommandNotSupported("No key found for '" + keepCommandClass.getClass() + "' in the Map!");
89+
throw new CommandNotSupported("No key found for '" + keepCommandClass + "' in the Map!");
9090
} catch (final NullPointerException e) {
9191
// Will now traverse all the resource hierarchy. Returning null
9292
// is not a problem.

core/src/main/java/org/apache/cloudstack/agent/directdownload/DirectDownloadCommand.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ protected DirectDownloadCommand (final String url, final Long templateId, final
5252
final Integer soTimeout, final Integer connectionRequestTimeout, final boolean followRedirects) {
5353
this.url = url;
5454
this.templateId = templateId;
55-
this.destData = destData;
5655
this.destPool = destPool;
5756
this.checksum = checksum;
5857
this.headers = headers;

engine/orchestration/src/main/java/com/cloud/agent/manager/AgentAttache.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
import java.util.LinkedList;
2525
import java.util.List;
2626
import java.util.Map;
27+
import java.util.Objects;
2728
import java.util.Random;
2829
import java.util.Set;
2930
import java.util.concurrent.ConcurrentHashMap;
@@ -497,6 +498,11 @@ public void process(final Answer[] answers) {
497498
*/
498499
protected abstract boolean isClosed();
499500

501+
@Override
502+
public int hashCode() {
503+
return Objects.hash(logger, _id, _uuid, _name, _waitForList, _requests, _currentSequence, _status, _maintenance, _nextSequence, _agentMgr);
504+
}
505+
500506
protected class Alarm extends ManagedContextRunnable {
501507
long _seq;
502508

engine/orchestration/src/main/java/com/cloud/agent/manager/DirectAgentAttache.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
import java.util.ArrayList;
2020
import java.util.LinkedList;
2121
import java.util.List;
22+
import java.util.Objects;
2223
import java.util.concurrent.ScheduledFuture;
2324
import java.util.concurrent.TimeUnit;
2425
import java.util.concurrent.atomic.AtomicInteger;
@@ -148,6 +149,11 @@ private synchronized void scheduleFromQueue() {
148149
}
149150
}
150151

152+
@Override
153+
public int hashCode() {
154+
return Objects.hash(super.hashCode(), _HostPingRetryCount, _HostPingRetryTimer, _resource, _futures, _seq, tasks, _outstandingTaskCount, _outstandingCronTaskCount);
155+
}
156+
151157
protected class PingTask extends ManagedContextRunnable {
152158
@Override
153159
protected synchronized void runInContext() {

engine/orchestration/src/main/java/com/cloud/vm/VirtualMachineManagerImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1730,7 +1730,7 @@ public void stop(final String vmUuid) throws ResourceUnavailableException {
17301730
} catch (final OperationTimedoutException e) {
17311731
throw new AgentUnavailableException(String.format("Unable to stop vm [%s] because the operation to stop timed out", vmUuid), e.getAgentId(), e);
17321732
} catch (final ConcurrentOperationException e) {
1733-
throw new CloudRuntimeException(String.format("Unable to stop vm because of a concurrent operation", vmUuid), e);
1733+
throw new CloudRuntimeException(String.format("Unable to stop vm: %s because of a concurrent operation", vmUuid), e);
17341734
}
17351735

17361736
}

engine/orchestration/src/main/java/org/apache/cloudstack/engine/orchestration/NetworkOrchestrator.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1737,7 +1737,7 @@ protected boolean reprogramNetworkRules(final long networkId, final Account call
17371737
final List<FirewallRuleVO> firewallEgressRulesToApply = _firewallDao.listByNetworkPurposeTrafficType(networkId, Purpose.Firewall, FirewallRule.TrafficType.Egress);
17381738
final NetworkOfferingVO offering = _networkOfferingDao.findById(network.getNetworkOfferingId());
17391739
final DataCenter zone = _dcDao.findById(network.getDataCenterId());
1740-
if (_networkModel.areServicesSupportedInNetwork(network.getId(), Service.Firewall) && _networkModel.areServicesSupportedInNetwork(network.getId(), Service.Firewall)
1740+
if (_networkModel.areServicesSupportedInNetwork(network.getId(), Service.Firewall)
17411741
&& (network.getGuestType() == Network.GuestType.Isolated || network.getGuestType() == Network.GuestType.Shared && zone.getNetworkType() == NetworkType.Advanced)) {
17421742
// add default egress rule to accept the traffic
17431743
_firewallMgr.applyDefaultEgressFirewallRule(network.getId(), offering.isEgressDefaultPolicy(), true);

0 commit comments

Comments
 (0)