Re: [ojb-users] no help with exception messsages
Brought to you by:
thma
From: <Ste...@eu...> - 2002-06-04 06:53:47
|
Though the exception chaining is implemented in the PersistenceBrokerException class (it contains a source exception), we h= ave no debug information from the source exception (PersistenceBrokerExcept= ion doesn't override printStackTrace methods from java.lang.Throwable is no= t overridden). It can be done for example this way: public class PersistenceBrokerException extends RuntimeException { . . . public void printStackTrace() { super.printStackTrace(); Throwable cause =3D getSourceException(); if(cause !=3D null) { System.err.println("Caused by:"); cause.printStackTrace(); } } public void printStackTrace(java.io.PrintStream ps) { super.printStackTrace(ps); Throwable cause =3D getSourceException(); if (cause !=3D null) { ps.println("Caused by:"); cause.printStackTrace(ps); } } public void printStackTrace(java.io.PrintWriter pw) { super.printStackTrace(pw); Throwable cause =3D getSourceException(); if (cause !=3D null) { pw.println("Caused by:"); cause.printStackTrace(pw); } } } Stefan |--------+----------------------------------------------> | | Thomas Mahler | | | <tho...@ho...> | | | Odeslal: | | | obj...@li...urc| | | eforge.net | | | 04.06.2002 07:57 | | | | |--------+----------------------------------------------> >--------------------------------------------------------------------= ----------------------------| | = | | Komu: Arvind Gudipati <Arv...@PA...>, ojb = | | <obj...@li...> = | | Kopie: = | | P=F8edm=ECt: Re: [ojb-users] no help with exception messs= ages | | = | | = | >--------------------------------------------------------------------= ----------------------------| Hi Arvind, Arvind Gudipati wrote: > I was getting a ojb.broker.PersistenceBrokerSQLException on severa= l > occasion .. i had to debug the source files of OJB to find the reason= > that i was inserting NULLs to a NOT NULL column or the column name wa= s > not existing etc., > > I thought it would be helpful if when the exception is thrown, there = are > some helpful messages of what REALLY is the problem.. > > > Check out for example JdbcAccess.java line:153 the exception is simpl= e > consumed ... > Mhh, I don't know which method of JdbcAccess you are referring to, as I= have only new code than release 0.8.400 at hand. There should not be any place where exceptions are just consumend without deeper reason. typically exceptions are sometimes caught, converted to a PBException and then rethrown. In rare cases exceptions are just consumed. In those cases there should= be a comment why this is done. And typically those things are logged. hth, Thomas > Arvind > > > > > > > > > > > > > > > > > > > > > > > > > > > > > ***********************************************************************= ****************** > This E-mail is from PANACYA Inc. The E-mail and any files transmitted= > with it are confidential and may also be privileged and intended sole= ly > for the use of the individual or entity to whom they are addressed. A= ny > unauthorized direct or indirect dissemination, distribution or copyin= g > of this message and any attachments is strictly prohibited. If you ha= ve > received the E-mail in error please notify adm...@pa... = or > telephone (410) 910-3300. > ***********************************************************************= ***************** > _______________________________________________________________ Don't miss the 2002 Sprint PCS Application Developer's Conference August 25-28 in Las Vegas -- http://devcon.sprintpcs.com/adp/index.cfm _______________________________________________ Objectbridge-users mailing list Obj...@li... https://lists.sourceforge.net/lists/listinfo/objectbridge-users = |