Skip to content

Commit

Permalink
Merge pull request #1225 from synopsys-arc-oss/jenkins22693-inputstre…
Browse files Browse the repository at this point in the history
…am-fix

[FIXED JENKINS-22693] - Properly close InputStreams in FileParameterValue
  • Loading branch information
oleg-nenashev committed Jun 1, 2014
2 parents e7ca7ae + 8767ddb commit d2fb6d9
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion core/src/main/java/hudson/model/FileParameterValue.java
Expand Up @@ -257,7 +257,12 @@ public long getSize() {

public byte[] get() {
try {
return IOUtils.toByteArray(new FileInputStream(file));
FileInputStream inputStream = new FileInputStream(file);
try {
return IOUtils.toByteArray(inputStream);
} finally {
inputStream.close();
}
} catch (IOException e) {
throw new Error(e);
}
Expand Down Expand Up @@ -293,6 +298,7 @@ public boolean isFormField() {
public void setFormField(boolean state) {
}

@Deprecated
public OutputStream getOutputStream() throws IOException {
return new FileOutputStream(file);
}
Expand Down

0 comments on commit d2fb6d9

Please sign in to comment.