Skip to content

Commit 5cd760b

Browse files
Spotless and invert condition
1 parent e034d20 commit 5cd760b

File tree

1 file changed

+29
-29
lines changed

1 file changed

+29
-29
lines changed

x-pack/plugin/repository-encrypted/src/main/java/org/elasticsearch/repositories/encrypted/EncryptedRepositoryPlugin.java

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public class EncryptedRepositoryPlugin extends Plugin implements RepositoryPlugi
5353
ENCRYPTED_REPOSITORY_FEATURE_FLAG_REGISTERED = null;
5454
} else {
5555
throw new IllegalArgumentException(
56-
"expected es.encrypted_repository_feature_flag_registered to be unset or [true|false] but was [" + property + "]"
56+
"expected es.encrypted_repository_feature_flag_registered to be unset or [true|false] but was [" + property + "]"
5757
);
5858
}
5959
}
@@ -97,8 +97,8 @@ public Map<String, Repository.Factory> getRepositories(
9797
}
9898
final Map<String, SecureString> repositoryPasswordsMap = Map.copyOf(repositoryPasswordsMapBuilder);
9999

100-
if (false == Build.CURRENT.isSnapshot() && (ENCRYPTED_REPOSITORY_FEATURE_FLAG_REGISTERED == null ||
101-
ENCRYPTED_REPOSITORY_FEATURE_FLAG_REGISTERED == false)) {
100+
if (false == Build.CURRENT.isSnapshot()
101+
&& (ENCRYPTED_REPOSITORY_FEATURE_FLAG_REGISTERED == null || ENCRYPTED_REPOSITORY_FEATURE_FLAG_REGISTERED == false)) {
102102
return Map.of();
103103
}
104104

@@ -117,17 +117,17 @@ public Repository create(RepositoryMetadata metadata, Function<String, Repositor
117117
}
118118
if (REPOSITORY_TYPE_NAME.equals(delegateType)) {
119119
throw new IllegalArgumentException(
120-
"Cannot encrypt an already encrypted repository. ["
121-
+ DELEGATE_TYPE_SETTING.getKey()
122-
+ "] must not be equal to ["
123-
+ REPOSITORY_TYPE_NAME
124-
+ "]"
120+
"Cannot encrypt an already encrypted repository. ["
121+
+ DELEGATE_TYPE_SETTING.getKey()
122+
+ "] must not be equal to ["
123+
+ REPOSITORY_TYPE_NAME
124+
+ "]"
125125
);
126126
}
127127
final Repository.Factory factory = typeLookup.apply(delegateType);
128128
if (null == factory || false == SUPPORTED_ENCRYPTED_TYPE_NAMES.contains(delegateType)) {
129129
throw new IllegalArgumentException(
130-
"Unsupported delegate repository type [" + delegateType + "] for setting [" + DELEGATE_TYPE_SETTING.getKey() + "]"
130+
"Unsupported delegate repository type [" + delegateType + "] for setting [" + DELEGATE_TYPE_SETTING.getKey() + "]"
131131
);
132132
}
133133
final String repositoryPasswordName = PASSWORD_NAME_SETTING.get(metadata.settings());
@@ -137,38 +137,38 @@ public Repository create(RepositoryMetadata metadata, Function<String, Repositor
137137
final SecureString repositoryPassword = repositoryPasswordsMap.get(repositoryPasswordName);
138138
if (repositoryPassword == null) {
139139
throw new IllegalArgumentException(
140-
"Secure setting ["
141-
+ ENCRYPTION_PASSWORD_SETTING.getConcreteSettingForNamespace(repositoryPasswordName).getKey()
142-
+ "] must be set"
140+
"Secure setting ["
141+
+ ENCRYPTION_PASSWORD_SETTING.getConcreteSettingForNamespace(repositoryPasswordName).getKey()
142+
+ "] must be set"
143143
);
144144
}
145145
final Repository delegatedRepository = factory.create(
146-
new RepositoryMetadata(metadata.name(), delegateType, metadata.settings())
146+
new RepositoryMetadata(metadata.name(), delegateType, metadata.settings())
147147
);
148148
if (false == (delegatedRepository instanceof BlobStoreRepository) || delegatedRepository instanceof EncryptedRepository) {
149149
throw new IllegalArgumentException("Unsupported delegate repository type [" + DELEGATE_TYPE_SETTING.getKey() + "]");
150150
}
151151
if (false == getLicenseState().isAllowed(XPackLicenseState.Feature.ENCRYPTED_SNAPSHOT)) {
152152
logger.warn(
153-
new ParameterizedMessage(
154-
"Encrypted snapshots are not allowed for the currently installed license [{}]."
155-
+ " Snapshots to the [{}] encrypted repository are not permitted."
156-
+ " All the other operations, including restore, work without restrictions.",
157-
getLicenseState().getOperationMode().description(),
158-
metadata.name()
159-
),
160-
LicenseUtils.newComplianceException("encrypted snapshots")
153+
new ParameterizedMessage(
154+
"Encrypted snapshots are not allowed for the currently installed license [{}]."
155+
+ " Snapshots to the [{}] encrypted repository are not permitted."
156+
+ " All the other operations, including restore, work without restrictions.",
157+
getLicenseState().getOperationMode().description(),
158+
metadata.name()
159+
),
160+
LicenseUtils.newComplianceException("encrypted snapshots")
161161
);
162162
}
163163
return createEncryptedRepository(
164-
metadata,
165-
registry,
166-
clusterService,
167-
bigArrays,
168-
recoverySettings,
169-
(BlobStoreRepository) delegatedRepository,
170-
() -> getLicenseState(),
171-
repositoryPassword
164+
metadata,
165+
registry,
166+
clusterService,
167+
bigArrays,
168+
recoverySettings,
169+
(BlobStoreRepository) delegatedRepository,
170+
() -> getLicenseState(),
171+
repositoryPassword
172172
);
173173
}
174174
});

0 commit comments

Comments
 (0)