Menu

#543 ArrayIndexOutOfBoundsException on Scanner input

6: Crashes
closed-fixed
nobody
5
2007-03-06
2006-10-17
Marty Stepp
No

DrJava crashes extremely frequently when peforming
console input with the Scanner class. Run the attached
program... when it prompts for the number of homework
assignments, choose a fairly large number such as 20.
Now on each prompt, type more numbers. After a few
repetitions, DrJava will crash, usually with an
ArrayIndexOutOfBoundsException but occasionally with a
NullPointerException instead.

Machine: a Fujitsu laptop running WinXP SP2, Intel
Pentium M 2GHz processor, 2GB RAM, no
security/antivirus software installed. Using DrJava
v20060918-1737. I have had many students here at U. of
Washington report this bug to me as occurring on their
Windows machines as well.

I have tried to reproduce this bug using the DrJava JAR
of the same version on Linux, and it doesn't reproduce.

Below is the copy-paste of the error log.

java.lang.ArrayIndexOutOfBoundsException: 10
at javax.swing.text.CompositeView.getView(Unknown Source)
at javax.swing.text.View.forwardUpdate(Unknown Source)
at javax.swing.text.BoxView.forwardUpdate(Unknown Source)
at javax.swing.text.View.insertUpdate(Unknown Source)
at
javax.swing.plaf.basic.BasicTextUI$RootView.insertUpdate(Unknown
Source)
at
javax.swing.plaf.basic.BasicTextUI$UpdateHandler.insertUpdate(Unknown
Source)
at
javax.swing.text.AbstractDocument.fireInsertUpdate(Unknown
Source)
at
javax.swing.text.AbstractDocument.handleInsertString(Unknown
Source)
at
javax.swing.text.AbstractDocument.insertString(Unknown
Source)
at
edu.rice.cs.util.text.SwingDocument.forceInsertText(SwingDocument.java:123)
at
edu.rice.cs.util.text.ConsoleDocument.insertBeforeLastPrompt(ConsoleDocument.java:219)
at
edu.rice.cs.drjava.ui.InteractionsController$3$2.run(InteractionsController.java:178)
at java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at
java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown
Source)
at
java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown
Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)

System Properties:
DrJava Version 20060918-1737
java.runtime.name = Java(TM) 2 Runtime Environment,
Standard Edition
sun.boot.library.path = C:\Programs\java\1.5\jre\bin
java.vm.version = 1.5.0_06-b05
java.vm.vendor = Sun Microsystems Inc.
java.vendor.url = http://java.sun.com/
path.separator = ;
java.vm.name = Java HotSpot(TM) Client VM
file.encoding.pkg = sun.io
user.country = US
sun.os.patch.level = Service Pack 2
java.vm.specification.name = Java Virtual Machine
Specification
user.dir = C:\Documents and Settings\stepp
java.runtime.version = 1.5.0_06-b05
java.awt.graphicsenv = sun.awt.Win32GraphicsEnvironment
java.endorsed.dirs = C:\Programs\java\1.5\jre\lib\endorsed
os.arch = x86
java.io.tmpdir = C:\DOCUME~1\stepp\LOCALS~1\Temp\ line.separator = "\u000d\u000a"
java.vm.specification.vendor = Sun Microsystems Inc.
user.variant =
os.name = Windows XP
sun.jnu.encoding = Cp1252
java.library.path =
C:\Programs\java\1.5\bin;.;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\system32\WBEM;C:\Programs\perl\bin\;C:\Programs;C:\Programs\java\1.5\bin;C:\Programs\TextPad;C:\Programs\WinZip;C:\programs\klite\QuickTime\QTSystem\ java.specification.name = Java Platform API Specification
java.class.version = 49.0
sun.management.compiler = HotSpot Client Compiler
os.version = 5.1
user.home = C:\Documents and Settings\stepp
user.timezone = America/Los_Angeles
java.awt.printerjob = sun.awt.windows.WPrinterJob
file.encoding = Cp1252
java.specification.version = 1.5
java.class.path =
C:\Programs\drjava.exe;C:\Programs\java\1.5\lib\tools.jar
user.name = stepp
java.vm.specification.version = 1.0
java.home = C:\Programs\java\1.5\jre
sun.arch.data.model = 32
user.language = en
java.specification.vendor = Sun Microsystems Inc.
awt.toolkit = sun.awt.windows.WToolkit
java.vm.info = mixed mode
java.version = 1.5.0_06
java.ext.dirs = C:\Programs\java\1.5\jre\lib\ext
sun.boot.class.path =
C:\Programs\java\1.5\jre\lib\rt.jar;C:\Programs\java\1.5\jre\lib\i18n.jar;C:\Programs\java\1.5\jre\lib\sunrsasign.jar;C:\Programs\java\1.5\jre\lib\jsse.jar;C:\Programs\java\1.5\jre\lib\jce.jar;C:\Programs\java\1.5\jre\lib\charsets.jar;C:\Programs\java\1.5\jre\classes
java.vendor = Sun Microsystems Inc.
file.separator = \ java.vendor.url.bug =
http://java.sun.com/cgi-bin/bugreport.cgi
sun.io.unicode.encoding = UnicodeLittle
sun.cpu.endian = little
java.rmi.server.hostname = 127.0.0.1
sun.desktop = windows
sun.awt.exception.handler =
edu.rice.cs.drjava.ui.DrJavaErrorHandler
sun.cpu.isalist = pentium_pro+mmx pentium_pro
pentium+mmx pentium i486 i386 i86

#DrJava configuration file
#Tue Oct 17 04:11:40 PDT 2006
javac.location = C:\\Programs\\java\\1.5\\lib\\tools.jar
extra.classpath = C:\\Programs\\java\\1.5\\lib\\junit.jar
definitions.double.quoted.color = #006666
definitions.number.color = #000000
font.main = Courier New-BOLD-24
font.line.numbers = Courier New-22
font.doclist = Verdana-30
font.toolbar = Dialog-20
text.antialias = true
lineenum.enabled = true
key.save.file.as = <none>
key.save.all.files = ctrl shift S
key.close.all.files = ctrl shift W
key.close.project = ctrl W
key.cut = shift DELETE
key.copy = ctrl INSERT
key.paste = shift INSERT
key.previous.document = ctrl PAGE_UP
key.next.document = ctrl PAGE_DOWN
key.compile = ctrl 1
key.test = ctrl 4
key.lift.current.interaction = ctrl alt UP
key.delete.next = <none>
key.delete.previous = shift BACK_SPACE
key.delete.next = <none>
find.replace.match.case = false
interactions.exit.prompt = false
quit.prompt = false
interactions.reset.prompt = false
save.before.compile = true
save.before.javadoc = true
warn.change.laf = false
prompt.before.clean = false
indent.level = 4
files.backup = false
show.fallthrough.warnings = true
recent.files = [C:\\Documents and
Settings\\stepp\\Desktop\\Crash.java,C:\\Documents and
Settings\\stepp\\Desktop\\Grades.java,C:\\Documents and
Settings\\stepp\\Desktop\\Grades2.java,C:\\Documents
and Settings\\stepp\\Desktop\\Grade.java]
window.height = 958
window.width = 1190
window.x = 79
window.y = 13
doc.list.width = 142
last.dir = C:\\Documents and
Settings\\stepp\\Desktop\\Crash.java
last.interactions.dir = C:\\Documents and
Settings\\stepp\\Desktop
drjava.use.force.quit = true

Discussion

  • Marty Stepp

    Marty Stepp - 2006-10-17

    test file to reproduce bug

     
  • Marty Stepp

    Marty Stepp - 2006-10-17

    Logged In: YES
    user_id=1610546

    The bug doesn't reproduce *every* time, but with enough
    input, it reproduces almost every run for me. I've also
    tried changing the attached program so that it calls
    nextInt, nextDouble, next, or nextLine exclusively. It
    still crashes in every case.

     
  • Marty Stepp

    Marty Stepp - 2006-10-31

    Logged In: YES
    user_id=1610546

    I'd like to confirm that this bug does still reproduce in
    drjava-stable-20061025-1556. It is still causing a great
    deal of trouble for our students. Essentially we cannot
    have them successfully write any programs in DrJava that
    have a large amount of console interaction with the Scanner.
    Students have been frustrated, thinking that there is a bug
    in their code. We are resorting to telling them to use an
    editor that behaves correctly, such as TextPad.

     
  • Robert Cartwright

    Logged In: YES
    user_id=430590
    Originator: NO

    We need to look at this carefully. We never use console input so we are not very conversant with glitches in its implementation. It sounds like there are some very annoying concurrency bugs. I'll take a look at it.

    I apologize for the delay. I missing seeing this bug when it was filed and was not aware that we had such an old major concurrency bug until I recently stumbled across it.

     
  • Robert Cartwright

    Logged In: YES
    user_id=430590
    Originator: NO

    I think this bug is fixed in the very recent builds including the most recently posted jar file at www.cs.rice.edu/~javaplt/drjavarice. Please let us know if you can produce the bug using this build (or any more recent build).

     
  • Christopher Warrington

    • status: open --> pending-fixed
     
  • Christopher Warrington

    Logged In: YES
    user_id=666678
    Originator: NO

    Fixed in version at http://www.cs.rice.edu/~javaplt/drjavarice Status set to pending. Please reply if it's not fixed.

     
  • SourceForge Robot

    Logged In: YES
    user_id=1312539
    Originator: NO

    This Tracker item was closed automatically by the system. It was
    previously set to a Pending status, and the original submitter
    did not respond within 14 days (the time period specified by
    the administrator of this Tracker).

     
  • SourceForge Robot

    • status: pending-fixed --> closed-fixed
     

Log in to post a comment.