Re: Test or NullPointerException catch



GuyBrush Treepwood wrote:

I'm developing a webapplication in Java. If I fetch a lot
of objects from the session or request, and they all could be null, should I test them all separate with if
statements, or should I just try what I want to do with
them en catch a NullPointerException ?



What are the error handling/reporting requirements for these operations?

For example, if you need to generate an error message that
depends on which variable was null, it may be easier to do a
separate null test and report for each variable.

On the other hand, if you plan to abandon the whole
transaction for any null, and only intend to say what
transaction failed, your code could be simpler with a single
try-catch than with separate tests.

In general, pick your intended user interface for the error
reporting, and design your code to implement it.

Patricia

.



Relevant Pages

  • Re: Lookup Table
    ... books table to fetch four separate book descriptions. ... it, the borrower table has four fields in it, each of which maps to ... ebooks table referenced four times from the report. ... I'm using CR9 with 2 database tables in Excel XP. ...
    (microsoft.public.vb.crystal)
  • Re: Lookup Table
    ... books table to fetch four separate book descriptions. ... it, the borrower table has four fields in it, each of which maps to ... ebooks table referenced four times from the report. ... So data duplication of a lookup table is not such a good ...
    (microsoft.public.vb.crystal)
  • Re: OOP/OOD Philosophy
    ... it would be a common and resonable example of a report program. ... it should be separated into a separate function. ... foreach item in FilteredList ... doing it is to have an abstraction that holds the filtered list. ...
    (comp.object)
  • Re: Access Form with multiple pages
    ... I want the subreports to each open on separate ... "Gina Whipp" wrote: ... records not three form from three different tab pages. ... You can base your report off of the below ...
    (microsoft.public.access.forms)
  • Order of Calculation
    ... I am doing a worksheet that draws data from Access. ... data based on a any of 8 dates being within the report month. ... then on a separate sheet I am writing a function ... alphabetical listing of the clients. ...
    (microsoft.public.excel.programming)