Title: [877] trunk/rails-integration/src/main/java/org/jruby/webapp:
JRUBY-1913 - Avoid RubyIO.closed, which isn't in JRuby 1.1RC1
- Revision
- 877
- Author
- tantalon
- Date
- 2008-01-09 16:18:01 -0500 (Wed, 09 Jan 2008)
Log Message
JRUBY-1913 - Avoid RubyIO.closed, which isn't in JRuby 1.1RC1
Modified Paths
Diff
Modified: trunk/rails-integration/src/main/java/org/jruby/webapp/HttpOutput.java (876 => 877)
--- trunk/rails-integration/src/main/java/org/jruby/webapp/HttpOutput.java 2008-01-09 19:39:47 UTC (rev 876)
+++ trunk/rails-integration/src/main/java/org/jruby/webapp/HttpOutput.java 2008-01-09 21:18:01 UTC (rev 877)
@@ -147,8 +147,17 @@
response.flushBuffer();
}
+ /**
+ * Close the response.
+ * This may be called multiple times.
+ */
public void close() throws IOException {
- getOutput().close();
+ OutputStream output = getOutput();
+ try {
+ output.close();
+ } catch (IOException exception) {
+ // ignore failure to close, may already be closed
+ }
response.flushBuffer();
}
Modified: trunk/rails-integration/src/main/java/org/jruby/webapp/RailsServlet.java (876 => 877)
--- trunk/rails-integration/src/main/java/org/jruby/webapp/RailsServlet.java 2008-01-09 19:39:47 UTC (rev 876)
+++ trunk/rails-integration/src/main/java/org/jruby/webapp/RailsServlet.java 2008-01-09 21:18:01 UTC (rev 877)
@@ -72,8 +72,9 @@
}
protected void dispatchRequest(Ruby runtime, HttpServletRequest request, HttpServletResponse response) throws Exception {
+ HttpOutput httpOutput = new HttpOutput(response);
RubyIO stdin = new RubyIO(runtime, request.getInputStream());
- RubyIO output = new RubyIO(runtime, new HttpOutput(response));
+ RubyIO output = new RubyIO(runtime, httpOutput);
// setup the environment
setupEnvironment(runtime, request);
@@ -105,9 +106,7 @@
dispatcher.callMethod(runtime.getCurrentContext(), "dispatch", args);
} finally {
// ensure the response is sent
- if (!output.closed().isTrue()) {
- output.close();
- }
+ httpOutput.close();
}
}
_______________________________________________
Jruby-extras-devel mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/jruby-extras-devel