Skip to content

Commit ee4d514

Browse files
committed
close an opened stream
1 parent 863995c commit ee4d514

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/main/java/org/kohsuke/github/GHRelease.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,12 @@ static GHRelease[] wrap(GHRelease[] releases, GHRepository owner) {
126126
* handling of the HTTP requests to github's API.
127127
*/
128128
public GHAsset uploadAsset(File file, String contentType) throws IOException {
129-
return uploadAsset(file.getName(), new FileInputStream(file), contentType);
129+
FileInputStream s = new FileInputStream(file);
130+
try {
131+
return uploadAsset(file.getName(), s, contentType);
132+
} finally {
133+
s.close();
134+
}
130135
}
131136

132137
public GHAsset uploadAsset(String filename, InputStream stream, String contentType) throws IOException {

0 commit comments

Comments
 (0)