本人最近编写的一个网管程序需要在信息的输出区域做一个下拉动作,写出来以后发现偶尔会导致整个程序崩溃(界面消失)。跪求大虾们能帮我看看是哪里的问题,谢谢了!!
下面是怀疑出错的代码:
Document doc
JTextPane textArea
DefaultBoundedRangeModel brm

try {
doc = textArea.getStyledDocument();
doc.insertString(doc.getLength(), MSG[indext], set);
just_logged = 1;
Thread.sleep(10); Thread.yield();
}catch (Exception ex1){}
try {
if (just_logged == 1) {
just_logged = 2;
}
else if (just_logged == 2) {
Thread.sleep(250); Thread.yield();
scrollBarDown();
just_logged = 0;
Thread.sleep(250); Thread.yield();
}
}catch (Exception e) {}

public static void scrollBarDown() {
try {
brm.setValue(brm.getMaximum() - brm.getExtent());
}catch (Exception e) {}
try {
textAreaScrollPane.getVerticalScrollBar().setModel(brm);
}catch (Exception e) {}
}

出错的内容是
#
# An unexpected error has been detected by Java Runtime Environment:
#
# EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x6d0eeefa, pid=2456, tid=2244
#
# Java VM: Java HotSpot(TM) Client VM (1.6.0-b105 mixed mode, sharing)
# Problematic frame:
# C [awt.dll+0xeeefa]
#
# If you would like to submit a bug report, please visit:
# http://java.sun.com/webapps/bugreport/crash.jsp
#

--------------- T H R E A D ---------------

Current thread (0x0307b000): JavaThread "AWT-EventQueue-0" [_thread_in_native, id=2244]

siginfo: ExceptionCode=0xc0000005, reading address 0x0000003c

Registers:
EAX=0xff0000ff, EBX=0x0000006b, ECX=0xff0000ff, EDX=0x0330f2a4
ESP=0x0330f118, EBP=0x0330f2e8, ESI=0x00000000, EDI=0x0307b0e8
EIP=0x6d0eeefa, EFLAGS=0x00010202

Top of Stack: (sp=0x0330f118)
0x0330f118: 0330f2dc 0000006b 02b469f0 02b469fc
0x0330f128: 02b469f0 02b469f0 00000004 7c3669c3
0x0330f138: 02b469f0 00000004 6d0444f0 02b469f0
0x0330f148: 0310c038 229ee990 0330f2e8 02b469f0
0x0330f158: 02b469fc ffffffff 0310bbb0 0310bbb4
0x0330f168: 7ffde000 7ff9b000 ff0000ff 0330f2e8
0x0330f178: 0307b0e8 0307b000 0330fb64 7c839ac0
0x0330f188: 7c802608 ffffffff 7c802600 7c802542

Instructions: (pc=0x6d0eeefa)
0x6d0eeeea: 01 00 00 53 56 8b b4 24 78 01 00 00 89 44 24 58
0x6d0eeefa: 8b 46 3c 57 33 ff 85 c0 c7 44 24 0c 64 00 00 00


Stack: [0x032c0000,0x03310000), sp=0x0330f118, free space=316k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
C [awt.dll+0xeeefa]
J sun.java2d.windows.DDRenderer.doFillSpans(Lsun/java2d/SunGraphics2D;Lsun/java2d/pipe/SpanIterator;)V
j sun.java2d.windows.GDIRenderer.draw(Lsun/java2d/SunGraphics2D;Ljava/awt/Shape;)V+39
j sun.java2d.pipe.PixelToShapeConverter.drawLine(Lsun/java2d/SunGraphics2D;IIII)V+22
j sun.java2d.pipe.ValidatePipe.drawLine(Lsun/java2d/SunGraphics2D;IIII)V+19
J sun.java2d.SunGraphics2D.drawLine(IIII)V
j displayNetworkPanel.drawNodeLines(Ljava/awt/Graphics;)V+219
j displayNetworkPanel.paint(Ljava/awt/Graphics;)V+342
j javax.swing.JComponent.paintToOffscreen(Ljava/awt/Graphics;IIIIII)V+41
j javax.swing.BufferStrategyPaintManager.paint(Ljavax/swing/JComponent;Ljavax/swing/JComponent;Ljava/awt/Graphics;IIII)Z+157
j javax.swing.RepaintManager.paint(Ljavax/swing/JComponent;Ljavax/swing/JComponent;Ljava/awt/Graphics;IIII)V+52
J javax.swing.JComponent._paintImmediately(IIII)V
j javax.swing.JComponent.paintImmediately(IIII)V+83
J javax.swing.RepaintManager.paintDirtyRegions(Ljava/util/Map;)V
j javax.swing.RepaintManager.paintDirtyRegions()V+46
j javax.swing.RepaintManager.seqPaintDirtyRegions()V+73
j javax.swing.SystemEventQueueUtilities$ComponentWorkRequest.run()V+36
J java.awt.event.InvocationEvent.dispatch()V
J java.awt.EventQueue.dispatchEvent(Ljava/awt/AWTEvent;)V
J java.awt.EventDispatchThread.pumpOneEventForFilters(I)Z
j java.awt.EventDispatchThread.pumpEventsForFilter(ILjava/awt/Conditional;Ljava/awt/EventFilter;)V+30
j java.awt.EventDispatchThread.pumpEventsForHierarchy(ILjava/awt/Conditional;Ljava/awt/Component;)V+11
j java.awt.EventDispatchThread.pumpEvents(ILjava/awt/Conditional;)V+4
j java.awt.EventDispatchThread.pumpEvents(Ljava/awt/Conditional;)V+3
j java.awt.EventDispatchThread.run()V+9
v ~StubRoutines::call_stub

Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
J sun.java2d.windows.DDRenderer.doFillRectDD(Lsun/java2d/SurfaceData;IIIII)V
J sun.java2d.windows.DDRenderer.doFillSpans(Lsun/java2d/SunGraphics2D;Lsun/java2d/pipe/SpanIterator;)V
j sun.java2d.windows.GDIRenderer.draw(Lsun/java2d/SunGraphics2D;Ljava/awt/Shape;)V+39
j sun.java2d.pipe.PixelToShapeConverter.drawLine(Lsun/java2d/SunGraphics2D;IIII)V+22
j sun.java2d.pipe.ValidatePipe.drawLine(Lsun/java2d/SunGraphics2D;IIII)V+19
J sun.java2d.SunGraphics2D.drawLine(IIII)V
j displayNetworkPanel.drawNodeLines(Ljava/awt/Graphics;)V+219
j displayNetworkPanel.paint(Ljava/awt/Graphics;)V+342
j javax.swing.JComponent.paintToOffscreen(Ljava/awt/Graphics;IIIIII)V+41
j javax.swing.BufferStrategyPaintManager.paint(Ljavax/swing/JComponent;Ljavax/swing/JComponent;Ljava/awt/Graphics;IIII)Z+157
j javax.swing.RepaintManager.paint(Ljavax/swing/JComponent;Ljavax/swing/JComponent;Ljava/awt/Graphics;IIII)V+52
J javax.swing.JComponent._paintImmediately(IIII)V
j javax.swing.JComponent.paintImmediately(IIII)V+83
J javax.swing.RepaintManager.paintDirtyRegions(Ljava/util/Map;)V
j javax.swing.RepaintManager.paintDirtyRegions()V+46
j javax.swing.RepaintManager.seqPaintDirtyRegions()V+73
j javax.swing.SystemEventQueueUtilities$ComponentWorkRequest.run()V+36
J java.awt.event.InvocationEvent.dispatch()V
J java.awt.EventQueue.dispatchEvent(Ljava/awt/AWTEvent;)V
J java.awt.EventDispatchThread.pumpOneEventForFilters(I)Z
j java.awt.EventDispatchThread.pumpEventsForFilter(ILjava/awt/Conditional;Ljava/awt/EventFilter;)V+30
j java.awt.EventDispatchThread.pumpEventsForHierarchy(ILjava/awt/Conditional;Ljava/awt/Component;)V+11
j java.awt.EventDispatchThread.pumpEvents(ILjava/awt/Conditional;)V+4
j java.awt.EventDispatchThread.pumpEvents(Ljava/awt/Conditional;)V+3
j java.awt.EventDispatchThread.run()V+9
v ~StubRoutines::call_stub

--------------- P R O C E S S ---------------

Java Threads: ( => current thread )
0x02b5e400 JavaThread "Image Animator 0" daemon [_thread_blocked, id=2376]
0x02b5ac00 JavaThread "Thread-6" [_thread_blocked, id=660]
0x02abac00 JavaThread "Thread-5" [_thread_in_native, id=3636]
0x02abc000 JavaThread "Thread-4" [_thread_blocked, id=3004]
0x02ab6400 JavaThread "Thread-3" [_thread_in_native, id=2924]
0x00305c00 JavaThread "DestroyJavaVM" [_thread_blocked, id=1520]
0x02b13000 JavaThread "Thread-2" [_thread_blocked, id=884]
0x030b8000 JavaThread "TimerQueue" daemon [_thread_blocked, id=1120]
=>0x0307b000 JavaThread "AWT-EventQueue-0" [_thread_in_native, id=2244]
0x02b1a400 JavaThread "AWT-Windows" daemon [_thread_in_native, id=3096]
0x02b19800 JavaThread "AWT-Shutdown" [_thread_blocked, id=2480]
0x02b2dc00 JavaThread "Java2D Disposer" daemon [_thread_blocked, id=2840]
0x02b05c00 JavaThread "Low Memory Detector" daemon [_thread_blocked, id=3944]
0x02b04400 JavaThread "CompilerThread0" daemon [_thread_blocked, id=2432]
0x02b00000 JavaThread "Attach Listener" daemon [_thread_blocked, id=3784]
0x02b1c400 JavaThread "Signal Dispatcher" daemon [_thread_blocked, id=2424]
0x02ac1000 JavaThread "Finalizer" daemon [_thread_blocked, id=1408]
0x02abcc00 JavaThread "Reference Handler" daemon [_thread_blocked, id=1652]

Other Threads:
0x02ab3800 VMThread [id=3248]
0x02b07000 WatcherThread [id=3704]

VM state:not at safepoint (normal execution)

VM Mutex/Monitor currently owned by a thread: None

Heap
def new generation total 960K, used 177K [0x229d0000, 0x22ad0000, 0x22eb0000)
eden space 896K, 14% used [0x229d0000, 0x229f12a0, 0x22ab0000)
from space 64K, 69% used [0x22ab0000, 0x22abb218, 0x22ac0000)
to space 64K, 0% used [0x22ac0000, 0x22ac0000, 0x22ad0000)
tenured generation total 4096K, used 2784K [0x22eb0000, 0x232b0000, 0x269d0000)
the space 4096K, 67% used [0x22eb0000, 0x23168360, 0x23168400, 0x232b0000)
compacting perm gen total 12288K, used 1356K [0x269d0000, 0x275d0000, 0x2a9d0000)
the space 12288K, 11% used [0x269d0000, 0x26b23038, 0x26b23200, 0x275d0000)
ro space 8192K, 66% used [0x2a9d0000, 0x2af19920, 0x2af19a00, 0x2b1d0000)
rw space 12288K, 52% used [0x2b1d0000, 0x2b816130, 0x2b816200, 0x2bdd0000)

Dynamic libraries:
0x00400000 - 0x00423000 D:\java\bin\java.exe
0x7c920000 - 0x7c9b3000 C:\WINDOWS\system32\ntdll.dll
0x7c800000 - 0x7c91e000 C:\WINDOWS\system32\kernel32.dll
0x77da0000 - 0x77e49000 C:\WINDOWS\system32\ADVAPI32.dll
0x77e50000 - 0x77ee2000 C:\WINDOWS\system32\RPCRT4.dll
0x77fc0000 - 0x77fd1000 C:\WINDOWS\system32\Secur32.dll
0x7c340000 - 0x7c396000 D:\java\jre\bin\msvcr71.dll
0x6d7c0000 - 0x6da07000 D:\java\jre\bin\client\jvm.dll
0x77d10000 - 0x77da0000 C:\WINDOWS\system32\USER32.dll
0x77ef0000 - 0x77f39000 C:\WINDOWS\system32\GDI32.dll
0x76b10000 - 0x76b3a000 C:\WINDOWS\system32\WINMM.dll
0x76300000 - 0x7631d000 C:\WINDOWS\system32\IMM32.DLL
0x62c20000 - 0x62c29000 C:\WINDOWS\system32\LPK.DLL
0x73fa0000 - 0x7400b000 C:\WINDOWS\system32\USP10.dll
0x6d310000 - 0x6d318000 D:\java\jre\bin\hpi.dll
0x76bc0000 - 0x76bcb000 C:\WINDOWS\system32\PSAPI.DLL
0x6d770000 - 0x6d77c000 D:\java\jre\bin\verify.dll
0x6d3b0000 - 0x6d3cf000 D:\java\jre\bin\java.dll
0x6d7b0000 - 0x6d7bf000 D:\java\jre\bin\zip.dll
0x6d000000 - 0x6d1c3000 D:\java\jre\bin\awt.dll
0x72f70000 - 0x72f96000 C:\WINDOWS\system32\WINSPOOL.DRV
0x77be0000 - 0x77c38000 C:\WINDOWS\system32\msvcrt.dll
0x76990000 - 0x76acd000 C:\WINDOWS\system32\ole32.dll
0x736d0000 - 0x7371b000 C:\WINDOWS\system32\ddraw.dll
0x73b30000 - 0x73b36000 C:\WINDOWS\system32\DCIMAN32.dll
0x6d2b0000 - 0x6d303000 D:\java\jre\bin\fontmanager.dll
0x74680000 - 0x746cc000 C:\WINDOWS\system32\MSCTF.dll
0x73640000 - 0x7366e000 C:\WINDOWS\system32\msctfime.ime
0x7d590000 - 0x7dd84000 C:\WINDOWS\system32\shell32.dll
0x77f40000 - 0x77fb6000 C:\WINDOWS\system32\SHLWAPI.dll
0x77180000 - 0x77283000 C:\WINDOWS\WinSxS\x86_Microsoft.Windows.Common-Controls_6595b64144ccf1df_6.0.2600.5512_x-ww_35d4ce83\comctl32.dll
0x5d170000 - 0x5d20a000 C:\WINDOWS\system32\comctl32.dll
0x6d570000 - 0x6d583000 D:\java\jre\bin\net.dll
0x71a20000 - 0x71a37000 C:\WINDOWS\system32\WS2_32.dll
0x71a10000 - 0x71a18000 C:\WINDOWS\system32\WS2HELP.dll
0x6d590000 - 0x6d599000 D:\java\jre\bin\nio.dll
0x10000000 - 0x10012000 C:\Program Files\Lingoes\Translator2\opentext.dll
0x6d450000 - 0x6d474000 D:\java\jre\bin\jpeg.dll
0x6d220000 - 0x6d243000 D:\java\jre\bin\dcpr.dll
0x719c0000 - 0x719fe000 C:\WINDOWS\system32\mswsock.dll
0x60fd0000 - 0x61025000 C:\WINDOWS\system32\hnetcfg.dll
0x71a00000 - 0x71a08000 C:\WINDOWS\System32\wshtcpip.dll
0x76ef0000 - 0x76f17000 C:\WINDOWS\system32\DNSAPI.dll
0x76f80000 - 0x76f88000 C:\WINDOWS\System32\winrnr.dll
0x76f30000 - 0x76f5c000 C:\WINDOWS\system32\WLDAP32.dll
0x76f90000 - 0x76f96000 C:\WINDOWS\system32\rasadhlp.dll
0x76d70000 - 0x76d92000 C:\WINDOWS\system32\Apphelp.dll
0x77bd0000 - 0x77bd8000 C:\WINDOWS\system32\VERSION.dll

VM Arguments:
java_command: MainFrame
Launcher Type: SUN_STANDARD

Environment Variables:
PATH=C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;D:\java\bin;C:\Program Files\StormII\Codec;C:\Program Files\StormII
USERNAME=Administrator
OS=Windows_NT
PROCESSOR_IDENTIFIER=x86 Family 15 Model 6 Stepping 5, GenuineIntel



--------------- S Y S T E M ---------------

OS: Windows XP Build 2600 Service Pack 3

CPU:total 1 family 15, cmov, cx8, fxsr, mmx, sse, sse2

Memory: 4k page, physical 1039828k(480312k free), swap 2498192k(2004724k free)

vm_info: Java HotSpot(TM) Client VM (1.6.0-b105) for windows-x86, built on Nov 29 2006 00:48:48 by "java_re" with unknown MS VC++:1310