java.lang.ArrayIndexOutOfBoundsException in RubyArray.java
----------------------------------------------------------

                 Key: JRUBY-3339
                 URL: http://jira.codehaus.org/browse/JRUBY-3339
             Project: JRuby
          Issue Type: Bug
          Components: Core Classes/Modules
    Affects Versions: JRuby 1.2
         Environment: jruby 1.1.7 (ruby 1.8.6 patchlevel 287) (2009-01-28 rev 
6586) [i386-java]
Mac OS X 10.5.5 Intel
            Reporter: Martijn Storck


This bug surfaces when trying to load a Truetype font with the (100% Ruby) 
Prawn gem, version 0.4.1. I have been unable to trace the exact event where it 
happens in the Prawn code, but this is an example:

{code:title="prawn.rb"}
require 'rubygems'
gem 'prawn', '0.4.1'  
require 'prawn'

Prawn::Document.generate "prawn.pdf" do
  font "#{Prawn::BASEDIR}/data/fonts/DejaVuSans.ttf"  # This is what generates 
the error
  text "Hello from JRuby"
end
{code}

When run in the latest JRuby build as of today:

{noformat}
~/dev% jruby -v
jruby 1.1.7 (ruby 1.8.6 patchlevel 287) (2009-01-28 rev 6586) [i386-java]

~/dev% jruby -S gem list

*** LOCAL GEMS ***

prawn (0.4.1)
prawn-layout (0.1.0)
rake (0.8.3)
rspec (1.1.12)
sources (0.0.1)

~/dev% jruby prawn.rb
RubyArray.java:752:in `eltInternal': java.lang.ArrayIndexOutOfBoundsException: 
259
        from Pack.java:1197:in `encode'
        from Pack.java:1494:in `pack'
        from RubyArray.java:3235:in `pack'
        from org/jruby/RubyArray$i_method_1_0$RUBYINVOKER$pack.gen:-1:in `call'
        from CachingCallSite.java:273:in `cacheAndCall'
        from CachingCallSite.java:112:in `call'
        from CallOneArgNode.java:57:in `interpret'
        from LocalAsgnNode.java:123:in `interpret'
        from NewlineNode.java:104:in `interpret'
        from BlockNode.java:71:in `interpret'
        from InterpretedMethod.java:163:in `call'
        from DefaultMethod.java:144:in `call'
        from CachingCallSite.java:273:in `cacheAndCall'
        from CachingCallSite.java:112:in `call'
        from CallOneArgNode.java:57:in `interpret'
        from LocalAsgnNode.java:123:in `interpret'
        from NewlineNode.java:104:in `interpret'
        from WhenOneArgNode.java:49:in `when'
        from CaseNode.java:128:in `interpret'
        from NewlineNode.java:104:in `interpret'
        from BlockNode.java:71:in `interpret'
        from InterpretedMethod.java:201:in `call'
        from DefaultMethod.java:162:in `call'
        from CachingCallSite.java:293:in `cacheAndCall'
        from CachingCallSite.java:152:in `call'
        from CallTwoArgNode.java:59:in `interpret'
        from LocalAsgnNode.java:123:in `interpret'
        from NewlineNode.java:104:in `interpret'
        from BlockNode.java:71:in `interpret'
        from InterpretedMethod.java:201:in `call'
        from DefaultMethod.java:162:in `call'
        from CachingCallSite.java:293:in `cacheAndCall'
        from CachingCallSite.java:152:in `call'
        from CallTwoArgNode.java:59:in `interpret'
        from NewlineNode.java:104:in `interpret'
        from BlockNode.java:71:in `interpret'
        from InterpretedMethod.java:163:in `call'
        from DefaultMethod.java:144:in `call'
        from CachingCallSite.java:273:in `cacheAndCall'
        from CachingCallSite.java:112:in `call'
        from FCallOneArgNode.java:36:in `interpret'
        from LocalAsgnNode.java:123:in `interpret'
        from NewlineNode.java:104:in `interpret'
        from BlockNode.java:71:in `interpret'
        from InterpretedMethod.java:125:in `call'
        from DefaultMethod.java:126:in `call'
        from CachingCallSite.java:253:in `cacheAndCall'
        from CachingCallSite.java:72:in `call'
        from CallNoArgNode.java:61:in `interpret'
        from LocalAsgnNode.java:123:in `interpret'
        from NewlineNode.java:104:in `interpret'
        from BlockNode.java:71:in `interpret'
        from InterpretedMethod.java:201:in `call'
        from DefaultMethod.java:162:in `call'
        from CachingCallSite.java:293:in `cacheAndCall'
        from CachingCallSite.java:152:in `call'
        from FCallTwoArgNode.java:38:in `interpret'
        from NewlineNode.java:104:in `interpret'
        from InterpretedBlock.java:202:in `evalBlockBody'
        from InterpretedBlock.java:190:in `yield'
        from BlockBody.java:65:in `call'
        from BlockBody.java:71:in `call'
        from Block.java:80:in `call'
        from RubyProc.java:204:in `call'
        from RubyProc.java:187:in `call'
        from org/jruby/RubyProc$i_method_0_0$RUBYFRAMEDINVOKER$call.gen:-1:in 
`call'
        from JavaMethod.java:610:in `call'
        from DynamicMethod.java:152:in `call'
        from CachingCallSite.java:273:in `cacheAndCall'
        from CachingCallSite.java:112:in `call'
        from CallOneArgNode.java:57:in `interpret'
        from IfNode.java:112:in `interpret'
        from NewlineNode.java:104:in `interpret'
        from BlockNode.java:71:in `interpret'
        from InterpretedMethod.java:125:in `call'
        from DefaultMethod.java:126:in `call'
        from CachingCallSite.java:70:in `call'
        from CallNoArgNode.java:61:in `interpret'
        from CallOneArgNode.java:57:in `interpret'
        from NewlineNode.java:104:in `interpret'
        from BlockNode.java:71:in `interpret'
        from InterpretedBlock.java:202:in `evalBlockBody'
        from InterpretedBlock.java:153:in `yield'
        from Block.java:84:in `yield'
        from RubyArray.java:1533:in `each'
        from org/jruby/RubyArray$i_method_0_0$RUBYFRAMEDINVOKER$each.gen:-1:in 
`call'
        from CachingCallSite.java:263:in `cacheAndCall'
        from CachingCallSite.java:81:in `callBlock'
        from CachingCallSite.java:86:in `call'
        from CallNoArgBlockNode.java:64:in `interpret'
        from NewlineNode.java:104:in `interpret'
        from InterpretedMethod.java:163:in `call'
        from DefaultMethod.java:144:in `call'
        from CachingCallSite.java:273:in `cacheAndCall'
        from CachingCallSite.java:112:in `call'
        from FCallOneArgNode.java:36:in `interpret'
        from NewlineNode.java:104:in `interpret'
        from BlockNode.java:71:in `interpret'
        from InterpretedMethod.java:125:in `call'
        from DefaultMethod.java:126:in `call'
        from CachingCallSite.java:253:in `cacheAndCall'
        from CachingCallSite.java:72:in `call'
        from VCallNode.java:85:in `interpret'
        from CallOneArgNode.java:57:in `interpret'
        from NewlineNode.java:104:in `interpret'
        from InterpretedBlock.java:202:in `evalBlockBody'
        from InterpretedBlock.java:153:in `yield'
        from Block.java:84:in `yield'
        from RubyIO.java:875:in `open'
        from org/jruby/RubyIO$s_method_0_2$RUBYFRAMEDINVOKER$open.gen:-1:in 
`call'
        from DynamicMethod.java:261:in `call'
        from CachingCallSite.java:303:in `cacheAndCall'
        from CachingCallSite.java:161:in `callBlock'
        from CachingCallSite.java:176:in `callIter'
        from CallTwoArgBlockNode.java:62:in `interpret'
        from NewlineNode.java:104:in `interpret'
        from BlockNode.java:71:in `interpret'
        from InterpretedMethod.java:163:in `call'
        from DefaultMethod.java:144:in `call'
        from CachingCallSite.java:273:in `cacheAndCall'
        from CachingCallSite.java:112:in `call'
        from CallOneArgNode.java:57:in `interpret'
        from NewlineNode.java:104:in `interpret'
        from BlockNode.java:71:in `interpret'
        from InterpretedMethod.java:182:in `call'
        from DefaultMethod.java:153:in `call'
        from CachingCallSite.java:283:in `cacheAndCall'
        from CachingCallSite.java:121:in `callBlock'
        from CachingCallSite.java:136:in `callIter'
        from prawn.rb:5:in `__file__'
        from prawn.rb:-1:in `load'
        from Ruby.java:575:in `runScript'
        from Ruby.java:478:in `runNormally'
        from Ruby.java:352:in `runFromMain'
        from Main.java:214:in `run'
        from Main.java:100:in `run'
        from Main.java:84:in `main'
{noformat}

The code works fine in MRI. Problem is also present in JRuby 1.1.6.

-- 
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