Re: NullPointerException
Re: NullPointerException
- Subject: Re: NullPointerException
- From: Farrukh Ijaz <email@hidden>
- Date: Thu, 12 Apr 2012 21:25:53 +0300
Hi Ken,
Also we should not call toString() method on e.getCause() because it's not always necessary you get a cause if the exception is already at it's origin. Here is a sample code to test this:
Farrukh
public class ExceptionTest {
public static void printCause(Throwable t) { System.err.println(t.toString()); printCause(t.getCause()); }
public static void main(String[] args) { try { throw new Exception("Testing"); } catch(Exception e) { printCause(e); } } }
Farrukhs-MacBook-Pro:TopCoder fijaz$ java ExceptionTest java.lang.Exception: Testing Exception in thread "main" java.lang.NullPointerException at ExceptionTest.printCause(ExceptionTest.java:4) at ExceptionTest.printCause(ExceptionTest.java:5) at ExceptionTest.main(ExceptionTest.java:12)
On 2012-04-12, at 9:08 PM, Ken Anderson wrote: 94 try{
95 System.out.println(editingContext.toString());
96 me.editingContext().saveChanges();
97 } catch (Exception e){
98 System.out.println(me._primaryKey);
99 System.out.println(editingContext.objectForGlobalID(me.__globalID()).valueForKey(ADDRESS1_KEY));
100 System.out.println(e.getCause().toString());
|
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden