Path: csiph.com!usenet.pasdenom.info!gegeweb.org!eternal-september.org!feeder.eternal-september.org!mx04.eternal-september.org!.POSTED!not-for-mail From: markspace <-@.> Newsgroups: comp.lang.java.programmer Subject: Re: throw null investigation Date: Wed, 18 Jul 2012 14:43:58 -0700 Organization: A noiseless patient Spider Lines: 16 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Wed, 18 Jul 2012 21:43:59 +0000 (UTC) Injection-Info: mx04.eternal-september.org; posting-host="61282af8d6595e8d991edb5ac03d6e00"; logging-data="17919"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/lCjNLb28Cd2l1MTVWFMljN6xb2K5XAYo=" User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:14.0) Gecko/20120713 Thunderbird/14.0 In-Reply-To: Cancel-Lock: sha1:lYqqQrayKXqbaQxK/i0J8Z6g37M= Xref: csiph.com comp.lang.java.programmer:16090 On 7/18/2012 2:33 PM, Daniele Futtorovic wrote: > But if the JNI code actually wanted to throw an NPE, and teh Jav wraps a > null into an NPE, wouldn't it actually be more efficient if the JNI code > "threw" a null? That's what I'm saying. I think perhaps Java does NOT wrap a null exception thrown by JNI code. Java wraps a null value when you throw it from Java, but JNI tends to have a lot of holes, especially if you are dealing with "signed" or "trusted" code. There's ways to get around the checks Java does of JNI code in the interest of speed, and if you don't check, then you don't get protection.