• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Paul Clapham
  • Bear Bibeault
  • Jeanne Boyarsky
Sheriffs:
  • Ron McLeod
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Jj Roberts
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • salvin francis
  • Scott Selikoff
  • fred rosenberger

Unable to understand rethrows exception

 
Greenhorn
Posts: 7
MySQL Database Tomcat Server Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
any please explain me what is rethrows exception ,with a programme...
 
Bartender
Posts: 2235
63
IntelliJ IDE Firefox Browser Spring Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It is throwing an exception from a catch block.
 
Saloon Keeper
Posts: 22649
153
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
http://en.wikipedia.org/wiki/Hot_potato_%28game%29

Except that you can only throw upwards on the call stack.
 
Ranch Hand
Posts: 63
Spring Tomcat Server Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Rethrows is in terms of throwing exception again from catch block.
We generally use it when we are not sure how it should be handled that's why we throw it agian and facilitate client to handle it.
 
Tim Holloway
Saloon Keeper
Posts: 22649
153
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Actually, a common use is to decorate the exception (add additional meta-data unavailable at the lower level where the exception occurred). This is often done by creating and throwing a new Exception whose parent is the original Exception.

Some systems such as Hibernate JPA catch JDBC-specific exceptions and normalize them to the standard JPA exceptions.
 
Marshal
Posts: 70636
288
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please read this.
 
Ranch Hand
Posts: 87
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

something like this

 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic