From 01254c1a88a18a1563ab210759c87b29d624c816 Mon Sep 17 00:00:00 2001 From: hns Date: Sun, 27 Oct 2002 18:54:26 +0000 Subject: [PATCH] Use buffered input stream in getURL --- src/helma/scripting/fesi/HopExtension.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/helma/scripting/fesi/HopExtension.java b/src/helma/scripting/fesi/HopExtension.java index 502805af..baaefa22 100644 --- a/src/helma/scripting/fesi/HopExtension.java +++ b/src/helma/scripting/fesi/HopExtension.java @@ -599,14 +599,14 @@ public final class HopExtension { if (con instanceof HttpURLConnection) resCode = ((HttpURLConnection) con).getResponseCode(); ByteArrayOutputStream body = new ByteArrayOutputStream (); - InputStream in = con.getInputStream (); if (length != 0 && resCode != 304) { + InputStream in = new BufferedInputStream(con.getInputStream ()); byte[] b = new byte[1024]; int read; while ((read = in.read (b)) > -1) body.write (b, 0, read); + in.close (); } - in.close (); MimePart mime = new MimePart (filename, body.toByteArray(), contentType); if (lastmod > 0) mime.lastModified = new Date(lastmod);