Skip to content

Instantly share code, notes, and snippets.

@calavera
Created February 10, 2011 11:48
Show Gist options
  • Save calavera/820392 to your computer and use it in GitHub Desktop.
Save calavera/820392 to your computer and use it in GitHub Desktop.
From 2e053f4983ed4c7c95f783a5dc12804ae618d4b3 Mon Sep 17 00:00:00 2001
From: David Calavera <david.calavera@gmail.com>
Date: Thu, 10 Feb 2011 13:51:53 +0100
Subject: [PATCH] more accurate fix for JRUBY_RACK-38
---
src/main/ruby/jruby/rack/response.rb | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/src/main/ruby/jruby/rack/response.rb b/src/main/ruby/jruby/rack/response.rb
index 82b5053..75539e0 100644
--- a/src/main/ruby/jruby/rack/response.rb
+++ b/src/main/ruby/jruby/rack/response.rb
@@ -104,7 +104,8 @@ class JRuby::Rack::Response
retry
rescue NativeException => e
# Don't needlessly raise errors because of client abort exceptions
- raise unless e.cause.to_s =~ /(clientabortexception|broken pipe)/i
+ raise unless e.cause.to_s =~ /(clientabortexception|broken pipe)/i ||
+ e.cause.java_class.to_s =~ /(clientabortexception|broken pipe)/i
ensure
@body.close if @body.respond_to?(:close)
end
--
1.7.0.4
@calavera
Copy link
Author

mmmm this is weird because Tomcat's ClientAbortException overrides toString to include the class name but `to_s' doesn't show it:

jruby-1.5.6 :004 > e = org.apache.catalina.connector.ClientAbortException.new('null') 
 => ClientAbortException:  null 
jruby-1.5.6 :005 > e.to_s
 => "null" 
jruby-1.5.6 :006 > e.toString
 => "ClientAbortException:  null" 
jruby-1.5.6 :007 >

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment