housekeeping in the lower layers of my stuff to obey the "new" rule. As a
side-effect of that, my stuff now uses the "current" JNIEnv for all operations,
not just DeleteLocalRef() -- which is why I'm not all that interested in what
other restrictions there may be (if there are any at all), and the details have
faded from my mind.
Incidentally, I agree with your suggestion (elsethread) that the error message
the OP has now provided is indicative of an attempt to deference a NULL
pointer.
-- chris
> [me:]
>> > If your code has been called by Java, then that will provide a JNIEnv
[quoted text clipped - 10 lines]
> didn't locate it. If it's going to come down to re-reading the entire
> spec looking for it then you can do that as easily as I ;-)
True. BTW what do you regard as "the spec"? I tried using the JNI
documentation that comes with Java and forgot that I had downloaded Sheng
Liang's "Programmer's Guide and Specification" which I find much better.
> This came up when I was setting up my JNI stuff some years ago. I tried
> porting my code to run with the IBM JMV, and it (helpfully) complained
[quoted text clipped - 10 lines]
> interested in what other restrictions there may be (if there are any at
> all), and the details have faded from my mind.
Oh; OK. I knew about that one (having read it more recently than you, I
expect). I was just getting an impression that you were suggesting that we
could not depend on the JNIEnv staying constant on a given thread, which I
thought was guaranteed (and thus allowed caching in a single-threaded
program).
> Incidentally, I agree with your suggestion (elsethread) that the error
> message the OP has now provided is indicative of an attempt to deference a
> NULL pointer.
Yes. But I don't think it is the JNIEnv that is null.
Can the OP instruct the JVM to run with all that JNI protection code enabled
(the verbose:jni I presume; I have forgotten)
> -- chris

Signature
Bill Medland
Chris Uppal - 13 Oct 2006 10:52 GMT
> BTW what do you regard as "the spec"? I tried using the JNI
> documentation that comes with Java and forgot that I had downloaded Sheng
> Liang's "Programmer's Guide and Specification" which I find much better.
In my case it would have been the version of the "JNI Specification" (plus
ammendements) which came with the JDK 1.3. Obviously, I use the version which
comes with 1.5 these days ;-)
As far as I know, Liang's book includes the spec in toto, but I haven't checked
it word-for-word, and I don't know which version of the spec it is anyway.
> Can the OP instruct the JVM to run with all that JNI protection code
> enabled (the verbose:jni I presume; I have forgotten)
-Xcheck:jni
That's certainly worth trying. One word of warning is that I think the
checking code in at least one version of 1.5 was buggy and reported errors
where there was none. At least, I have some code which an earlier dot.dot
release reported as wrong, but I can't find anything wrong with it, and neither
1.4.x nor later versions of 1.5 report any problem. (I'm currently usng
1.5.0_06-b05).
Another thing that's worth trying if the OP has access to a sufficiently
up-to-date IBM JVM, is to try that. The IBM error checking is (or was when I
last tried it -- back in 1.3 days) superior to Sun's.
-- chris