Bug fixes for issues found while running spotbugs tool (#353)

This commit is contained in:
Milis 2018-03-20 13:53:54 -07:00 коммит произвёл GitHub
Родитель 68df2d7943
Коммит 7e63fd96c4
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
8 изменённых файлов: 30 добавлений и 30 удалений

Просмотреть файл

@ -192,7 +192,7 @@ class CdnEndpointImpl extends ExternalChildResourceImpl<CdnEndpoint,
@Override
public Observable<CdnEndpoint> refreshAsync() {
final CdnEndpointImpl self = this;
return refreshAsync().flatMap(new Func1<CdnEndpoint, Observable<CdnEndpoint>>() {
return super.refreshAsync().flatMap(new Func1<CdnEndpoint, Observable<CdnEndpoint>>() {
@Override
public Observable<CdnEndpoint> call(CdnEndpoint cdnEndpoint) {
self.customDomainList.clear();
@ -200,13 +200,14 @@ class CdnEndpointImpl extends ExternalChildResourceImpl<CdnEndpoint,
return self.parent().manager().inner().customDomains().listByEndpointAsync(
self.parent().resourceGroupName(),
self.parent().name(),
self.name()).flatMap(new Func1<Page<CustomDomainInner>, Observable<CdnEndpoint>>() {
@Override
public Observable<CdnEndpoint> call(Page<CustomDomainInner> customDomainInnerPage) {
self.customDomainList.addAll(customDomainInnerPage.items());
return Observable.just((CdnEndpoint) self);
}
});
self.name())
.flatMap(new Func1<Page<CustomDomainInner>, Observable<CdnEndpoint>>() {
@Override
public Observable<CdnEndpoint> call(Page<CustomDomainInner> customDomainInnerPage) {
self.customDomainList.addAll(customDomainInnerPage.items());
return Observable.just((CdnEndpoint) self);
}
});
}
});
}

Просмотреть файл

@ -115,8 +115,6 @@ public class VirtualMachineScaleSetImpl
// reference to an existing storage account to be used for virtual machines child resources that
// requires storage [OS disk]
private List<StorageAccount> existingStorageAccountsToAssociate = new ArrayList<>();
// Name of the container in the storage account to use to store the disks
private String vhdContainerName;
// the child resource extensions
private Map<String, VirtualMachineScaleSetExtension> extensions;
// reference to the primary and internal Internet facing load balancer
@ -1539,12 +1537,10 @@ public class VirtualMachineScaleSetImpl
return;
}
String containerName = this.vhdContainerName;
if (containerName == null) {
for (String containerUrl : storageProfile.osDisk().vhdContainers()) {
containerName = containerUrl.substring(containerUrl.lastIndexOf("/") + 1);
break;
}
String containerName = null;
for (String containerUrl : storageProfile.osDisk().vhdContainers()) {
containerName = containerUrl.substring(containerUrl.lastIndexOf("/") + 1);
break;
}
if (containerName == null) {
@ -1569,7 +1565,6 @@ public class VirtualMachineScaleSetImpl
.vhdContainers()
.add(mergePath(storageAccount.endPoints().primary().blob(), containerName));
}
this.vhdContainerName = null;
this.creatableStorageAccountKeys.clear();
this.existingStorageAccountsToAssociate.clear();
}

Просмотреть файл

@ -57,7 +57,7 @@ class MXRecordSetImpl
for (MxRecord recordToRemove : this.recordSetRemoveInfo.mxRecords()) {
for (MxRecord record : resource.mxRecords()) {
if (record.exchange().equalsIgnoreCase(recordToRemove.exchange())
&& (record.preference() == recordToRemove.preference())) {
&& (record.preference().equals(recordToRemove.preference()))) {
resource.mxRecords().remove(record);
break;
}

Просмотреть файл

@ -111,7 +111,7 @@ class PublicIPAddressImpl
@Override
public PublicIPAddressImpl withReverseFqdn(String reverseFqdn) {
this.inner().dnsSettings().withReverseFqdn(reverseFqdn.toLowerCase());
this.inner().dnsSettings().withReverseFqdn(reverseFqdn != null ? reverseFqdn.toLowerCase() : null);
return this;
}

Просмотреть файл

@ -395,7 +395,10 @@ class Token {
}
boolean isTerminalMatched(Character charToMatch) {
return terminalChar == charToMatch;
if (terminalChar == null && charToMatch == null) {
return true;
}
return terminalChar != null && charToMatch != null && terminalChar.equals(charToMatch);
}
boolean isTerminalCharNull() {

Просмотреть файл

@ -81,7 +81,6 @@ class SqlDatabaseImpl
SqlDatabaseOperations.SqlDatabaseOperationsDefinition {
private SqlElasticPoolsAsExternalChildResourcesImpl sqlElasticPools;
private TaskGroup.HasTaskGroup parentSqlElasticPool;
protected SqlServerManager sqlServerManager;
protected String resourceGroupName;
@ -109,7 +108,6 @@ class SqlDatabaseImpl
this.sqlServerLocation = parent.regionName();
this.sqlElasticPools = null;
this.parentSqlElasticPool = null;
this.isPatchUpdate = false;
this.importRequestInner = null;
}
@ -133,7 +131,6 @@ class SqlDatabaseImpl
this.sqlServerLocation = sqlServerLocation;
this.sqlElasticPools = new SqlElasticPoolsAsExternalChildResourcesImpl(this.sqlServerManager, "SqlElasticPool");
this.parentSqlElasticPool = null;
this.isPatchUpdate = false;
this.importRequestInner = null;
}
@ -153,7 +150,6 @@ class SqlDatabaseImpl
this.sqlServerManager = sqlServerManager;
this.sqlElasticPools = new SqlElasticPoolsAsExternalChildResourcesImpl(this.sqlServerManager, "SqlElasticPool");
this.parentSqlElasticPool = null;
this.isPatchUpdate = false;
this.importRequestInner = null;
}
@ -587,9 +583,6 @@ class SqlDatabaseImpl
@Override
public void beforeGroupCreateOrUpdate() {
if (parentSqlElasticPool != null) {
this.addParentDependency(parentSqlElasticPool);
}
if (this.importRequestInner != null && this.elasticPoolName() != null) {
final SqlDatabaseImpl self = this;
final String epName = this.elasticPoolName();

Просмотреть файл

@ -1375,9 +1375,11 @@ public final class Utils {
String jdkPath = System.getProperty("java.home");
if (jdkPath != null && !jdkPath.isEmpty()) {
jdkPath = jdkPath.concat("\\bin");
}
if (new File(jdkPath).isDirectory()) {
command = String.format("%s%s%s", jdkPath, File.separator, command);
if (new File(jdkPath).isDirectory()) {
command = String.format("%s%s%s", jdkPath, File.separator, command);
}
} else {
return;
}
// Create Pfx file

Просмотреть файл

@ -2,4 +2,10 @@
<Match>
<Bug pattern="UWF_UNWRITTEN_FIELD"/>
</Match>
<Match>
<Bug pattern="EI_EXPOSE_REP"/>
</Match>
<Match>
<Bug pattern="EI_EXPOSE_REP2"/>
</Match>
</FindBugsFilter>