Skip to content

Commit 887c041

Browse files
authored
Various Java cleanups (#122)
Signed-off-by: Mickael Maison <mickael.maison@gmail.com>
1 parent 76cdc49 commit 887c041

File tree

6 files changed

+13
-21
lines changed

6 files changed

+13
-21
lines changed

operator/src/main/java/io/strimzi/kafka/access/SecretDependentResource.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ public Map<String, String> desired(final KafkaAccessSpec spec, final String name
8989
try {
9090
listener = KafkaParser.getKafkaListener(kafka, spec, kafkaUserType);
9191
} catch (CustomResourceParseException e) {
92-
LOGGER.error("Reconcile failed due to ParserException " + e.getMessage());
92+
LOGGER.error("Reconcile failed due to ParserException {}", e.getMessage(), e);
9393
throw e;
9494
}
9595
if (listener.isTls()) {

operator/src/main/java/io/strimzi/kafka/access/internal/KafkaAccessMapper.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
import java.util.stream.Stream;
3030

3131
/**
32-
* Maps Strimzi and Kuberentes resources to and from KafkaAccess resources
32+
* Maps Strimzi and Kubernetes resources to and from KafkaAccess resources
3333
*/
3434
public class KafkaAccessMapper {
3535

operator/src/main/java/io/strimzi/kafka/access/internal/KafkaListener.java

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -138,20 +138,12 @@ public Map<String, String> getConnectionSecretData() {
138138
}
139139

140140
private SecurityProtocol getSecurityProtocol() {
141-
final SecurityProtocol securityProtocol;
142-
switch (this.authenticationType) {
143-
case LISTENER_AUTH_NONE:
144-
securityProtocol = this.tls ? SecurityProtocol.SSL : SecurityProtocol.PLAINTEXT;
145-
break;
146-
case KafkaListenerAuthenticationTls.TYPE_TLS:
147-
securityProtocol = SecurityProtocol.SSL;
148-
break;
149-
case KafkaListenerAuthenticationScramSha512.SCRAM_SHA_512:
150-
securityProtocol = this.tls ? SecurityProtocol.SASL_SSL : SecurityProtocol.SASL_PLAINTEXT;
151-
break;
152-
default:
153-
securityProtocol = SecurityProtocol.PLAINTEXT;
154-
}
155-
return securityProtocol;
141+
return switch (this.authenticationType) {
142+
case LISTENER_AUTH_NONE -> this.tls ? SecurityProtocol.SSL : SecurityProtocol.PLAINTEXT;
143+
case KafkaListenerAuthenticationTls.TYPE_TLS -> SecurityProtocol.SSL;
144+
case KafkaListenerAuthenticationScramSha512.SCRAM_SHA_512 ->
145+
this.tls ? SecurityProtocol.SASL_SSL : SecurityProtocol.SASL_PLAINTEXT;
146+
default -> SecurityProtocol.PLAINTEXT;
147+
};
156148
}
157149
}

operator/src/main/java/io/strimzi/kafka/access/internal/MissingKubernetesResourceException.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
package io.strimzi.kafka.access.internal;
66

77
/**
8-
* The class for exception when Kuberentes resources are missing
8+
* The class for exception when Kubernetes resources are missing
99
*/
1010
public class MissingKubernetesResourceException extends RuntimeException {
1111
/**

operator/src/test/java/io/strimzi/kafka/access/KafkaAccessReconcilerTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,11 +72,11 @@ public class KafkaAccessReconcilerTest {
7272
@BeforeEach
7373
void beforeEach() {
7474
operator = new Operator(overrider -> overrider.withKubernetesClient(client)
75-
/**
75+
/*
7676
* Disables the use of Server-Side Apply for patching the primary resource.
7777
* Motivation: Mock Kubernetes client doesn't fully support SSA features.
7878
* See: <a href="https://github.com/fabric8io/kubernetes-client/issues/5337">fabric8io/kubernetes-client Issue #5337</a>
79-
**/
79+
*/
8080
.withUseSSAToPatchPrimaryResource(false));
8181
operator.register(new KafkaAccessReconciler(operator.getKubernetesClient()));
8282
operator.start();

systemtest/src/main/java/io/strimzi/kafka/access/log/MustGatherImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ private Path checkPathAndReturnFullRootPathWithIndexFolder(Path rootPathToLogsFo
125125
// check if there is actually something in the list of folders
126126
if (!indexes.isEmpty()) {
127127
// take the highest index and increase it by one for a new directory
128-
index = Integer.parseInt(indexes.get(indexes.size() - 1)) + 1;
128+
index = Integer.parseInt(indexes.getLast()) + 1;
129129
}
130130
}
131131
}

0 commit comments

Comments
 (0)