From 4a039598951073fe3bd0b6778eeb25d25ea3f127 Mon Sep 17 00:00:00 2001 From: Scott Andrews Date: Mon, 20 Oct 2008 14:23:08 +0000 Subject: [PATCH] SWF-917 ResourceServlet crash and add "Error 500" at the end of the streamed resource Applied fix proposed in JIRA --- .../org/springframework/js/resource/ResourceServlet.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/spring-js/src/main/java/org/springframework/js/resource/ResourceServlet.java b/spring-js/src/main/java/org/springframework/js/resource/ResourceServlet.java index d764bb52..9144d5ed 100644 --- a/spring-js/src/main/java/org/springframework/js/resource/ResourceServlet.java +++ b/spring-js/src/main/java/org/springframework/js/resource/ResourceServlet.java @@ -113,9 +113,9 @@ public class ResourceServlet extends HttpServletBean { InputStream in = resourceConn.getInputStream(); try { byte[] buffer = new byte[1024]; - while (in.available() > 0) { - int len = in.read(buffer); - out.write(buffer, 0, len); + int bytesRead = -1; + while ((bytesRead = in.read(buffer)) != -1) { + out.write(buffer, 0, bytesRead); } } finally { in.close();