Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #16088

Re: throw null investigation

Path csiph.com!usenet.pasdenom.info!aioe.org!eternal-september.org!feeder.eternal-september.org!mx04.eternal-september.org!.POSTED!not-for-mail
From Daniele Futtorovic <da.futt.news@laposte-dot-net.invalid>
Newsgroups comp.lang.java.programmer
Subject Re: throw null investigation
Date Wed, 18 Jul 2012 23:33:52 +0200
Organization A noiseless patient Spider
Lines 34
Message-ID <ju7a51$d92$1@dont-email.me> (permalink)
References <a8e60469-b392-4a98-b845-42caa79f7959@googlegroups.com> <GhENr.7926$jA7.4844@newsfe15.iad> <ju76n5$pcv$1@dont-email.me>
Mime-Version 1.0
Content-Type text/plain; charset=ISO-8859-1
Content-Transfer-Encoding 7bit
Injection-Date Wed, 18 Jul 2012 21:34:25 +0000 (UTC)
Injection-Info mx04.eternal-september.org; posting-host="af443352c696022ce926c3d891feba1d"; logging-data="13602"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+tGMTb8zP+jEqRZK/NzxSa"
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 <ju76n5$pcv$1@dont-email.me>
Cancel-Lock sha1:XEtgJgIhXCtE3hbg5yMQCGEoWIY=
Xref csiph.com comp.lang.java.programmer:16088

Show key headers only | View raw


On 18/07/2012 22:35, markspace allegedly wrote:
> On 7/18/2012 12:39 PM, Daniel Pitts wrote:
>> On 7/18/12 10:10 AM, bob smith wrote:
>>> Is it common practice to throw a null exception when writing JNI code?
>>>
>>> I'm seeing an exception that is simply a null rather than an object,
>>> and I'm wondering if it's because it's easier to do that in JNI.
>>>
>>  From what I can tell, that shouldn't ever happen. I'm not sure in JNI,
>> but I know in Java if you throw a "null", it will instead throw a
>> NullPointerException, so anyone catching that Throwable will not see a
>> "null" value, but instead a NullPointerException instance.
>>
> 
> 
> In Java, yes.  But in JNI, in C, I'd expect it is possible to literally
> throw an empty or null pointer.
> 
> I'd also expect that any code that did that was sub-par, and not worth
> using or debugging.
> 
> I'm mildly interested in what the OP is using, mostly so I can avoid it.
>  However if he can supply some details (*what* are you using, Bob?) I'd
> consider taking a loot at it.  The actually question he asks: "Is it
> common practice," I don't really know or care.  It seems bad practice,
> but I've never dealt with JNI code, so what do I know?
> 

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?

-- 
DF.

Back to comp.lang.java.programmer | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

throw null investigation bob smith <bob@coolfone.comze.com> - 2012-07-18 10:10 -0700
  Re: throw null investigation Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2012-07-18 12:39 -0700
    Re: throw null investigation markspace <-@.> - 2012-07-18 13:35 -0700
      Re: throw null investigation Daniele Futtorovic <da.futt.news@laposte-dot-net.invalid> - 2012-07-18 23:33 +0200
        Re: throw null investigation markspace <-@.> - 2012-07-18 14:43 -0700
          Re: throw null investigation Daniele Futtorovic <da.futt.news@laposte-dot-net.invalid> - 2012-07-19 00:06 +0200
            Re: throw null investigation markspace <-@.> - 2012-07-18 15:55 -0700
              Re: throw null investigation Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2012-07-18 16:00 -0700
                Re: throw null investigation Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2012-07-18 16:16 -0700
  Re: throw null investigation Roedy Green <see_website@mindprod.com.invalid> - 2012-07-18 17:09 -0700

csiph-web