Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 5cb514d

Browse files
committedMar 9, 2021
fix: avoid NPE when connecting to OpenShift clusters
Relates to fabric8io/kubernetes-client#2856 Fixes #365
1 parent 419f4d4 commit 5cb514d

File tree

1 file changed

+4
-2
lines changed
  • operator-framework-core/src/main/java/io/javaoperatorsdk/operator

1 file changed

+4
-2
lines changed
 

‎operator-framework-core/src/main/java/io/javaoperatorsdk/operator/Operator.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,11 @@ public void start() {
4545
log.info("Client version: {}", Version.clientVersion());
4646
try {
4747
final var k8sVersion = k8sClient.getVersion();
48-
log.info("Server version: {}.{}", k8sVersion.getMajor(), k8sVersion.getMinor());
48+
if (k8sVersion != null) {
49+
log.info("Server version: {}.{}", k8sVersion.getMajor(), k8sVersion.getMinor());
50+
}
4951
} catch (Exception e) {
50-
log.error("Not connected to any cluster. Exiting!");
52+
log.error("Error retrieving the server version. Exiting!", e);
5153
System.exit(1);
5254
}
5355
}

0 commit comments

Comments
 (0)
Please sign in to comment.