db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alan Burlison <Alan.Burli...@sun.com>
Subject Re: Returning NULL from a database-side Java function
Date Tue, 09 Oct 2007 15:03:29 GMT
Rick Hillegas wrote:

> It is hard to say where the NullPointerException originates. Could you 
> post a reproducible test case and the full stack trace from derby.log? 

Umm, it may be my bad, I have the following:

     public static int iGoBang() {
         int pop = 0 == 0 ? 1 : null;
         return pop;
     }

Which compiles but blows up, whereas

     public static int iGoBang() {
         return null;
     }

won't even compile.  Because you can't assign null to a primitive type - 
duh.  Which leaves 2 questions:

1. Why does int pop = 0 == 0 ? 1 : null; even compile?
2. How *do* you return a database NULL from a function with a primitive 
type as the return type? String isn't a primitive type.

-- 
Alan Burlison
--

Mime
View raw message