@@ -152,18 +152,15 @@ def write_body(response)
152152 @body . call response . getOutputStream
153153 elsif @body . respond_to? ( :to_path ) # send_file
154154 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 )
157156 body = @body . to_channel # so that we close the channel
158157 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 )
161159 body = @body . to_inputstream # so that we close the stream
162160 body = Channels . newChannel ( body ) # closing the channel closes the stream
163161 transfer_channel body , response . getOutputStream
164162 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 )
167164 # ActionDispatch::Response "raw" body access in case it's a File
168165 body = body_parts . to_channel # so that we close the channel
169166 transfer_channel body , response . getOutputStream
@@ -290,21 +287,6 @@ def transfer_channel(channel, output_stream)
290287 end
291288 end
292289
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-
308290 end
309291 end
310292end
0 commit comments