It is possible in Java to throw any Exception even if it is just declared on moment of throwing, example below:
import org.springframework.dao.DataAccessException;
// DataAccessException - is abstract class
} catch (DataAccessException dae) {
throw new DataAccessException("Exception while executing SQL: \n" + sql
+ "\nparams: " + paramsToString(params), dae) {
private static final long serialVersionUID = 1L;
};
}
Please share your ideas how bad or good this approach.
the same question to extending RuntimeException (that is not abstract) and throw it right away.