Path: csiph.com!usenet.pasdenom.info!news.albasani.net!eternal-september.org!feeder.eternal-september.org!mx04.eternal-september.org!.POSTED!not-for-mail From: Daniele Futtorovic Newsgroups: comp.lang.java.programmer Subject: Re: throw null investigation Date: Thu, 19 Jul 2012 00:06:57 +0200 Organization: A noiseless patient Spider Lines: 22 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Injection-Date: Wed, 18 Jul 2012 22:07:29 +0000 (UTC) Injection-Info: mx04.eternal-september.org; posting-host="af443352c696022ce926c3d891feba1d"; logging-data="25870"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/dTDg2Kj8QnypyI/wywq79" User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.2.28) Gecko/20120306 Thunderbird/3.1.20 In-Reply-To: Cancel-Lock: sha1:XWc/4coeZBv0TlZmyGgGZaVwtq8= Xref: csiph.com comp.lang.java.programmer:16092 On 18/07/2012 23:43, markspace allegedly wrote: > 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. But if what you say is correct, and Java does /not/ systematically wrap nulls "thrown" from JNI (assuming it's possible), then it would be technically possible to catch a null Exception in the Java runtime, wouldn't it? -- DF.