Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: GUI errors on launch



Dear Jeremy,

On 28.08.2006, at 18:05, Jeremy Wood wrote:
.. In the past 2 weeks, about 3 times now the application has failed to launch. But he launches the application about 10 times a day ...

This is a typical symptom for a race condition.


What I believe to be happening is that we have to make some static calls to methods in com.t4l.io.MiscIO... in order to reach those methods, we're initializing a static field that contains a JFileChooser. While constructing that GUI element, a ClassCastException is coming up... which causes all of MiscIO to fail to load... which then makes for ClassNotFound problems whenever we talk to MiscIO.

Yes, this is most likely the cause of the problem.

> java.lang.ClassCastException: javax.swing.KeyStroke
> ...
> at javax.swing.JFileChooser.<init>(JFileChooser.java:273)
> at com.t4l.io.DirectoryChooser.<init>(MiscIO.java:2030)
> at com.t4l.io.MiscIO.<clinit>(MiscIO.java:854)
> ...
> at apple.launcher.JavaApplicationLauncher.launch (JavaApplicationLauncher.java:52)


According to this stack trace, a static initializer is causing the creation of a Swing JFileChooser on the Main-Thread.
To fix this, you need to change the static initializer of class com.t4l.io.MiscIO.



We found from past experience that we need to initialize the JFileChooser early on. I forget the exact rules (there are so many subtle tricks on Macs)... but I think if we initialize the JFileChooser *after* QTJava, it can take over 10-20 seconds to initialize. (And if we initialize it first, it takes less than 3.) So we'd rather figure out how to make this safe without constructing the JFileChooser lazily.

Hm. I don't know why this is happening.

But my MultiShow application, initializes QTJava very early during the application startup phase. I never noticed slow-downs in JFileChooser because of this.


With best regards, Werner Randelshofer _______________________________________________ Do not post admin requests to the list. They will be ignored. Java-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/java-dev/email@hidden

This email sent to email@hidden
References: 
 >GUI errors on launch (From: Jeremy Wood <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.