File#truncate blows up JRuby on files from within JAR files -----------------------------------------------------------
Key: JRUBY-2357 URL: http://jira.codehaus.org/browse/JRUBY-2357 Project: JRuby Issue Type: Bug Components: Core Classes/Modules Affects Versions: JRuby 1.1 Environment: Latest JRuby 1.1 Reporter: Vladimir Sizikov Assignee: Vladimir Sizikov Fix For: JRuby 1.1.1 The following example (executed in JRuby's test directory): {noformat} File.open("file:test_jar2.jar!/test_value.rb", "r+") { |f| f.truncate(2) } {noformat} terminates JRuby with the following exception: {noformat} Exception in thread "main" java.lang.ClassCastException: java.nio.channels.Channels$ReadableByteChannelImpl cannot be cast to java.nio.channels.FileChannel at org.jruby.util.io.ChannelStream.invalidateBuffer(ChannelStream.java:698) at org.jruby.util.io.ChannelStream.ftruncate(ChannelStream.java:670) at org.jruby.RubyFile.truncate(RubyFile.java:611) at org.jruby.RubyFileInvoker$truncate_method_1_0.call(Unknown Source) at org.jruby.runtime.CallSite$InlineCachingCallSite.cacheAndCall(CallSite.java:146) at org.jruby.runtime.CallSite$InlineCachingCallSite.call(CallSite.java:302) at ruby.opt.work.samples.jar_minus_trunkate.closure_0_0(jar-trunkate.rb:2) at ruby.opt.work.samples.jar_minus_trunkateBlockCallback$closure_0_0xx1.call(Unknown Source) at org.jruby.runtime.CompiledBlockLight.yield(CompiledBlockLight.java:107) at org.jruby.runtime.CompiledBlockLight.yield(CompiledBlockLight.java:88) at org.jruby.runtime.Block.yield(Block.java:109) at org.jruby.RubyIO.open(RubyIO.java:878) at org.jruby.RubyIOInvoker$open_s_method_1_2.call(Unknown Source) at org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:90) at org.jruby.runtime.CallSite$InlineCachingCallSite.cacheAndCall(CallSite.java:191) at org.jruby.runtime.CallSite$InlineCachingCallSite.call(CallSite.java:347) at ruby.opt.work.samples.jar_minus_trunkate.__file__(jar-trunkate.rb:1) at ruby.opt.work.samples.jar_minus_trunkate.load(jar-trunkate.rb) at org.jruby.Ruby.runScript(Ruby.java:511) at org.jruby.Ruby.runNormally(Ruby.java:431) at org.jruby.Ruby.runFromMain(Ruby.java:311) at org.jruby.Main.run(Main.java:141) at org.jruby.Main.run(Main.java:88) at org.jruby.Main.main(Main.java:79) {noformat} -- 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