--- Xavier RAYNAUD <[EMAIL PROTECTED]> wrote:
> Joe Wilson a écrit :
> > --- XR <[EMAIL PROTECTED]> wrote:
> >   
> >> The "java.sql.ResultSet.getLong(int columnIndex)" specification said:
> >> [...] if the value is SQL <code>NULL</code>, the value returned is
> >> <code>0</code> [...]
> >>
> >> However, the "org.sqlite.RS.getLong(int columnIndex)" method thows a
> >> NullPointerException when the value is NULL.
> >> I tried with some other accessors: it seems all accessors but
> >> "getInt(int columnIndex)" and "getString(int columnIndex)" have the
> >> same behaviour.
> >>
> >> Is this behaviour normal ?
> >>     
> >
> > Probably not, but fixing this should be pretty straightforward. 
> > Take a look at RS.java in the source code and submit a patch.
> >   
> 
> This bug occurs only with nested DB. Here is the stack trace (for Double 
> values, but is the same thing for Long values).
> 
> java.lang.NullPointerException
>    at 
> sun.misc.FloatingDecimal.readJavaFormatString(FloatingDecimal.java:991)
>    at java.lang.Double.parseDouble(Double.java:482)
>    at org.sqlite.NestedDB.column_double(NestedDB.java:124)
>    at org.sqlite.RS.getDouble(RS.java:203)
>    at org.sqlite.RS.getDouble(RS.java:205)
>    at com.st.sqlite.Main.main(Main.java:37)
> 
> So the bug seems located in org.sqlite.NestedDB class. Did you know how 
> I can patch it ?
> Another solution can be to add try/catch blocks in org.sqlite.RS class, 
> but I'm not convinced...

I'd recommend to look at the code for wasNull() and fold that logic into
RS.getDouble() and related functions. It's more efficient and accurate than
just catching the exception and returning 0.



 
____________________________________________________________________________________
8:00? 8:25? 8:40? Find a flick in no time 
with the Yahoo! Search movie showtime shortcut.
http://tools.search.yahoo.com/shortcuts/#news

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"SQLiteJDBC" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlitejdbc?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to