Bug 4354

Summary: JSR352-defined exceptions use non-standard constructors, setCause()..why RuntimeException
Product: jbatch Reporter: ScottKurz
Component: sourceAssignee: cvignola
Status: CLOSED FIXED    
Severity: minor CC: issues
Priority: P5    
Version: 1   
Target Milestone: ---   
Hardware: PC   
OS: Windows   
Whiteboard:

Description ScottKurz 2012-11-20 16:55:20 UTC
First, it seems odd to have a constructor:

  public BatchOperationsRuntimeException(Throwable th, String localizedMessage) 

defined to use setCause().

Why not just use the four standard constructors for each of BatchOperationsRuntimeException and the subclasses we define (NoSuchJobException, etc.)

RuntimeException()
RuntimeException(String message)
RuntimeException(String message, Throwable cause)
RuntimeException(Throwable cause) 

Just use the four forms of super() ctor delegation for each.

------------------------------------------------------------------------------

Also, seems like these would be reasonable candidates for being checked exceptions, i.e. not RuntimeException(s).     

Were you trying to reduce the amount of boilerplate code with catch-blocks etc.?  But doesn't that just leave you open to NullPointerException, etc.?
Comment 1 cvignola 2012-12-06 22:36:31 UTC
Yes, the should be checked exceptions.  There is no reason to use anything but the standard constructors.  The next rev of the spec will include those adjustments.
Comment 2 cvignola 2013-01-14 14:41:29 UTC
Actually, the spec will just list the exception classes by name without showing the implementation details.