Docs: Try-with-resources 관련 주석 추가

main
platformtech 3 years ago
parent 2036ee50f6
commit acb48fa6a4

@ -172,6 +172,9 @@ public class EgovFileDownloadController {
* response.getOutputStream().flush();
* response.getOutputStream().close();
*/
// Try-with-resources를 이용한 자원 해제 처리 (try 구문에 선언한 리소스를 자동 반납)
// try에 전달할 수 있는 자원은 java.lang.AutoCloseable 인터페이스의 구현 객체로 한정
try (BufferedInputStream in = new BufferedInputStream(new FileInputStream(uFile));
BufferedOutputStream out = new BufferedOutputStream(response.getOutputStream());){
FileCopyUtils.copy(in, out);

@ -66,7 +66,6 @@ public class EgovImageProcessController extends HttpServlet {
* @param response
* @throws Exception
*/
@SuppressWarnings("resource")
@RequestMapping("/cmm/fms/getImage.do")
public void getImageInf(SessionVO sessionVO, ModelMap model, @RequestParam Map<String, Object> commandMap,
HttpServletResponse response) throws Exception {
@ -90,6 +89,9 @@ public class EgovImageProcessController extends HttpServlet {
String streFileNm = EgovWebUtil.filePathBlackList(fvo.getStreFileNm());
File file = new File(fileStreCours, streFileNm);
// Try-with-resources를 이용한 자원 해제 처리 (try 구문에 선언한 리소스를 자동 반납)
// try에 전달할 수 있는 자원은 java.lang.AutoCloseable 인터페이스의 구현 객체로 한정
try (FileInputStream fis = new FileInputStream(file);
BufferedInputStream in = new BufferedInputStream(fis);
ByteArrayOutputStream bStream = new ByteArrayOutputStream();) {

Loading…
Cancel
Save