Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[FIXED JENKINS-22693] - Properly close InputStreams in FileParameterV…
…alue

Signed-off-by: Oleg Nenashev <o.v.nenashev@gmail.com>
  • Loading branch information
oleg-nenashev committed May 5, 2014
1 parent 1568a8b commit 8767ddb
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 8767ddb

Please sign in to comment.