mirror of https://github.com/jenkinsci/jenkins.git
[FIXED JENKINS-8686]
As I mentioned in the comment, I doubt if this makes any behaviour change, but this seems like a sensible defensive measure that wouldn't hurt.
This commit is contained in:
parent
548373fad1
commit
dc94b7d063
|
|
@ -300,14 +300,14 @@ public class CLI {
|
|||
byte[] buf = new byte[1024];
|
||||
try {
|
||||
InputStream is = conn.getInputStream();
|
||||
while (is.read(buf) > 0) {
|
||||
while (is.read(buf) >= 0) {
|
||||
// Ignore
|
||||
}
|
||||
is.close();
|
||||
} catch (IOException e) {
|
||||
try {
|
||||
InputStream es = ((HttpURLConnection)conn).getErrorStream();
|
||||
while (es.read(buf) > 0) {
|
||||
while (es.read(buf) >= 0) {
|
||||
// Ignore
|
||||
}
|
||||
es.close();
|
||||
|
|
|
|||
|
|
@ -399,7 +399,7 @@ public abstract class Proc {
|
|||
try {
|
||||
byte[] buf = new byte[8192];
|
||||
int len;
|
||||
while ((len = in.read(buf)) > 0) {
|
||||
while ((len = in.read(buf)) >= 0) {
|
||||
out.write(buf, 0, len);
|
||||
out.flush();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -451,7 +451,7 @@ public class Util {
|
|||
public static void copyStream(InputStream in,OutputStream out) throws IOException {
|
||||
byte[] buf = new byte[8192];
|
||||
int len;
|
||||
while((len=in.read(buf))>0)
|
||||
while((len=in.read(buf))>=0)
|
||||
out.write(buf,0,len);
|
||||
}
|
||||
|
||||
|
|
@ -562,7 +562,7 @@ public class Util {
|
|||
byte[] buffer = new byte[1024];
|
||||
DigestInputStream in =new DigestInputStream(source,md5);
|
||||
try {
|
||||
while(in.read(buffer)>0)
|
||||
while(in.read(buffer)>=0)
|
||||
; // simply discard the input
|
||||
} finally {
|
||||
in.close();
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ public class StreamCopyThread extends Thread {
|
|||
try {
|
||||
byte[] buf = new byte[8192];
|
||||
int len;
|
||||
while ((len = in.read(buf)) > 0)
|
||||
while ((len = in.read(buf)) >= 0)
|
||||
out.write(buf, 0, len);
|
||||
} finally {
|
||||
// it doesn't make sense not to close InputStream that's already EOF-ed,
|
||||
|
|
|
|||
|
|
@ -71,7 +71,7 @@ final class ZipArchiver extends Archiver {
|
|||
zip.putNextEntry(fileZipEntry);
|
||||
FileInputStream in = new FileInputStream(f);
|
||||
int len;
|
||||
while((len=in.read(buf))>0)
|
||||
while((len=in.read(buf))>=0)
|
||||
zip.write(buf,0,len);
|
||||
in.close();
|
||||
zip.closeEntry();
|
||||
|
|
|
|||
Loading…
Reference in New Issue