You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

Empty_Catch_Block.java 816 B

3 years ago
12345678910111213141516171819202122232425262728293031
  1. package Empty_Catch_Block;
  2. import java.io.IOException;
  3. import java.util.logging.Logger;
  4. import javax.servlet.http.HttpServletRequest;
  5. import javax.servlet.http.HttpServletResponse;
  6. public class Empty_Catch_Block {
  7. static final Logger log = Logger.getLogger("logger");
  8. public void bad(HttpServletRequest request, HttpServletResponse response){
  9. try {
  10. response.getWriter().write("You cannot shut down this application, only the admin can");
  11. } catch (IOException e) { // bad 空的catch代码块
  12. log.info("bad");
  13. }
  14. }
  15. public void good(HttpServletRequest request, HttpServletResponse response){
  16. try {
  17. response.getWriter().write("You cannot shut down this application, only the admin can");
  18. } catch (IOException e) { // good 空的catch代码块
  19. log.info("bad");
  20. }
  21. }
  22. }

No Description

Contributors (1)