Skip to content

Commit

Permalink
handle null file configs (when removed) when notified of changes
Browse files Browse the repository at this point in the history
this change is required by the change in ConfigWatcher at
redhat-developer/intellij-common#202

Signed-off-by: Andre Dietisheim <[email protected]>
  • Loading branch information
adietish committed Nov 20, 2023
1 parent fd5082f commit 47a13a4
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ sinceIdeaBuild=232
projectVersion=1.2.1-SNAPSHOT
jetBrainsToken=invalid
jetBrainsChannel=stable
intellijPluginVersion=1.15.0
intellijPluginVersion=1.16.0
intellijCommonVersion=1.9.3-SNAPSHOT
telemetryPluginVersion=1.0.0.44
kotlin.stdlib.default.dependency = false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -245,12 +245,13 @@ open class AllContexts(
* The latter gets closed/recreated whenever the context changes in
* [com.redhat.devtools.intellij.kubernetes.model.client.KubeConfigAdapter].
*/
val watcher = ConfigWatcher(path) { _, config -> onKubeConfigChanged(config) }
val watcher = ConfigWatcher(path) { _, config: io.fabric8.kubernetes.api.model.Config? -> onKubeConfigChanged(config) }
runAsync(watcher::run)
}

protected open fun onKubeConfigChanged(fileConfig: io.fabric8.kubernetes.api.model.Config) {
protected open fun onKubeConfigChanged(fileConfig: io.fabric8.kubernetes.api.model.Config?) {
synchronized(this) {
fileConfig ?: return
val client = client.get() ?: return
val clientConfig = client.config.configuration
if (ConfigHelper.areEqual(fileConfig, clientConfig)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -550,7 +550,7 @@ class AllContextsTest {
}

/** override with public method so that it can be tested**/
public override fun onKubeConfigChanged(fileConfig: Config) {
public override fun onKubeConfigChanged(fileConfig: Config?) {
super.onKubeConfigChanged(fileConfig)
}

Expand Down

0 comments on commit 47a13a4

Please sign in to comment.