• Post Reply Bookmark Topic Watch Topic
  • New Topic

Why this exceptions does not show up altogether?  RSS feed

 
john von
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For some reason, this whole line does not show up altogether.
Either ill leave the first or the second statement.
Im just playing around with the try/catch exceptions. Any fact?


[ August 30, 2004: Message edited by: john von ]
 
Ernest Friedman-Hill
author and iconoclast
Sheriff
Posts: 24217
38
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Throwable.getCause() can return null. If it does, then your e.getCause().toString() will throw a NullPOinterException; thus before your error message is assembled for printing, another exception will be thrown, and this println() will never be invoked.
 
Joel McNary
Bartender
Posts: 1840
Eclipse IDE Java Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Its also possible that this code does not catch RuntimeExceptions such as NullPointer or IllegalArgument or somesuch. In addition to what Ernest said, try catching Throwable instead of exception.

Also, its possible that no exception is thrown. If none is thrown, then none is caught, and thus the line is not printed.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!