File#truncate crashes JRuby with NPE when invoked on closed file
----------------------------------------------------------------
Key: JRUBY-2118
URL: http://jira.codehaus.org/browse/JRUBY-2118
Project: JRuby
Issue Type: Bug
Components: Core Classes/Modules
Affects Versions: JRuby 1.1RC1
Environment: Latest JRuby 1.1RC1
Reporter: Vladimir Sizikov
Assignee: Vladimir Sizikov
Priority: Critical
Fix For: JRuby 1.1RC2
Any attempt to truncate closed file leads to:
{noformat}
f=File.open("/tmp/blah.txt", "w+") => #<File:/tmp/blah.txt>
f.truncate(0) => 0
f.close => nil
f.truncate(40)
Exception in thread "main" java.lang.NullPointerException
at org.jruby.RubyFile.truncate(RubyFile.java:613)
at org.jruby.RubyFileInvoker$truncate_method_1_0.call(Unknown Source)
at
org.jruby.internal.runtime.methods.JavaMethod$JavaMethodOne.call(JavaMethod.java:120)
at
org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:66)
at
org.jruby.runtime.CallSite$InlineCachingCallSite.cacheAndCall(CallSite.java:166)
at
org.jruby.runtime.CallSite$InlineCachingCallSite.call(CallSite.java:301)
at org.jruby.evaluator.ASTInterpreter.callNode(ASTInterpreter.java:657)
at
org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:308)
at org.jruby.evaluator.ASTInterpreter.rootNode(ASTInterpreter.java:1615)
at
org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:458)
at org.jruby.evaluator.ASTInterpreter.eval(ASTInterpreter.java:168)
at
org.jruby.evaluator.ASTInterpreter.evalWithBinding(ASTInterpreter.java:222)
at org.jruby.RubyKernel.eval(RubyKernel.java:722)
{noformat}
This also leads to crashes in rubyspecs, since similar rubyspec has been
recently added.
Fix is coming.
--
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