GWTShellServlet was keeping files locked too long due to extra inefficient connection acquisition.

Review by: bobv (desk)


git-svn-id: https://google-web-toolkit.googlecode.com/svn/trunk@3270 8db76d5a-ed1c-0410-87a9-c151d255dfc7
diff --git a/dev/core/src/com/google/gwt/dev/shell/GWTShellServlet.java b/dev/core/src/com/google/gwt/dev/shell/GWTShellServlet.java
index 399bec6..56c4651 100644
--- a/dev/core/src/com/google/gwt/dev/shell/GWTShellServlet.java
+++ b/dev/core/src/com/google/gwt/dev/shell/GWTShellServlet.java
@@ -29,6 +29,7 @@
 import com.google.gwt.dev.util.HttpHeaders;
 import com.google.gwt.dev.util.Util;
 import com.google.gwt.dev.util.log.ServletContextTreeLogger;
+import com.google.gwt.util.tools.Utility;
 
 import org.apache.commons.collections.map.AbstractReferenceMap;
 import org.apache.commons.collections.map.ReferenceIdentityMap;
@@ -526,17 +527,10 @@
       }
 
       // Send the bytes.
-      is = foundResource.openStream();
+      is = conn.getInputStream();
       streamOut(is, response.getOutputStream(), 1024 * 8);
     } finally {
-      if (is != null) {
-        try {
-          is.close();
-        } catch (IOException swallowed) {
-          // Nothing we can do now.
-          //
-        }
-      }
+      Utility.close(is);
     }
   }
 
@@ -919,6 +913,7 @@
         out.write(buffer, 0, bytesRead);
       } else {
         // End of input stream.
+        out.flush();
         return;
       }
     }