6 messages in org.mozilla.lists.dev-tech-js-engine-rhinoRe: IllegalArgumentException: out of ...
FromSent OnAttachments
William StrathearnNov 20, 2007 11:38 pm 
William StrathearnNov 20, 2007 11:57 pm 
Norris BoydNov 21, 2007 6:05 am 
William StrathearnNov 21, 2007 9:31 am 
William StrathearnNov 21, 2007 4:53 pm 
Attila SzegediNov 22, 2007 12:31 am 
Actions with this message:
Paste this link in email or IM:
Paste this link in email or IM:
Atom feed for this thread
Paste this URL into your reader:
Subject:Re: IllegalArgumentException: out of range index in 1_6R6 not 1_7R1Actions
From:William Strathearn (bill@gmail.com)
Date:Nov 20, 2007 11:57:16 pm
List:org.mozilla.lists.dev-tech-js-engine-rhino

I should note that the I'm using java version 1.5 to run Rhino and am _not_ using any of the features of JavaScript 1.7 in the problematic file. d

$ java -version java version "1.5.0_06" Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05) Java HotSpot(TM) Client VM (build 1.5.0_06-b05, mixed mode, sharing)

On Nov 20, 11:38 pm, William Strathearn <bill@gmail.com> wrote:

I have 1.5MB of JavaScript that runs just fine in Rhino's compiled loading mode. When I minimize the JavaScript using something like Dojo's ShrinkSafe, then give the shrunken script to Rhino 1.6r6, it throws a " Exception in thread "main" java.lang.IllegalArgumentException?: out of range index" exception. The full-size script that has not been minimized has no problems. I know this is a problem with the minimizer I'm using, but I don't know how to go about tracking down the precise region of JavaScript causing the problem.

The stack trace looks exactly like the one listed
here:http://trac.dojotoolkit.org/ticket/2896. Line for line it's the same. In that bug report, the problem was listed as being the size of the script. However since Rhino handles the JS file that is twice as large as the one that is not shrunken, I'm guessing that size is not as important as content in this case.

$ java -jar js-1_6R6pre.jar my-full-sized.js # yay! no exceptions

$ java -jar js-1_7R1pre.jar my-shrunken.js # yay! no exceptions

$ java -jar js-1_6R6pre.jar my-shrunken.js Exception in thread "main" java.lang.IllegalArgumentException: out of range index at org.mozilla.classfile.ClassFileWriter.add(ClassFileWriter.java:542) at org.mozilla.classfile.ClassFileWriter.addLoadConstant(ClassFileWriter.java: 602) at org.mozilla.classfile.ClassFileWriter.addPush(ClassFileWriter.java: 838) at
org.mozilla.javascript.optimizer.Codegen.generateNativeFunctionOverrides(Codegen.java: 851) at org.mozilla.javascript.optimizer.Codegen.generateCode(Codegen.java: 276) at org.mozilla.javascript.optimizer.Codegen.compileToClassFile(Codegen.java: 161) at org.mozilla.javascript.optimizer.Codegen.compile(Codegen.java:71) at org.mozilla.javascript.Context.compileImpl(Context.java: 2349) at org.mozilla.javascript.Context.compileString(Context.java: 1354) at org.mozilla.javascript.Context.compileString(Context.java: 1343) at org.mozilla.javascript.tools.shell.Main.loadScriptFromSource(Main.java: 455) at org.mozilla.javascript.tools.shell.Main.processFileSecure(Main.java: 443) at org.mozilla.javascript.tools.shell.Main.processFile(Main.java:412) at org.mozilla.javascript.tools.shell.Main.processSource(Main.java:403) at org.mozilla.javascript.tools.shell.Main.processFiles(Main.java:179) at org.mozilla.javascript.tools.shell.Main$IProxy.run(Main.java: 100) at org.mozilla.javascript.Context.call(Context.java:583) at org.mozilla.javascript.ContextFactory.call(ContextFactory.java:506) at org.mozilla.javascript.tools.shell.Main.exec(Main.java:162) at org.mozilla.javascript.tools.shell.Main.main(Main.java:140)