File.truncate raises NativeException when passed a negative byte value
----------------------------------------------------------------------
Key: JRUBY-1025
URL: http://jira.codehaus.org/browse/JRUBY-1025
Project: JRuby
Issue Type: Bug
Components: Core Classes/Modules
Affects Versions: JRuby 1.0.0RC2
Environment: OS X 10.4.9, Java 1.5, JRuby rev 3672
Reporter: Daniel Berger
Priority: Minor
Fix For: JRuby 1.0.0RC3
This should raise some form of Errno, if not Errno::EINVAL exactly:
{noformat}
assert_raises(Errno::EINVAL){ File.truncate(@fname1, -1)
{noformat}
Currently, this dumps:
{noformat}
Class: <NativeException>
Message: <"java.lang.IllegalArgumentException: null">
---Backtrace---
FileChannelImpl.java:324:in `sun.nio.ch.FileChannelImpl.truncate'
IOHandlerSeekable.java:429:in `org.jruby.util.IOHandlerSeekable.truncate'
RubyFile.java:438:in `org.jruby.RubyFile.truncate'
RubyFile.java:1003:in `org.jruby.RubyFile.truncate'
null:-1:in `org.jruby.RubyFileInvokerStruncate2.call'
FastInvocationCallback.java:49:in
`org.jruby.runtime.callback.FastInvocationCallback.execute'
SimpleCallbackMethod.java:81:in
`org.jruby.internal.runtime.methods.SimpleCallbackMethod.call'
EvaluationState.java:568:in `org.jruby.evaluator.EvaluationState.callNode'
EvaluationState.java:207:in `org.jruby.evaluator.EvaluationState.evalInternal'
EvaluationState.java:164:in `org.jruby.evaluator.EvaluationState.eval'
Block.java:220:in `org.jruby.runtime.Block.yield'
...
{noformat}
and so on
--
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