Skip to content

Commit

Permalink
Use try with resource
Browse files Browse the repository at this point in the history
  • Loading branch information
maxlaverse committed Jul 16, 2018
1 parent 37d1af3 commit 61e8d47
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public String writeKubeConfig() throws IOException, InterruptedException {
if (wasContextProvided()) {
useContext(configFile.getRemote(), this.contextName);
}
if(this.wasServerUrlProvided()){
if (this.wasServerUrlProvided()) {
launcher.getListener().getLogger().println("the serverUrl will be ignored as a raw kubeconfig file was provided");
}
} else {
Expand All @@ -99,9 +99,9 @@ public String writeKubeConfig() throws IOException, InterruptedException {
* @throws InterruptedException on file operations
*/
private void setRawKubeConfig(FilePath configFile, FileCredentials credentials) throws IOException, InterruptedException {
OutputStream output = configFile.write();
IOUtils.copy(credentials.getContent(), output);
output.close();
try (OutputStream output = configFile.write()) {
IOUtils.copy(credentials.getContent(), output);
}
}

/**
Expand Down

0 comments on commit 61e8d47

Please sign in to comment.