Closed Bug 164947 Opened 22 years ago Closed 22 years ago

Debugging unique.js produce a stack trace and erratic results.

Categories

(Rhino Graveyard :: Core, defect)

x86
Windows XP
defect
Not set
normal

Tracking

(Not tracked)

VERIFIED FIXED

People

(Reporter: michel, Assigned: norrisboyd)

Details

User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1) Build Identifier: rhino1_5R2 or rhino1_5R3 I'm testing the rhino debugger under Window-XP with SUN JRE 1.4.0 and 1.3.1 with the example "unique.js". I always get a java stark trace the second time I reach the line "o[line] = true;". After the stack trace, the debugger start to be erratic (at least, the watch window stop working). Reproducible: Always Steps to Reproduce: 1.Run the debugger In my case, the command line is C:\program\j2sdk1.4.0\bin\java.exe - classpath ".;js.jar" org.mozilla.javascr ipt.tools.debugger.Main unique.js unique.txt 2.Step over each line up to the line "o[line] = true;" 3.Step over this line twice Actual Results: java.lang.reflect.InvocationTargetException at java.awt.EventQueue.invokeAndWait(EventQueue.java:799) at javax.swing.SwingUtilities.invokeAndWait(SwingUtilities.java:1197) at org.mozilla.javascript.tools.debugger.Main.swingInvoke(Unknown Source) at org.mozilla.javascript.tools.debugger.Main.interrupted(Unknown Source) at org.mozilla.javascript.tools.debugger.Main.handleBreakpointHit (Unknown Source) at org.mozilla.javascript.Interpreter.interpret(Unknown Source) at org.mozilla.javascript.InterpretedScript.call(Unknown Source) at org.mozilla.javascript.InterpretedScript.exec(Unknown Source) at org.mozilla.javascript.Context.evaluateReader(Unknown Source) at org.mozilla.javascript.tools.shell.Main.evaluateReader(Unknown Source) at org.mozilla.javascript.tools.shell.Main.processFile(Unknown Source) at org.mozilla.javascript.tools.shell.Main.processSource(Unknown Source) at org.mozilla.javascript.tools.shell.Main.exec(Unknown Source) at org.mozilla.javascript.tools.debugger.Main.main(Unknown Source) Caused by: java.lang.ArrayIndexOutOfBoundsException: -1 < 0 at java.util.Vector.elementAt(Vector.java:437) at org.mozilla.javascript.tools.debugger.ContextWindow.actionPerformed (Unknown Source) at javax.swing.JComboBox.fireActionEvent(JComboBox.java:1196) at javax.swing.JComboBox.setSelectedItem(JComboBox.java:561) at javax.swing.JComboBox.setSelectedIndex(JComboBox.java:597) at org.mozilla.javascript.tools.debugger.UpdateContext.run(Unknown Source) at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:171) at java.awt.EventQueue.dispatchEvent(EventQueue.java:443) at java.awt.EventDispatchThread.pumpOneEventForHierarchy (EventDispatchThread.java:190) at java.awt.EventDispatchThread.pumpEventsForHierarchy (EventDispatchThread.java:144) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:138) at java.awt.EventDispatchThread.pumpEvents (EventDispatchThread.java:130) at java.awt.EventDispatchThread.run(EventDispatchThread.java:98)
Is it possible to get those unique.js unique.txt?
Should be market as FIXED: The bug is caused by calling setSelectedIndex(0) on JList at when the list is empty at http://lxr.mozilla.org/mozilla/source/js/rhino/toolsrc/org/mozilla/javascript/tools/debugger/Main.java#1723 It was taken care by a fix from Christopher Oliver and adding an explicit check not to call setSelectedIndex when there are no frames. From Christopher Oliver email: I think this problem is the same as the one Marcus reported, see the below email exchange I had with him which contains the fix. It looks like this patch has already been applied. That patch should also fix the problem reported in 164947.
Marking FIXED as requested -
Status: NEW → RESOLVED
Closed: 22 years ago
Resolution: --- → FIXED
Verified FIXED STEPS TO REPRODUCE: 1. cd //d/JS_TRUNK/mozilla/js/rhino/build/rhino1_5R4/examples 2. Compile "File.java" to produce "File.class": [//d/JS_TRUNK/mozilla/js/rhino/build/rhino1_5R4/examples] $ //d/jdk1.4.1/bin/javac File.java 3. Create a text file called "unique.txt" with more than one line in it. Save it to //d/JS_TRUNK/mozilla/js/rhino/build/rhino1_5R4/examples. 4. Open the debugger, providing "unique.js" and "unique.txt" as arguments: [//d/JS_TRUNK/mozilla/js/rhino/build/rhino1_5R4/examples] $ java -classpath ".;../js.jar" org.mozilla.javascript.tools.debugger.Main unique.js unique.txt 5. Note the file "unique.js" uses the File class to: a) Open the file "unique.txt" b) Read it line-by-line in a loop c) Print each line to the debugger JavaScript Console This all worked perfectly, even when "unique.txt" had several lines of text in it, forcing more than one access to the code reported above: o[line] = true;
Status: RESOLVED → VERIFIED
Targeting as resolved against 1.5R4
Target Milestone: --- → 1.5R4
You need to log in before you can comment on or make changes to this bug.