db-torque-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Derek Robert Price <de...@ximbiot.com>
Subject Better Exception from null DataSource pointer in JndiDataSourceFactory
Date Wed, 17 Sep 2003 20:44:48 GMT
Hash: SHA1

My apologies if this has already been reported.

The org.apache.torque.dsfactory.JndiDataSourceFactory.initDataSource
(Configuration) function can try to set a property on a null pointer.  I
thought the following extra lines would make it easier for a user who
simply screwed up their property settings to spot an error similar to
the one I made (setting a datasource property before
datasource.classname).  These lines should be inserted at line 213 in
the Torque 3.1 distribution (adds an else if between the if ... else
combination in initDataSource):

else if (ds == null)
~    throw new TorqueException (
~       "Attempt to set datasource property, `datasource."
~       + key
~       + "', before setting `datasource.classname'."
~    );

This new error should hopefully be easier for Torque users to interpret
than the nasty NullPointerException stack trace I got, without actually
resorting to reading the Torque source as I found necessary.

Incidentally, I would like to note, in case any of the readers on this
list work on commons-configuration or have some pull there, that it
would be very handy if a Configuration subset could report on its
removed prefix and if a Configuration could provide a "location" string
- - in this case a FILE:LINE format would have been handy.  These could
aid considerability in the writing and interpreting of error messages
based on configuration errors.


- --
~                *8^)

Email: derek@ximbiot.com

Get CVS support at <http://ximbiot.com>!
- --
I know of no safe depository of the ultimate powers of the society but
the people themselves, and if we think them not enlightened enough to
exercise that control with a wholesome discretion, the remedy is not to
take it from them, but to inform their discretion.

            - Thomas Jefferson, 1820.
Version: GnuPG v1.0.7 (GNU/Linux)
Comment: Using GnuPG with Netscape - http://enigmail.mozdev.org


To unsubscribe, e-mail: torque-dev-unsubscribe@db.apache.org
For additional commands, e-mail: torque-dev-help@db.apache.org

View raw message