simple code compiled with jrubyc throws StringIndexOutOfBoundsException from jre
--------------------------------------------------------------------------------

                 Key: JRUBY-5920
                 URL: https://jira.codehaus.org/browse/JRUBY-5920
             Project: JRuby
          Issue Type: Bug
          Components: Compiler
    Affects Versions: JRuby 1.6.3, JRuby 1.6.2, JRuby 1.6.1
         Environment: Linux Slackware 13.1 32bits

$ java -version
java version "1.6.0_25"
Java(TM) SE Runtime Environment (build 1.6.0_25-b06)
Java HotSpot(TM) Server VM (build 20.0-b11, mixed mode)

$ ruby -v
ruby 1.9.1p378 (2010-01-10 revision 26273) [i486-linux]

            Reporter: Alexandre Barros


A very simple ruby script, when trying to run the ahead-of-time compiled .class 
from the JRE, it throws a nasty exception ( working directory 
./jruby-1.6.3/samples ) :

{noformat} 
$ cat >teste.rb
a = Hash.new();
a["lala"] = 1;
a["lele"] = 2;
puts a.to_s;
^D

$ ruby ./teste.rb
{"lala"=>1, "lele"=>2}

$ jruby ./teste.rb
lala1lele2

$ ../bin/jrubyc ./teste.rb
Compiling ./teste.rb to class teste

$ java -cp .:../lib/jruby.jar teste
Exception in thread "main" java.lang.StringIndexOutOfBoundsException: String 
index out of range: 13
        at java.lang.String.charAt(String.java:686)
        at 
org.jruby.ast.executable.RuntimeCache.getDescriptorValue(RuntimeCache.java:323)
        at 
org.jruby.ast.executable.RuntimeCache.initOthers(RuntimeCache.java:318)
        at 
org.jruby.ast.executable.RuntimeCache.initFromDescriptor(RuntimeCache.java:252)
        at 
org.jruby.ast.executable.AbstractScript.initFromDescriptor(AbstractScript.java:374)
        at teste.<init>(./teste.rb)
        at teste.main(./teste.rb)
{noformat} 

the same code on JRUBY 1.6.0 runs fine ( despite some formatting the 
hashes.to_s ), the working directory this time is ./jruby-1.6.0/samples :

{noformat} 
$ cat >teste.rb
a = Hash.new();
a["lala"] = 1;
a["lele"] = 2;
puts a.to_s;
^D

$ ruby ./teste.rb
{"lala"=>1, "lele"=>2}

$ ../bin/jruby ./teste.rb
lala1lele2

$ ../bin/jrubyc teste.rb
Compiling teste.rb to class teste

$ java -cp .:../lib/jruby.jar teste
lala1lele2
{noformat} 

--
This message is automatically generated by JIRA.
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