Menu

#829 Control Z crash

open
nobody
5
2010-01-30
2010-01-30
No

I try to read user input until end of file, but typing a entering a control z crashes Dr. Java.

edu.rice.cs.util.UnexpectedException: java.lang.RuntimeException: Illegal location 634
at edu.rice.cs.drjava.model.AbstractDJDocument.setCurrentLocation(AbstractDJDocument.java:474)
at edu.rice.cs.drjava.model.AbstractDJDocument$UnremoveCommand$1.run(AbstractDJDocument.java:1863)
at java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(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)
Caused by: java.lang.RuntimeException: Illegal location 634
at edu.rice.cs.util.UnexpectedException.<init>(UnexpectedException.java:71)
... 10 more

Caused by:
java.lang.RuntimeException: Illegal location 634
at edu.rice.cs.util.UnexpectedException.<init>(UnexpectedException.java:71)
at edu.rice.cs.drjava.model.AbstractDJDocument.setCurrentLocation(AbstractDJDocument.java:474)
at edu.rice.cs.drjava.model.AbstractDJDocument$UnremoveCommand$1.run(AbstractDJDocument.java:1863)
at java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(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 drjava-20090821-r5004
DrJava Build Time 20090821-1520

drjava.debug.port = 3992
java.runtime.name = Java(TM) SE Runtime Environment
sun.boot.library.path = C:\Program Files\Java\jre6\bin
java.vm.version = 14.3-b01
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
sun.java.launcher = SUN_STANDARD
user.country = US
sun.os.patch.level = Service Pack 3
java.vm.specification.name = Java Virtual Machine Specification
user.dir = <anonymized user.dir>
java.runtime.version = 1.6.0_17-b04
java.awt.graphicsenv = sun.awt.Win32GraphicsEnvironment
java.endorsed.dirs = C:\Program Files\Java\jre6\lib\endorsed
os.arch = x86
java.io.tmpdir = C:\DOCUME~1\&lt;anonymized user.name>\LOCALS~1\Temp\ line.separator = "\u000d\u000a"
java.vm.specification.vendor = Sun Microsystems Inc.
user.variant =
os.name = Windows XP
sun.jnu.encoding = GBK
java.library.path = C:\Program Files\Java\jre6\bin;.;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\Program Files\Common Files\Microsoft Shared\Windows Live;C:\Perl\site\bin;C:\Perl\bin;C:\Program Files\ActiveState Komodo Edit 5\;c:\program files\imagemagick-6.3.5-q16;C:\Perl\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program Files\Intel\Wireless\Bin\;c:\Program Files\Microsoft SQL Server\90\Tools\binn\;C:\Program Files\Microsoft Office\OFFICE11\Business Contact Manager\IM;C:\Program Files\Microsoft SQL Server\80\Tools\Binn\;C:\Program Files\Microsoft Office\OFFICE11\Business Contact Manager\;C:\Program Files\QuickTime\QTSystem\;C:\Program Files\PharosSystems\OutputManagement;C:\Program Files\PharosSystems\Core;C:\Program Files\Common Files\Microsoft Shared\Windows Live;C:\Program Files\IDM Computer Solutions\UltraCompare;;C:\PROGRA~1\COMMON~1\MUVEET~1\030625;C:\PROGRA~1\COMMON~1\MUVEET~1\030625;C:\Program Files\Java\jre6\bin
java.specification.name = Java Platform API Specification
java.class.version = 50.0
sun.management.compiler = HotSpot Client Compiler
os.version = 5.1
user.home = <anonymized user.home>
user.timezone = America/Denver
java.awt.printerjob = sun.awt.windows.WPrinterJob
file.encoding = Cp1252
java.specification.version = 1.6
java.class.path = G:\CS 142\drjava-stable-20090821-r5004.exe
user.name = <anonymized user.name>
java.vm.specification.version = 1.0
java.home = C:\Program Files\Java\jre6
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.6.0_17
java.ext.dirs = C:\Program Files\Java\jre6\lib\ext;C:\WINDOWS\Sun\Java\lib\ext
sun.boot.class.path = C:\Program Files\Java\jre6\lib\resources.jar;C:\Program Files\Java\jre6\lib\rt.jar;C:\Program Files\Java\jre6\lib\sunrsasign.jar;C:\Program Files\Java\jre6\lib\jsse.jar;C:\Program Files\Java\jre6\lib\jce.jar;C:\Program Files\Java\jre6\lib\charsets.jar;C:\Program Files\Java\jre6\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.cpu.isalist = pentium_pro+mmx pentium_pro pentium+mmx pentium i486 i386 i86

#DrJava configuration file
#Sat Jan 30 11:22:55 MST 2010
key.delete.next = [shift DELETE]
key.delete.previous = [shift BACK_SPACE]
quit.prompt = false
interactions.reset.prompt = false
save.before.compile = true
recent.files = [G:\\CS 142\\Assignment 4\\MaxMin.java,G:\\CS 142\\Assignment 4\\Author Examples\\StdAudio.java,G:\\CS 142\\Array Review\\probOne.java]
window.height = 774
window.width = 1288
window.x = -4
window.y = -4
window.state = 6
last.dir = G:\\CS 142\\Assignment 4\\MaxMin.java
last.interactions.dir = G:\\CS 142\\Assignment 4
tabbedpanes.state = 640 400 700 400
dialog.drjava.survey.enabled = false
new.version.notification.last = 1264654134093
drjava.survey.notification.last = 1262916527343
drjava.survey.result.last = http://www.drjava.org/submit-usage.php?rev=5004&os.name=Windows%20XP&os.version=5.1&java.version=1.6.0_17&java.vendor=Sun%20Microsystems%20Inc.
file.ext.registration = always

Used memory: about 21.38 megabytes
Free memory: about 9.54 megabytes
Total memory: about 30.91 megabytes
Total memory can expand to: about 63.56 megabytes

Number of processors/cores: 1

The code I used is:
public class MaxMin {
public static void main(String[] args) {
int max = Integer.MIN_VALUE;//These two lines look funny, but are necessary. Any number will be great than the MIN_VALUE
int min = Integer.MAX_VALUE;//and any number will be less than MAX_VALUE.
while (!StdIn.isEmpty()) {//read from standard in until it's empty
int input = StdIn.readInt();
if(input > max)
max = input;
if(input < min)
min = input;
}
System.out.println("The maximum value was " + max);
System.out.println("The minimum value was " + min);

}
}

attached is the StdIn file where the methods came from.
Oh, and the program works just fine in the windows command prompt.

Discussion

  • Nathan Glenn

    Nathan Glenn - 2010-01-30

    I use the method in this file to read user input. While(!StdIn.isEmpty){int input = StdIn.readInt();}

     
  • Robert Cartwright

    I tried running your program using the latest development release drjava-20091021-r5122. I had to download a source file defining StdIn from http://www.cs.princeton.edu/introcs/15inout/StdIn.java.html. But the two source files together compiled without any warnings or erros.

    On my machine running Ubuntu 9.10, Control-Z undoes the last edit action in the Definitions Pane (which I find annoying since the focus is on the Interactions Pane). I can terminate the input stream using Control-D which is the Unix convention.

    Can you reproduce this problem using the latest development release? Does Control-D work as end-of-file on your system?

    By the way, Java 6 Update 17 has a Swing bug that occasionally raises errors in DrJava (which are reported by otherwise do not appear to cause harm). Update 18 reportedly fixes this Swing bug. I am running JDK 6 Update 18 for 32-bit Linux.

     

Log in to post a comment.