Unless I catch and re-catch the various Exceptions inside the Lambda Expression the code below does not compile. Can anyone help me understand why?
protected void doGet(HttpServletRequest req, HttpServletResponse res)
throws ServletException, IOException
{
Consumer <String> forwardTo =(s) ->
{
RequestDispatcher rd= req.getRequestDispatcher(s);
try {
rd.forward(req, res);
} catch (IOException|ServletException is) {
try {
throw new Exception(is);
} catch (Exception e) {
}
}
};