|
|
Sponsor |
Re: NPE in creating a SQLException: msg#00432db.postgresql.jdbc
Yep, that's it ! The toString method returning null... Cheers, Csaba. On Tue, 2003-07-29 at 18:16, Peter Royal wrote: > On Tuesday, July 29, 2003, at 11:50 AM, Scot P. Floess wrote: > > Does your class have a toString() method? You mention that this is > > occurring in a constructor. Certainly if your toString() has object > > members being printed in such a way as method calls are performed on > > those object prior to their being set to instances there could be > > issue (ie NullPointerException). However, assuming this to be true, > > one would hope the stack trace would indicate the toString() method. > > That's the rub, its not in my class :) > > >> java.lang.NullPointerException > >> at java.io.PrintWriter.write(PrintWriter.java:247) > >> at java.io.PrintWriter.print(PrintWriter.java:392) > >> at java.io.PrintWriter.println(PrintWriter.java:529) > >> at java.lang.Throwable.printStackTrace(Throwable.java:509) > >> at java.sql.SQLException.<init>(SQLException.java:103) > >> at > >> org.postgresql.util.PSQLException.<init>(PSQLException.java:19) > >> at > >> org.postgresql.jdbc1.AbstractJdbc1Connection.ExecSQL(AbstractJdbc1Conn > >> e > >> c > >> tion.java:480) > > But I think I tracked it down... > > The PSQLException constructor that is being used is > > public PSQLException(String error) > { > super(); > translate(error, null); > } > > which does not set the 'message' variable.. Then the toString() of > PSQLException is: > > public String toString() > { > return message; > } > > so that is returning null.. and the cause of the NPE. I see the bug is > fixed in CVS :) > > thanks for the help! > -pete > > > ---------------------------(end of broadcast)--------------------------- > TIP 5: Have you checked our extensive FAQ? > > http://www.postgresql.org/docs/faqs/FAQ.html > ---------------------------(end of broadcast)--------------------------- TIP 3: if posting/reading through Usenet, please send an appropriate subscribe-nomail command to majordomo@xxxxxxxxxxxxxx so that your message can get through to the mailing list cleanly
|
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Re: NPE in creating a SQLException, Michael Stephenson |
|---|---|
| Next by Date: | Re: NPE in creating a SQLException, Csaba Nagy |
| Previous by Thread: | Re: NPE in creating a SQLException, Peter Royal |
| Next by Thread: | Re: NPE in creating a SQLException, Michael Stephenson |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
Free MagazinesCisco NewsReceive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business. subscribe Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field. subscribe The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business. subscribe Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company. subscribe Total Telecom Total Telecom is "The Economist of the communications industry". subscribe |
Home | sitemap
| advertise | OSDir is
an inevitable website.
|