cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Donald Ball <ba...@webslingerZ.com>
Subject Re: sqlprocessor question
Date Wed, 01 Dec 1999 03:40:59 GMT
On Wed, 1 Dec 1999, Sidney Chong wrote:

> ok, I'm found the problem: I was getting a null pointer exception.
> 
> After a good deal of printlns (BTW, anyone knows a better way to debug
> cocoon code?), I came down to this:
> 
> Class: ConnectionDefs
> Method: public Properties getQueryProperties(String name)
> BUG: this mtd returns null if name is not found in the query_props_table
> hence causing the nullpointer exception to be raised in
> SQLProcessor.process() (line 116)
> 
> FIX: I've changed the mtd to the following:
> 
> public Properties getQueryProperties(String name) {
>   if (name == null) return default_query_props;
>   Properties query_prop = query_props_table.get(name);
>   if (query_prop == null) return default_query_props;
>   return query_prop;
> }
> 
> Donald, how does that sound?

Like a good patch. I also patched another bug in properties handling - I'm
now returning clones of the properties objects so that specific
connections don't overwrite named default properties bundles. I'll check
it into CVS as soon as I figure out how. :)

As far as the debugging goes - according to the cocoon model, a
RuntimeException tossed out from a process indicates that all processing
is complete. Since NullPointerExceptions are instances of
RuntimeExceptions, cocoon isn't using its nice frontend error page for
them. I'd say either:

1. Processors should always catch RuntimeExceptions and convert them into
ProcessorExceptions. If this is so then it would be nice if
ProcessorExceptions contained the original exceptions so that the frontend
could print out the complete stack trace.

2. Cocoon should use a special exception, ProcessingDoneException or
something like that as a signal that processing is complete rather than
treating any RuntimeException as such, so that they'll get bumped up to
the Cocoon class and get wrapped in the frontend.

Or am I missing something even simpler? Clearly this needs to be
addressed, since you're like the 5th person to actually report trouble
debugging SQLProcessor connection creation.

- donald


Mime
View raw message