@@ -152,18 +152,15 @@ def write_body(response)
152
152
@body . call response . getOutputStream
153
153
elsif @body . respond_to? ( :to_path ) # send_file
154
154
send_file @body . to_path , response
155
- elsif @body . respond_to? ( :to_channel ) &&
156
- ! object_polluted_with_anyio? ( @body , :to_channel )
155
+ elsif @body . respond_to? ( :to_channel )
157
156
body = @body . to_channel # so that we close the channel
158
157
transfer_channel body , response . getOutputStream
159
- elsif @body . respond_to? ( :to_inputstream ) &&
160
- ! object_polluted_with_anyio? ( @body , :to_inputstream )
158
+ elsif @body . respond_to? ( :to_inputstream )
161
159
body = @body . to_inputstream # so that we close the stream
162
160
body = Channels . newChannel ( body ) # closing the channel closes the stream
163
161
transfer_channel body , response . getOutputStream
164
162
elsif @body . respond_to? ( :body_parts ) && ! @body . respond_to? ( :stream ) &&
165
- ( body_parts = @body . body_parts ) . respond_to? ( :to_channel ) &&
166
- ! object_polluted_with_anyio? ( body_parts , :to_channel )
163
+ ( body_parts = @body . body_parts ) . respond_to? ( :to_channel )
167
164
# ActionDispatch::Response "raw" body access in case it's a File
168
165
body = body_parts . to_channel # so that we close the channel
169
166
transfer_channel body , response . getOutputStream
@@ -290,21 +287,6 @@ def transfer_channel(channel, output_stream)
290
287
end
291
288
end
292
289
293
- # Fixnum should not have this method, and it shouldn't be on Object
294
- @@object_polluted = ( Fixnum . method ( :to_channel ) . owner == Object ) rescue nil # :nodoc
295
-
296
- # See http://bugs.jruby.org/5444 - we need to account for pre-1.6 JRuby
297
- # where Object was polluted with #to_channel ( by IOJavaAddions.AnyIO )
298
- def object_polluted_with_anyio? ( obj , meth ) # :nodoc
299
- @@object_polluted && begin
300
- # The object should not have this method, and
301
- # it shouldn't be on Object
302
- obj . method ( meth ) . owner == Object
303
- rescue
304
- false
305
- end
306
- end
307
-
308
290
end
309
291
end
310
292
end
0 commit comments