RubyStringIO error when handling multipart/form-data in a Ruby on Rails app ---------------------------------------------------------------------------
Key: JRUBY-3631 URL: http://jira.codehaus.org/browse/JRUBY-3631 Project: JRuby Issue Type: Bug Components: Core Classes/Modules Affects Versions: JRuby 1.2 Environment: OS X 10.5.6 JRuby 1.2.0 Rails 2.3.2 Java 1.6.0_07 mongrel 1.1.5 / jetty_rails 0.8 / glassfish gem 0.9.3 Safari 4 / Firefox 3.0.10 Reporter: George Agnelli Priority: Blocker Attachments: rails-upload-test.zip When posting a form with multipart/form-data encoding I get the following exception and the rails controller action is never executed. This happens for me every time whether or not there is any data in the form fields. I have tested with mongrel 1.1.5, jetty_rails 0.8, glassfish gem 0.9.3 and the result is the same. I have attached the view and controller from a rails application that is experiencing this issue. Exception in thread "Thread-12" java.lang.ArrayIndexOutOfBoundsException at org.jruby.util.ByteList.grow(ByteList.java:616) at org.jruby.util.ByteList.unsafeReplace(ByteList.java:335) at org.jruby.util.ByteList.replace(ByteList.java:351) at org.jruby.RubyStringIO.read(RubyStringIO.java:605) at org.jruby.RubyStringIO$i_method_0_2$RUBYINVOKER$read.call(org/jruby/RubyStringIO$i_method_0_2$RUBYINVOKER$read.gen) at org.jruby.internal.runtime.methods.JavaMethod$JavaMethodN.call(JavaMethod.java:624) at org.jruby.RubyClass.finvoke(RubyClass.java:391) at org.jruby.RubyObject.send(RubyObject.java:1409) at org.jruby.RubyObject$i_method_multi$RUBYINVOKER$send.call(org/jruby/RubyObject$i_method_multi$RUBYINVOKER$send.gen) at org.jruby.runtime.callsite.CachingCallSite.callBlock(CachingCallSite.java:199) at org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:206) at org.jruby.ast.CallSpecialArgBlockPassNode.interpret(CallSpecialArgBlockPassNode.java:68) at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:104) at org.jruby.ast.BlockNode.interpret(BlockNode.java:71) at org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java:259) at org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:189) at org.jruby.RubyClass.finvoke(RubyClass.java:410) at org.jruby.javasupport.util.RuntimeHelpers.invoke(RuntimeHelpers.java:382) at org.jruby.javasupport.util.RuntimeHelpers.callMethodMissingInternal(RuntimeHelpers.java:356) at org.jruby.javasupport.util.RuntimeHelpers.callMethodMissing(RuntimeHelpers.java:324) at org.jruby.runtime.callsite.CachingCallSite.callMethodMissing(CachingCallSite.java:351) at org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:290) at org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:152) at org.jruby.ast.CallTwoArgNode.interpret(CallTwoArgNode.java:59) at org.jruby.ast.DAsgnNode.interpret(DAsgnNode.java:110) at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:104) at org.jruby.ast.BlockNode.interpret(BlockNode.java:71) at org.jruby.ast.UntilNode.interpret(UntilNode.java:120) at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:104) at org.jruby.ast.BlockNode.interpret(BlockNode.java:71) at org.jruby.runtime.InterpretedBlock.evalBlockBody(InterpretedBlock.java:192) at org.jruby.runtime.InterpretedBlock.yield(InterpretedBlock.java:143) at org.jruby.runtime.Block.yield(Block.java:100) at org.jruby.RubyKernel.loop(RubyKernel.java:1084) at org.jruby.RubyKernel$s_method_0_0$RUBYFRAMEDINVOKER$loop.call(org/jruby/RubyKernel$s_method_0_0$RUBYFRAMEDINVOKER$loop.gen) at org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:263) at org.jruby.runtime.callsite.CachingCallSite.callBlock(CachingCallSite.java:81) at org.jruby.runtime.callsite.CachingCallSite.callIter(CachingCallSite.java:96) at org.jruby.ast.FCallNoArgBlockNode.interpret(FCallNoArgBlockNode.java:32) at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:104) at org.jruby.ast.BlockNode.interpret(BlockNode.java:71) at org.jruby.ast.IfNode.interpret(IfNode.java:112) at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:104) at org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java:163) at org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:144) at org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:273) at org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:112) at org.jruby.ast.CallOneArgNode.interpret(CallOneArgNode.java:57) at org.jruby.ast.AttrAssignTwoArgNode.interpret(AttrAssignTwoArgNode.java:36) at org.jruby.ast.IfNode.interpret(IfNode.java:106) at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:104) at org.jruby.ast.BlockNode.interpret(BlockNode.java:71) at org.jruby.ast.IfNode.interpret(IfNode.java:112) at org.jruby.ast.IfNode.interpret(IfNode.java:114) at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:104) at org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java:125) at org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:126) at org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:70) at org.jruby.ast.CallNoArgNode.interpret(CallNoArgNode.java:61) at org.jruby.ast.CallOneArgNode.interpret(CallOneArgNode.java:57) at org.jruby.ast.OrNode.interpret(OrNode.java:94) at org.jruby.ast.LocalAsgnNode.interpret(LocalAsgnNode.java:123) at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:104) at org.jruby.ast.BlockNode.interpret(BlockNode.java:71) at org.jruby.ast.IfNode.interpret(IfNode.java:112) at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:104) at org.jruby.ast.BlockNode.interpret(BlockNode.java:71) at org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java:163) at org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:144) at org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:110) at org.jruby.ast.CallOneArgNode.interpret(CallOneArgNode.java:57) at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:104) at org.jruby.ast.BlockNode.interpret(BlockNode.java:71) at org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java:163) at org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:144) at org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:110) at org.jruby.ast.CallOneArgNode.interpret(CallOneArgNode.java:57) at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:104) at org.jruby.ast.BlockNode.interpret(BlockNode.java:71) at org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java:163) at org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:144) at org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:110) at org.jruby.ast.CallOneArgNode.interpret(CallOneArgNode.java:57) at org.jruby.ast.ToAryNode.interpret(ToAryNode.java:69) at org.jruby.ast.MultipleAsgnNode.interpret(MultipleAsgnNode.java:116) at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:104) at org.jruby.ast.BlockNode.interpret(BlockNode.java:71) at org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java:163) at org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:144) at org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:110) at org.jruby.ast.CallOneArgNode.interpret(CallOneArgNode.java:57) at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:104) at org.jruby.ast.BlockNode.interpret(BlockNode.java:71) at org.jruby.ast.EnsureNode.interpret(EnsureNode.java:96) at org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java:163) at org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:144) at org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:110) at org.jruby.ast.CallOneArgNode.interpret(CallOneArgNode.java:57) at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:104) at org.jruby.ast.RescueNode.executeBody(RescueNode.java:225) at org.jruby.ast.RescueNode.interpretWithJavaExceptions(RescueNode.java:147) at org.jruby.ast.RescueNode.interpret(RescueNode.java:110) at org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java:163) at org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:144) at org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:110) at org.jruby.ast.CallOneArgNode.interpret(CallOneArgNode.java:57) at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:104) at org.jruby.runtime.InterpretedBlock.evalBlockBody(InterpretedBlock.java:192) at org.jruby.runtime.InterpretedBlock.yield(InterpretedBlock.java:143) at org.jruby.runtime.Block.yield(Block.java:100) at org.jruby.libraries.ThreadLibrary$Mutex.synchronize(ThreadLibrary.java:150) at org.jruby.libraries.ThreadLibrary$Mutex$i_method_0_0$RUBYINVOKER$synchronize.call(org/jruby/libraries/ThreadLibrary$Mutex$i_method_0_0$RUBYINVOKER$synchronize.gen) at org.jruby.runtime.callsite.CachingCallSite.callBlock(CachingCallSite.java:79) at org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:86) at org.jruby.ast.CallNoArgBlockNode.interpret(CallNoArgBlockNode.java:64) at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:104) at org.jruby.ast.BlockNode.interpret(BlockNode.java:71) at org.jruby.ast.EnsureNode.interpret(EnsureNode.java:96) at org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java:163) at org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:144) at org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:110) at org.jruby.ast.CallOneArgNode.interpret(CallOneArgNode.java:57) at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:104) at org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java:163) at org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:144) at org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:110) at org.jruby.ast.CallOneArgNode.interpret(CallOneArgNode.java:57) at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:104) at org.jruby.ast.BlockNode.interpret(BlockNode.java:71) at org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java:163) at org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:144) at org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:110) at org.jruby.ast.CallOneArgNode.interpret(CallOneArgNode.java:57) at org.jruby.ast.ReturnNode.interpret(ReturnNode.java:88) at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:104) at org.jruby.ast.BlockNode.interpret(BlockNode.java:71) at org.jruby.runtime.InterpretedBlock.evalBlockBody(InterpretedBlock.java:192) at org.jruby.runtime.InterpretedBlock.yield(InterpretedBlock.java:143) at org.jruby.runtime.Block.yield(Block.java:100) at org.jruby.RubyArray.each(RubyArray.java:1562) at org.jruby.RubyArray$i_method_0_0$RUBYFRAMEDINVOKER$each.call(org/jruby/RubyArray$i_method_0_0$RUBYFRAMEDINVOKER$each.gen) at org.jruby.runtime.callsite.CachingCallSite.callBlock(CachingCallSite.java:79) at org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:86) at org.jruby.ast.CallNoArgBlockNode.interpret(CallNoArgBlockNode.java:64) at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:104) at org.jruby.ast.BlockNode.interpret(BlockNode.java:71) at org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java:163) at org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:144) at org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:110) at org.jruby.ast.CallOneArgNode.interpret(CallOneArgNode.java:57) at org.jruby.ast.LocalAsgnNode.interpret(LocalAsgnNode.java:123) at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:104) at org.jruby.ast.BlockNode.interpret(BlockNode.java:71) at org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java:163) at org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:144) at org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:110) at org.jruby.ast.CallOneArgNode.interpret(CallOneArgNode.java:57) at org.jruby.ast.ToAryNode.interpret(ToAryNode.java:69) at org.jruby.ast.MultipleAsgnNode.interpret(MultipleAsgnNode.java:116) at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:104) at org.jruby.ast.BlockNode.interpret(BlockNode.java:71) at org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java:163) at org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:144) at org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:110) at org.jruby.ast.CallOneArgNode.interpret(CallOneArgNode.java:57) at org.jruby.ast.ToAryNode.interpret(ToAryNode.java:69) at org.jruby.ast.MultipleAsgnNode.interpret(MultipleAsgnNode.java:116) at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:104) at org.jruby.ast.BlockNode.interpret(BlockNode.java:71) at org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java:163) at org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:144) at org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:110) at org.jruby.ast.CallOneArgNode.interpret(CallOneArgNode.java:57) at org.jruby.ast.ToAryNode.interpret(ToAryNode.java:69) at org.jruby.ast.MultipleAsgnNode.interpret(MultipleAsgnNode.java:116) at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:104) at org.jruby.ast.BlockNode.interpret(BlockNode.java:71) at org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java:201) at org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:162) at org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:150) at org.jruby.ast.CallTwoArgNode.interpret(CallTwoArgNode.java:59) at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:104) at org.jruby.ast.BlockNode.interpret(BlockNode.java:71) at org.jruby.runtime.InterpretedBlock.evalBlockBody(InterpretedBlock.java:192) at org.jruby.runtime.InterpretedBlock.yield(InterpretedBlock.java:143) at org.jruby.runtime.Block.yield(Block.java:100) at org.jruby.RubyArray.each(RubyArray.java:1562) at org.jruby.RubyArray$i_method_0_0$RUBYFRAMEDINVOKER$each.call(org/jruby/RubyArray$i_method_0_0$RUBYFRAMEDINVOKER$each.gen) at org.jruby.runtime.callsite.CachingCallSite.callBlock(CachingCallSite.java:79) at org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:86) at org.jruby.ast.CallNoArgBlockNode.interpret(CallNoArgBlockNode.java:64) at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:104) at org.jruby.ast.BlockNode.interpret(BlockNode.java:71) at org.jruby.ast.IfNode.interpret(IfNode.java:112) at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:104) at org.jruby.ast.BlockNode.interpret(BlockNode.java:71) at org.jruby.ast.IfNode.interpret(IfNode.java:112) at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:104) at org.jruby.ast.BlockNode.interpret(BlockNode.java:71) at org.jruby.ast.WhileNode.interpret(WhileNode.java:131) at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:104) at org.jruby.ast.BlockNode.interpret(BlockNode.java:71) at org.jruby.ast.RescueNode.executeBody(RescueNode.java:225) at org.jruby.ast.RescueNode.interpretWithJavaExceptions(RescueNode.java:147) at org.jruby.ast.RescueNode.interpret(RescueNode.java:110) at org.jruby.ast.EnsureNode.interpret(EnsureNode.java:96) at org.jruby.ast.BeginNode.interpret(BeginNode.java:83) at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:104) at org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java:163) at org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:144) at org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:110) at org.jruby.ast.FCallOneArgNode.interpret(FCallOneArgNode.java:36) at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:104) at org.jruby.runtime.InterpretedBlock.evalBlockBody(InterpretedBlock.java:192) at org.jruby.runtime.InterpretedBlock.yield(InterpretedBlock.java:180) at org.jruby.runtime.BlockBody.call(BlockBody.java:65) at org.jruby.runtime.BlockBody.call(BlockBody.java:71) at org.jruby.runtime.Block.call(Block.java:80) at org.jruby.RubyProc.call(RubyProc.java:204) at org.jruby.RubyProc.call(RubyProc.java:187) at org.jruby.internal.runtime.RubyRunnable.run(RubyRunnable.java:90) at java.lang.Thread.run(Thread.java:637) -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email