This turns catch Throwable into catch Exception, as doing the former
catches Errors, which are documented to be pretty much irrecoverable
conditions. Looking at
http://docs.oracle.com/javase/7/docs/api/java/lang/Error.html non of
these call sites can recover from an Error happening, so they should
never catch them.
Change-Id: I85237594f307a5a8778fb5a63f9dad4d120fc9d7
Signed-off-by: Robert Varga <rovarga@cisco.com>
netconf_ssh_output.setDaemon(false);
netconf_ssh_output.start();
netconf_ssh_output.setDaemon(false);
netconf_ssh_output.start();
- } catch (Throwable t){
- logger.error("SSH bridge couldn't create echo socket",t.getMessage(),t);
+ } catch (Exception t) {
+ logger.error("SSH bridge could not create echo socket: {}", t.getMessage(), t);
try {
if (netconf_ssh_input!=null){
try {
if (netconf_ssh_input!=null){
Thread.currentThread().interrupt();
logger.error("netconf_ssh_output join error ",e);
}
Thread.currentThread().interrupt();
logger.error("netconf_ssh_output join error ",e);
}
if (status.getCode().equals(StatusCode.SUCCESS)) {
return Response.status(Response.Status.CREATED).build();
}
if (status.getCode().equals(StatusCode.SUCCESS)) {
return Response.status(Response.Status.CREATED).build();
}
+ } catch (Error e) {
+ throw e;
} catch (Throwable t) {
return Response.status(Response.Status.PRECONDITION_FAILED).build();
}
} catch (Throwable t) {
return Response.status(Response.Status.PRECONDITION_FAILED).build();
}
if (status.getCode().equals(StatusCode.SUCCESS)) {
return Response.status(Response.Status.OK).build();
}
if (status.getCode().equals(StatusCode.SUCCESS)) {
return Response.status(Response.Status.OK).build();
}
- } catch (Throwable t) {
+ } catch (Exception t) {
return Response.status(Response.Status.PRECONDITION_FAILED).build();
}
throw new ResourceNotFoundException(status.getDescription());
return Response.status(Response.Status.PRECONDITION_FAILED).build();
}
throw new ResourceNotFoundException(status.getDescription());
if (status.getCode().equals(StatusCode.SUCCESS)) {
return Response.status(Response.Status.CREATED).build();
}
if (status.getCode().equals(StatusCode.SUCCESS)) {
return Response.status(Response.Status.CREATED).build();
}
- } catch (Throwable t) {
+ } catch (Exception t) {
return Response.status(Response.Status.PRECONDITION_FAILED).build();
}
throw new ResourceNotFoundException(status.getDescription());
return Response.status(Response.Status.PRECONDITION_FAILED).build();
}
throw new ResourceNotFoundException(status.getDescription());
if (status.getCode().equals(StatusCode.SUCCESS)) {
return Response.status(Response.Status.OK).build();
}
if (status.getCode().equals(StatusCode.SUCCESS)) {
return Response.status(Response.Status.OK).build();
}
- } catch (Throwable t) {
+ } catch (Exception t) {
return Response.status(Response.Status.PRECONDITION_FAILED).build();
}
throw new ResourceNotFoundException(status.getDescription());
return Response.status(Response.Status.PRECONDITION_FAILED).build();
}
throw new ResourceNotFoundException(status.getDescription());