Closed Bug 296959 Opened 19 years ago Closed 19 years ago

ArrayIndexOutOfBoundException for large javascripts

Categories

(Rhino Graveyard :: Core, defect)

1.6R1
x86
Windows 2000
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED DUPLICATE of bug 292324

People

(Reporter: hauserx, Assigned: igor)

Details

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7.3) Gecko/20040910
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7.3) Gecko/20040910

I have large javascripts for which I created some tests. The newest version of
Rhino (1.6R1) reports ArrayIndexOutOfBoundException when running the tests.
Older version (1.5R4.1) does not - but the bug might be there also. I am using
jWebUnit/HttpUnit to perform the tests. 

The exception shows method Interpreter.recordJump, exactly this line:

itsData.itsICode[offsetSite] = (byte)(offset >> 8);

So I have added these lines before it:

int capacity = itsData.itsICode.length;
int capacityNeeded = offsetSite+2;
if( capacity<capacityNeeded) {
    increaseICodeCapasity( capacityNeeded-capacity);
}

And it works correctly.

I am not sure it resolves actual problem, but it works for me. 

Reproducible: Always

Actual Results:  
java.lang.ArrayIndexOutOfBoundsException: 1024
	at org.mozilla.javascript.Interpreter.recordJump(Interpreter.java:1562)
	at org.mozilla.javascript.Interpreter.addGoto(Interpreter.java:1488)
	at org.mozilla.javascript.Interpreter.visitStatement(Interpreter.java:721)
	at org.mozilla.javascript.Interpreter.visitStatement(Interpreter.java:654)
	at org.mozilla.javascript.Interpreter.visitStatement(Interpreter.java:654)
	at org.mozilla.javascript.Interpreter.generateICodeFromTree(Interpreter.java:504)
	at org.mozilla.javascript.Interpreter.generateFunctionICode(Interpreter.java:495)
	at org.mozilla.javascript.Interpreter.generateNestedFunctions(Interpreter.java:579)
	at org.mozilla.javascript.Interpreter.generateICodeFromTree(Interpreter.java:500)
	at org.mozilla.javascript.Interpreter.compile(Interpreter.java:457)
	at org.mozilla.javascript.Context.compileImpl(Context.java:2372)
	at org.mozilla.javascript.Context.compileString(Context.java:1372)
	at org.mozilla.javascript.Context.compileString(Context.java:1361)
	at org.mozilla.javascript.Context.evaluateString(Context.java:1217)
	at
com.meterware.httpunit.javascript.JavaScript$JavaScriptEngine.executeScript(JavaScript.java:122)
	at
com.meterware.httpunit.scripting.ScriptableDelegate.runScript(ScriptableDelegate.java:64)
	at
com.meterware.httpunit.parsing.ScriptFilter.getTranslatedScript(ScriptFilter.java:150)
	at com.meterware.httpunit.parsing.ScriptFilter.endElement(ScriptFilter.java:131)

Expected Results:  
No such exceptions ;)
This bug is probably a duplicate of 292324 - somehow i missed it earlier.

*** This bug has been marked as a duplicate of 292324 ***
Status: NEW → RESOLVED
Closed: 19 years ago
Resolution: --- → DUPLICATE
Version: other → 1.6R1
You need to log in before you can comment on or make changes to this bug.