Java Cocoa, NSTableView, and AbstractMethodError
Java Cocoa, NSTableView, and AbstractMethodError
- Subject: Java Cocoa, NSTableView, and AbstractMethodError
- From: "Nathan V. Roberts" <email@hidden>
- Date: Wed, 16 Jan 2002 16:08:13 -0600
Hi,
I'm writing an app in Java Cocoa, and it suffers from an apparently
random bug that causes it to crash on start, and that without
printing a stack trace to console. (The probability of crash on a
given run seems to be somewhere between 1/120 and 1/20.) I'm
thinking that this may be an Apple bug, possibly in the Java Bridge
or in NSTableView, and would like (dis)confirmation of that
hypothesis.
The crash log invariably refers to one of two NSTableView methods,
either _dataSourceValueForColumn:row: or numberOfRows. For example:
Exception: EXC_BAD_ACCESS (0x0001)
Codes: KERN_PROTECTION_FAILURE (0x0002) at 0x000001d4
Thread 0:
#0 0x760e5454 in JVM_GetCPFieldSignatureUTF
#1 0x761002b8 in JVM_DoPrivileged
#2 0x76119ac4 in JVM_DefineClass
#3 0x76106028 in JVM_GetMethodIxExceptionsCount
#4 0x761e2a58 in jio_vsnprintf
#5 0x73ad82c4 in __JAVAMethodInvoke
#6 0x73ad85b4 in JAVAMethodInvoke
#7 0x73ade7a0 in _NSInvokeJavaMethod
#8 0x73adaca0 in _BRIDGEMethodImp
#9 0x70bd1e8c in -[NSTableView _dataSourceValueForColumn:row:]
#10 0x70ba325c in -[NSTableView drawRow:clipRect:]
#11 0x70bba4cc in -[NSTableView drawRect:]
#12 0x70c39cf8 in -[NSView _drawRect:clip:]
(Incidentally, is there a good way to map from the crash log's stack
trace info for a java function to the actual java function?)
Anyway, I've looked at thread synch issues and generally pored
through my code, found nothing. But the other day I got it to happen
while I was running the app from within Project Builder, and got the
following stack trace:
----
2002-01-15 15:54:57.290 StopWatch Plus[1084] Exception raised during
posting of notification. Ignored. exception:
java/lang/AbstractMethodError
Stack Trace:
java.lang.AbstractMethodError
at
com.apple.cocoa.application.NSTableView.noteNumberOfRowsChanged(Native
Method)
at dsTSUICocoa.refreshTable(dsTSUICocoa.java:331)
at dsTSUICocoa.awakeFromNib(dsTSUICocoa.java:77)
at
com.apple.cocoa.application.NSApplication.loadNibNamed(Native Method)
at dsNibLoader.loadTimeSheet(dsNibLoader.java:104)
at
dsAppDelegateCocoa.applicationDidFinishLaunching(dsAppDelegateCocoa.java:122)
StopWatch Plus.app has exited due to signal 11 (SIGSEGV).
---------
Looking up AbstractMethodError (in Apple's copy of the Java docs), I
found the following:
"Thrown when an application tries to call an abstract method.
Normally, this error is caught by the compiler; this error can only
occur at run time if the definition of some class has incompatibly
changed since the currently executing method was last compiled."
Now, I'm not doing anything fancy like reflection, or any kind of
dynamic class defining. In addition, the error is reported as coming
from NSTableView. So this looks to me like an Apple bug. Right?
Has anyone else run into this? Any suggestions for a workaround?
I've tried catching AbstractMethodError in the relevant portions of
my code, but apparently whatever causes the error to be thrown
crashes the app, regardless of whether the error is caught.
Thanks for any suggestions.
Nate