Clean up usages of IOUtils.closeQuietly and related calls (#2830)

* Clean up usages of IOUtils.closeQuietly and related calls predating Java 7.

* Review comments from @oleg-nenashev.

* Noticed another place where try-with-resources would protect against a potential leak.
This commit is contained in:
Jesse Glick authored and Oleg Nenashev committed 2017-04-08 00:41:27 +02:00
1 parent 77804c1451
commit 23cb13aad0
25 files changed
+131 -207

No files matched your search

+2 -4
View File
@@ -33,8 +33,6 @@ import com.thoughtworks.xstream.core.util.Base64Encoder;
import hudson.util.IOUtils;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.io.Writer;
@@ -174,11 +172,11 @@ public class Main {
con.connect();
// send the data
try (InputStream in = Files.newInputStream(tmpFile.toPath())) {
Util.copyStream(in,con.getOutputStream());
org.apache.commons.io.IOUtils.copy(in, con.getOutputStream());
}
if(con.getResponseCode()!=200) {
Util.copyStream(con.getErrorStream(),System.err);
org.apache.commons.io.IOUtils.copy(con.getErrorStream(), System.err);
}
return ret;