String#sum with negative argument causes NativeException
--------------------------------------------------------

                 Key: JRUBY-1010
                 URL: http://jira.codehaus.org/browse/JRUBY-1010
             Project: JRuby
          Issue Type: Bug
          Components: Core Classes/Modules
    Affects Versions: JRuby 1.0.0RC2
         Environment: Windows XP, Java 1.6
            Reporter: Daniel Berger
            Priority: Minor


String#sum with a negative argument appears to be legitimate. JRuby raises an 
ugly NativeException. Just try "hello".sum(-1) or any similar test to see what 
I mean:

NativeException: java.lang.ArithmeticException: / by zero
    RubyString.java:3278:in `org.jruby.RubyString.sum'
    null:-1:in `org.jruby.RubyStringInvokersumxx1.call'
    FastInvocationCallback.java:49:in 
`org.jruby.runtime.callback.FastInvocationCallback.execute'
    SimpleCallbackMethod.java:81:in 
`org.jruby.internal.runtime.methods.SimpleCallbackMethod.call'
    EvaluationState.java:558:in `org.jruby.evaluator.EvaluationState.callNode'
    EvaluationState.java:205:in 
`org.jruby.evaluator.EvaluationState.evalInternal'
    EvaluationState.java:2154:in `org.jruby.evaluator.EvaluationState.setupArgs'
    EvaluationState.java:997:in `org.jruby.evaluator.EvaluationState.fCallNode'
    EvaluationState.java:251:in 
`org.jruby.evaluator.EvaluationState.evalInternal'
    EvaluationState.java:521:in `org.jruby.evaluator.EvaluationState.blockNode'
    EvaluationState.java:199:in 
`org.jruby.evaluator.EvaluationState.evalInternal'
    EvaluationState.java:162:in `org.jruby.evaluator.EvaluationState.eval'
    DefaultMethod.java:185:in 
`org.jruby.internal.runtime.methods.DefaultMethod.internalCall'
    DynamicMethod.java:79:in 
`org.jruby.internal.runtime.methods.DynamicMethod.call'
    DefaultMethod.java:133:in 
`org.jruby.internal.runtime.methods.DefaultMethod.call'
    RubyObject.java:572:in `org.jruby.RubyObject.callMethod'
    RubyObject.java:463:in `org.jruby.RubyObject.callMethod'
    RubyObject.java:1412:in `org.jruby.RubyObject.send'
    null:-1:in `org.jruby.RubyObjectInvokersendxx1.call'
...
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

Reply via email to