I use SonarQube for quality code. I have one problem with exception handling, which says that the throw clause needs to be removed from the finally block.
} catch(Exception e) { throw new MyException("request failed : ", e); } finally { try { httpClient.close(); } catch (IOException e) { throw new MyException("failed to close server conn: ", e); } }
Based on my understanding above, the code looks good. If I delete the throw clause and throw an exception, then the caller of this method will not be able to find out the status of the server. I'm not sure how we can achieve the same functionality without having a throw clause.
java
Manojp
source share