http://bugs.winehq.org/show_bug.cgi?id=8125
------- Additional Comments From focht@gmx.net 2007-23-04 14:55 ------- Hello,
as usual i picked out the interesting ones :)
The attached error log produced by the applications own crash dumper is misleading.
I extended the callstack with my own findings from debugging native java (JNI):
--- snip --- C [msvcrt.dll+0x216b7] cxx_exception_handler C [java.dll+0x9723] wcanonicalize(WCHAR *orig_path, WCHAR *result, int size) C [java.dll+0x8794] Java_java_io_WinNTFileSystem_canonicalize0(JNIEnv *env, jobject this, jstring pathname) j java.io.WinNTFileSystem.canonicalize0(Ljava/lang/String;)Ljava/lang/String;+0 j java.io.Win32FileSystem.canonicalize(Ljava/lang/String;)Ljava/lang/String;+298 j java.io.File.getCanonicalPath()Ljava/lang/String;+10 j java.lang.ClassLoader.loadLibrary0(Ljava/lang/Class;Ljava/io/File;)Z+25 j java.lang.ClassLoader.loadLibrary(Ljava/lang/Class;Ljava/lang/String;Z)V+217 j java.lang.Runtime.loadLibrary0(Ljava/lang/Class;Ljava/lang/String;)V+54 j java.lang.System.loadLibrary(Ljava/lang/String;)V+7 j java.lang.System.initializeSystemClass()V+110 --- snip ---
Although the callstack is completely valid, it never crashes there (just returns fine). Wasted some time to realize this.
The console java callstack is the right one. Analyzing/debug obfuscated java code is not much fun, so here it goes...
Basically the following code produces the exception (might not match real code 100% - just to illustrate the problem):
--- snip app code --- private File some_func() { String strProps = System.getProperty("app_default_settings"); if(strProps == null) { // no defaults yet! if(OS.isWindows() && !OS.isWindows9x() && some_helper.is_java_version_1_5()) { StringBuffer sb = new StringBuffer(System.getenv("ALLUSERSPROFILE")); sb.append(File.separatorChar).append("Application Data"); sb.append(File.separatorChar).append("company_name_here"); strProps = sb.toString(); } else if(OS.isMacintosh()) strProps = "/Users/Shared/company_name_here"; else if(OS.isUnix()) strProps = "/usr/local/share/company_name_here"; else strProps = System.getProperty("user.home");
sb = (new StringBuilder()).append(sb).append(File.separator).append("app_default_settings").toString(); } return new File(sb); }
--- snip app code ---
This is the problematic code:
StringBuffer sb = new StringBuffer(System.getenv("ALLUSERSPROFILE"));
System.getenv("ALLUSERSPROFILE") (which boils down to getenv()) doesnt return anything useful in wine (at least on my system). Therefore StringBuffer() ctor throws. Guess. No Exception handler. Bad guys :)
To verify my analysis:
1.) set wine to Win9X (see the code snippet, the getenv() code is never reached in this case) using winecfg. Result: no crash (app starts up, displaying all sorts of windows)
2.) set environment variable in shell (e.g. $ export ALLUSERSPROFILE="c:\blah") Result: no crash (app starts up, displaying all sorts of windows)
Resolution:
Either use Win9X config or have wine "%ALLUSERSPROFILE%" defined.
Regards