JDK-6342514 : XP L&F: 64 bit JDK 5 crashes running JEdit with Windows Swing Theme - Others run fine
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 5.0
  • Priority: P4
  • Status: Closed
  • Resolution: Won't Fix
  • OS: windows_xp
  • CPU: x86
  • Submitted: 2005-10-27
  • Updated: 2014-03-27
  • Resolved: 2014-03-27
Related Reports
Relates :  
Relates :  
Description
FULL PRODUCT VERSION :
vm_info: Java HotSpot(TM) 64-Bit Server VM (1.5.0_05-b05) for windows-amd64, built on Aug 26 2005 14:56:05 by "java_re" with unknown MS VC++:1400

ADDITIONAL OS VERSION INFORMATION :
Windows XP PRO SP1 64-bit
OS: Windows Server 2003 family Build 3790 Service Pack 1
CPU:total 2 em64t ht

EXTRA RELEVANT SYSTEM CONFIGURATION :
Running tiny firewall 64-bit version

A DESCRIPTION OF THE PROBLEM :
Running JEdit with Windows swing theme on 64 bit JDK 1.5.0_05-b05 crashes the jvm with following crash dump

#
# An unexpected error has been detected by HotSpot Virtual Machine:
#
#  EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x000000005ff0e7f1, pid=1944, tid=2624
#
# Java VM: Java HotSpot(TM) 64-Bit Server VM (1.5.0_05-b05 mixed mode)
# Problematic frame:
# C  [UmxSbxA64.dll+0xe7f1]
#

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

Current thread (0x00000000022f95d0):  JavaThread "main" [_thread_in_native, id=2624]

siginfo: ExceptionCode=0xc0000005, reading address 0x0000000000000008

Registers:
EAX=0x0000000000000008, EBX=0x0000000001c87d10, ECX=0x0000000001c87d10, EDX=0x0000000000000000
ESP=0x000000000012e850, EBP=0x000000000012e880, ESI=0x000000005ff33230, EDI=0x0000000001c87d8a
EIP=0x000000005ff0e7f1, EFLAGS=0x0000000000010202

  Top of Stack: (sp=0x000000000012e850)
0x000000000012e850:   0000000001c8ee00 000000005ff19036
0x000000000012e860:   0000000000000030 0000000000000030
0x000000000012e870:   0000000001c7db00 000000005ff19036
0x000000000012e880:   00000000022f9701 000000005ff36838
0x000000000012e890:   0000000001c8ee00 000000005ff0ddee
0x000000000012e8a0:   0000000001c98480 0000000001c98480
0x000000000012e8b0:   0000000001c7db00 000000005ff1b434
0x000000000012e8c0:   000000000012ecd8 000000005ff36838
0x000000000012e8d0:   000000000012ecd8 000000000012ea00
0x000000000012e8e0:   fffffffffffffffe 0000000001c87d8a
0x000000000012e8f0:   0000000001c87d10 000000005ff19ab3
0x000000000012e900:   0000000001c87d10 00000000022f95d0
0x000000000012e910:   000000005ff36870 00000000022f97ff
0x000000000012e920:   000000005ff36830 0000000001c87d8a
0x000000000012e930:   000000005ff33230 0000000001c87d10
0x000000000012e940:   0000000001c87d48 000000005ff0f74c

Instructions: (pc=0x000000005ff0e7f1)
0x000000005ff0e7e1:   81 78 04 00 00 33 d2 48 3b c2 0f 84 62 04 00 00
0x000000005ff0e7f1:   39 10 0f 84 5a 04 00 00 81 79 30 00 00 00 80 76


Stack: [0x0000000000030000,0x0000000000130000),  sp=0x000000000012e850,  free space=1018k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
C  [UmxSbxA64.dll+0xe7f1]

Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
j  sun.awt.windows.ThemeReader.getTextResourceByInt(Ljava/lang/String;ILjava/lang/String;)Ljava/lang/String;+0
j  sun.awt.windows.ThemeReader.access$400(Ljava/lang/String;ILjava/lang/String;)Ljava/lang/String;+3
j  sun.awt.windows.ThemeReader$TextResources.<init>(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V+12
j  sun.awt.windows.ThemeReader.loadResources()V+53
j  sun.awt.windows.ThemeReader.loadResources(Ljava/lang/String;)Ljava/util/Map;+6
j  sun.awt.windows.WToolkit.lazilyLoadDesktopProperty(Ljava/lang/String;)Ljava/lang/Object;+82
j  java.awt.Toolkit.getDesktopProperty(Ljava/lang/String;)Ljava/lang/Object;+69
j  com.sun.java.swing.plaf.windows.XPStyle.getString(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;+7
j  com.sun.java.swing.plaf.windows.XPStyle.getString(Ljava/lang/String;)Ljava/lang/String;+105
j  com.sun.java.swing.plaf.windows.XPStyle.<init>()V+42
j  com.sun.java.swing.plaf.windows.XPStyle.getXP()Lcom/sun/java/swing/plaf/windows/XPStyle;+71
j  com.sun.java.swing.plaf.windows.WindowsTreeUI$ExpandedIcon.<init>()V+5
j  com.sun.java.swing.plaf.windows.WindowsTreeUI$ExpandedIcon.createExpandedIcon()Ljavax/swing/Icon;+4
j  com.sun.java.swing.plaf.windows.WindowsLookAndFeel.initComponentDefaults(Ljavax/swing/UIDefaults;)V+339
j  javax.swing.plaf.basic.BasicLookAndFeel.getDefaults()Ljavax/swing/UIDefaults;+20
j  javax.swing.UIManager.setLookAndFeel(Ljavax/swing/LookAndFeel;)V+79
j  javax.swing.UIManager.setLookAndFeel(Ljava/lang/String;)V+37
j  org.gjt.sp.jedit.jEdit.initPLAF()V+95
j  org.gjt.sp.jedit.jEdit.main([Ljava/lang/String;)V+1555
v  ~StubRoutines::call_stub

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

Java Threads: ( => current thread )
  0x00000000022fb610 JavaThread "AWT-EventQueue-0" [_thread_blocked, id=2036]
  0x00000000022fb360 JavaThread "Image Fetcher 0" daemon [_thread_blocked, id=1264]
  0x00000000022fb0b0 JavaThread "AWT-Windows" daemon [_thread_in_native, id=2248]
  0x00000000022fae00 JavaThread "AWT-Shutdown" [_thread_blocked, id=2856]
  0x00000000022fab50 JavaThread "Java2D Disposer" daemon [_thread_blocked, id=1260]
  0x00000000022fa8a0 JavaThread "Low Memory Detector" daemon [_thread_blocked, id=3052]
  0x00000000022fa5f0 JavaThread "CompilerThread1" daemon [_thread_blocked, id=2992]
  0x00000000022fa340 JavaThread "CompilerThread0" daemon [_thread_blocked, id=2880]
  0x00000000022fa090 JavaThread "AdapterThread" daemon [_thread_blocked, id=2444]
  0x00000000022f9de0 JavaThread "Signal Dispatcher" daemon [_thread_blocked, id=2988]
  0x00000000022f9b30 JavaThread "Finalizer" daemon [_thread_blocked, id=2664]
  0x00000000022f9880 JavaThread "Reference Handler" daemon [_thread_blocked, id=812]
=>0x00000000022f95d0 JavaThread "main" [_thread_in_native, id=2624]

Other Threads:
  0x00000000022ee350 VMThread [id=2844]
  0x00000000022ee680 WatcherThread [id=1432]

VM state:not at safepoint (normal execution)

VM Mutex/Monitor currently owned by a thread: None

Heap
 def new generation   total 2368K, used 2328K [0x0000000050010000, 0x00000000502a0000, 0x0000000051c10000)
  eden space 2112K,  98% used [0x0000000050010000, 0x00000000502162f8, 0x0000000050220000)
  from space 256K, 100% used [0x0000000050260000, 0x00000000502a0000, 0x00000000502a0000)
  to   space 256K,   0% used [0x0000000050220000, 0x0000000050220000, 0x0000000050260000)
 tenured generation   total 1792K, used 501K [0x0000000051c10000, 0x0000000051dd0000, 0x0000000055410000)
   the space 1792K,  27% used [0x0000000051c10000, 0x0000000051c8d498, 0x0000000051c8d600, 0x0000000051dd0000)
 compacting perm gen  total 21248K, used 10365K [0x0000000055410000, 0x00000000568d0000, 0x000000005a610000)
   the space 21248K,  48% used [0x0000000055410000, 0x0000000055e2f790, 0x0000000055e2f800, 0x00000000568d0000)
No shared spaces configured.

Dynamic libraries:
0x0000000000400000 - 0x0000000000411000 	D:\Application\Java\jdk1.5.0_05\bin\javaw.exe
0x0000000078ec0000 - 0x0000000078ff9000 	D:\WINDOWS\system32\ntdll.dll
0x0000000078d40000 - 0x0000000078eb2000 	D:\WINDOWS\system32\kernel32.dll
0x000007ff7fee0000 - 0x000007ff7ffe5000 	D:\WINDOWS\system32\ADVAPI32.dll
0x000007ff7fd30000 - 0x000007ff7fed9000 	D:\WINDOWS\system32\RPCRT4.dll
0x0000000078c30000 - 0x0000000078d3c000 	D:\WINDOWS\system32\USER32.dll
0x000007ff7fc90000 - 0x000007ff7fd28000 	D:\WINDOWS\system32\GDI32.dll
0x000007ff7fc00000 - 0x000007ff7fc86000 	D:\WINDOWS\system32\MSVCRT.dll
0x000000005fe00000 - 0x000000005fe19000 	D:\WINDOWS\system32\UmxSbxExA64.dll
0x000000005ff00000 - 0x000000005ff46000 	D:\WINDOWS\system32\UmxSbxA64.dll
0x000007ff7e1b0000 - 0x000007ff7e1c0000 	D:\WINDOWS\system32\psapi.dll
0x0000000008000000 - 0x00000000084dc000 	D:\Application\Java\jdk1.5.0_05\jre\bin\server\jvm.dll
0x000007ff7e060000 - 0x000007ff7e0b0000 	D:\WINDOWS\system32\WINMM.dll
0x0000000010000000 - 0x0000000010009000 	D:\Application\Java\jdk1.5.0_05\jre\bin\hpi.dll
0x0000000000170000 - 0x0000000000180000 	D:\Application\Java\jdk1.5.0_05\jre\bin\verify.dll
0x0000000000180000 - 0x00000000001aa000 	D:\Application\Java\jdk1.5.0_05\jre\bin\java.dll
0x00000000001b0000 - 0x00000000001c4000 	D:\Application\Java\jdk1.5.0_05\jre\bin\zip.dll
0x0000000004580000 - 0x0000000004776000 	D:\Application\Java\jdk1.5.0_05\jre\bin\awt.dll
0x000007ff78d50000 - 0x000007ff78d91000 	D:\WINDOWS\system32\WINSPOOL.DRV
0x000007ff7d320000 - 0x000007ff7d359000 	D:\WINDOWS\system32\IMM32.dll
0x000007ff7eb10000 - 0x000007ff7ed82000 	D:\WINDOWS\system32\ole32.dll
0x00000000048f0000 - 0x000000000494c000 	D:\Application\Java\jdk1.5.0_05\jre\bin\fontmanager.dll
0x000007ff77060000 - 0x000007ff770df000 	D:\WINDOWS\system32\uxtheme.dll
0x000007ff79190000 - 0x000007ff79202000 	D:\WINDOWS\system32\ddraw.dll
0x000007ff793e0000 - 0x000007ff793e8000 	D:\WINDOWS\system32\DCIMAN32.dll
0x000007ff7a240000 - 0x000007ff7a2df000 	D:\WINDOWS\system32\MSCTF.dll
0x0000000004d00000 - 0x0000000004d1a000 	D:\Application\Java\jdk1.5.0_05\jre\bin\net.dll
0x000007ff77150000 - 0x000007ff77180000 	D:\WINDOWS\system32\WS2_32.dll
0x000007ff77140000 - 0x000007ff7714c000 	D:\WINDOWS\system32\WS2HELP.dll
0x0000000004da0000 - 0x0000000004daa000 	D:\Application\Java\jdk1.5.0_05\jre\bin\nio.dll
0x000007ff7f1a0000 - 0x000007ff7fba7000 	D:\WINDOWS\system32\shell32.dll
0x000007ff7ef60000 - 0x000007ff7effb000 	D:\WINDOWS\system32\SHLWAPI.dll
0x000007ff7f010000 - 0x000007ff7f197000 	D:\WINDOWS\WinSxS\amd64_Microsoft.Windows.Common-Controls_6595b64144ccf1df_6.0.3790.1830_x-ww_ACED72AF\comctl32.dll
0x000007ff76fe0000 - 0x000007ff7705c000 	D:\WINDOWS\system32\mswsock.dll
0x000007ff6d1f0000 - 0x000007ff6d281000 	D:\WINDOWS\system32\hnetcfg.dll
0x000007ff76fa0000 - 0x000007ff76fab000 	D:\WINDOWS\System32\wshtcpip.dll
0x00000000058d0000 - 0x0000000005ccf000 	D:\WINDOWS\resources\Themes\luna\luna.msstyles

VM Arguments:
java_command: D:\Program Files (x86)\jEdit\jedit.jar


---------------------------------------------------------------

NOTE: Other swing themes like Metal works just fine. Also, 32 bit jvm on 64 bit OS runs fine with all swing themes.

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1) Install JEdit 4.2 and run with 64 bit jvm 1.5.0_05 on windows xp pro 64 bit
2) Switch swing theme to windows using the Utilities-->Global Options-->Appearance menu
3) Restart Jedit
4)JVM crashes on startup

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Jedit to open up with windows swing theme
ACTUAL -
jvm crashes with dump

ERROR MESSAGES/STACK TRACES THAT OCCUR :


VM Arguments:
java_command: D:\Program Files (x86)\jEdit\jedit.jar


REPRODUCIBILITY :
This bug can be reproduced always.

CUSTOMER SUBMITTED WORKAROUND :
1) Metal theme works fine
2) Windows swing theme on 32 bit jvm installed on 64 - bit windows xp pro works fine.

Comments
EVALUATION I am pretty confident that this bug cannot affect Mustang because the entire codepath this affects has been replaced. We now use the native Windows UXTheme api instead of using desktop properties to get theme information. This was part of the big XPStyle overhaul in 5106661. I have retargeted to Tiger.
07-03-2006

EVALUATION Looking at the relevant code in XPStyle.getString(String,String,String) I am pretty sure that this bug cannot happen on Mustang. The XPStyle.getString() method was completely rewritten between Tiger and Mustang. The bug occurs when toolkit.getDesktopProperty("win.xpstyle.resources.strings") returns null and I cannot find any place in the code where we call this anymore. We are obtaining all of the style information through native api calls rather than desktop properties now. We should decide if it's important enough to fix for a Tiger update though. It would be fairly easy to modify the XPStyle.getString() method to return null if the getDesktopProperty() call returns null. There are only three places in the Tiger code that appear to call XPStyle.getString() and they should all handle nulls safely.
07-03-2006

EVALUATION Lots of additional help on the JDC report: 2006-02-01 I have had this same stack trace using vanilla Win XP with a modified theme. Problem is, we don't know what modification to the theme causes this. The fix is to reset the theme to "Windows XP" in the "Themes" tab. Then the NPE goes away. After resetting the theme it is hard to reproduce - we don't know exactly which modification to the theme caused the problem. Here's my stack trace: java.lang.NullPointerException at com.sun.java.swing.plaf.windows.XPStyle.getString(XPStyle.java:132) at com.sun.java.swing.plaf.windows.XPStyle.getString(XPStyle.java:115) at com.sun.java.swing.plaf.windows.XPStyle.(XPStyle.java:811) at com.sun.java.swing.plaf.windows.XPStyle.getXP(XPStyle.java:82) at com.sun.java.swing.plaf.windows.WindowsTreeUI$ExpandedIcon.(WindowsTreeUI.java:103) at com.sun.java.swing.plaf.windows.WindowsTreeUI$ExpandedIcon.createExpandedIcon(WindowsTreeUI.java:107) at com.sun.java.swing.plaf.windows.WindowsLookAndFeel.initComponentDefaults(WindowsLookAndFeel.java:312) at javax.swing.plaf.basic.BasicLookAndFeel.getDefaults(BasicLookAndFeel.java:96) at javax.swing.UIManager.setLookAndFeel(UIManager.java:441) at javax.swing.UIManager.setLookAndFeel(UIManager.java:481) 2006-02-24 The previous post is a little misleading. Changing the 'Theme' in the windows Display Properties fixes the problem because it resets the style to 'Windows XP Style'. You can do this directly, without changing the theme, by clicking the 'Appearance' tab and choosing 'Windows XP Style' under 'Windows and Buttons'. The problem is caused by this setting being set to 'Windows Classic Style'. It seems that both styles should be supported and that the ThemeReader class should not experience the NullPointerException in the native method getTextResourceByInt when in Windows Classic Style. 2006-02-28 test 2006-02-28 This is a test comment. Please ignore it. 2006-03-01 Looking at the XPStyle.getString(String, String, String) method, I can see the NPE. if (category == null || category.length() == 0) { value = (String)resources.get(attributeKey); } else { if (state == null || state.length() == 0) { value = (String)resources.get(category + "." + attributeKey); } else { value = (String)resources.get(category + "(" + state + ")." + attributeKey); } } Seems that the null checking is done on the incorrect parameters. Not entirely sure how the logic works here, but the attributeKey parameter must be checked for null also. This should avoid the NPE. As for the cause, not sure what modifications in the themes causes this error. This error occured with Netbeans 5.0 and the workaround I used was to reset the themes in Windows. 2006-03-01 I also forgot to mention that this might also be the source of the problem as well. Map resources = (Map)toolkit.getDesktopProperty("win.xpstyle.resources.strings"); That call in the XPStyle.getString(String, String, String) method. 2006-03-03 The bug is about a crash, while you are writing about NPE. Does your system crash after NPE has occured? 2006-03-06 First, the question about NPE and crashing. NPE is a RuntimeException. It does not have to be caught. If your program does not handle RuntimeExceptions, it can cause your program to terminate. Now, Map resources = (Map)toolkit.getDesktopProperty("win.xpstyle.resources.strings"); is a problem but only indirectly. The problem is that after this call, the variable 'resources' is null. The NPE is occuring on the first get call on this map. The root cause of this map being null is the failure of the native method sun.awt.windows.ThemeReader.getTextResourceByInt as identified in the original thread dump. This native method only fails if the style in Windows XP is set to something other than 'Windows XP Style', for example 'Windows Classic Style'. Just for completeness, this code only gets called if the LAF is explicitly set to the system LAF. So you will only see this problem if you are running Windows XP and have the style set to something other than 'Windows XP Style' and the program you are running makes a call to set the LAF to the system LAF. If the program you are running does not catch the RuntimeException and then just accept the default LAF, there is a good chance that the JVM will terminate.
07-03-2006

EVALUATION As it can be seen from the stack trace provided, the crash happens in Swing code (com.sun.java.swing.plaf.windows.XPStyle class), so I'm dispatching this CR to them.
03-03-2006