Skip to content

Commit e750b98

Browse files
authored
Merge pull request #455 from yu-shiba/fix-npe-for-env_home-returns-null
NPE System.getenv(ENV_HOME) returns null on Windows
2 parents 43a48b0 + cbce44e commit e750b98

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

util/src/main/java/io/kubernetes/client/util/ClientBuilder.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,9 +118,12 @@ private static File findConfigFromEnv() {
118118
}
119119

120120
private static File findHomeDir() {
121-
final File config = new File(System.getenv(ENV_HOME));
122-
if (config.exists()) {
123-
return config;
121+
final String envHome = System.getenv(ENV_HOME);
122+
if (envHome != null && envHome.length() > 0) {
123+
final File config = new File(envHome);
124+
if (config.exists()) {
125+
return config;
126+
}
124127
}
125128
if (System.getProperty("os.name").toLowerCase().startsWith("windows")) {
126129
String homeDrive = System.getenv("HOMEDRIVE");

0 commit comments

Comments
 (0)