IMD wrote:
| I have written a method which reads all the records from address book
| on Mac OS X.2 with the help of NSAppleScript class.
|
| Some time code is running fine but sometime it generates
| IllegalMonitorStateException. The print stack trace is given below:-
| (please see the code after print stack trace)
|
| A Buckyball Timer threw an exception:
| java.lang.IllegalMonitorStateException: current thread not owner
| at com.apple.mrj.macos.carbon.CarbonLock.release0(Native Method)
| at com.apple.mrj.macos.carbon.CarbonLock.release(CarbonLock.java:43)
| at com.apple.buckyball.app.Timer.EventLoopTimer(Timer.java:213)
| at com.apple.cocoa.foundation.NSAppleScript.execute(Native Method)
| at
| com.inmarsat.mmi.launchpad.nativeresource.macx.MacXContacts.getContactsL
| ist(MacXContacts.java:127)
1. What version of Java are you using? The appearance of "mrj" and "CarbonLock" suggests that it's 1.3.1 or earlier.
2. The presence of "synchronized" in your code suggests that you're using multiple threads. The occurrence of IllegalMonitorStateException suggests the same thing. Why are you using them? (The AppleScript is executed within a "synchronized" block, which means that you'll be running one at a time even if you *do* have multiple threads.)
3. Are you trying to use Cocoa and Swing classes in the same program? Doing so is asking for trouble.
| I have tried to even catch IllegalMonitorStateException but control is
| not coming in catch block and it hangs the application.
How did you try to catch it? The stack trace shows that it's being thrown within your code.
| please respond me as soon as possible.
Do remember that this is *e-mail*, not instant messaging. Remember, too, that this is the week between Christmas and New Year's Day, a time when many of the regulars will be away from work. It's unrealistic to expect a response in eight minutes at the best of times; I've seen it take several *hours* merely to have my own post come back to me. With the list effectively shut down for Christmas due to everyone being off doing other things, I'd recommend even more patience.
Overall, the usual advice applies: create the smallest complete program that you can that produces the same problem, then post it. Make sure that what you post can be compiled and run by others.
Glen Fisher
_______________________________________________
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