shjung před 2 roky
rodič
revize
87039d8732

+ 2 - 1
src/main/java/com/its/op/dto/its/facility/TbFcltImagDto.java

@@ -55,7 +55,8 @@ public class TbFcltImagDto implements Serializable {
         @Builder
         public TbFcltImagUpdReq(Long fclt_nmbr, byte[] fclt_imag, String imag_ext) {
             this.fcltNmbr = fclt_nmbr;
-            this.fcltImag = fclt_imag;
+            byte[] tmpFcltImag = fclt_imag;
+            this.fcltImag = tmpFcltImag;
             this.imagExt = imag_ext;
         }
 

+ 2 - 1
src/main/java/com/its/op/dto/its/link/TbLinkParaStupDto.java

@@ -155,7 +155,8 @@ public class TbLinkParaStupDto implements Serializable {
         public TbLinkParaStupModReq(TbLinkParaStupDto.TbLinkParaStupUpdReq para, TbLinkParaDetlDto.TbLinkParaDetlUpdReq detl, List<TbLinkParaClctSystDto.TbLinkParaClctSystUpdReq> clcts) {
             this.para = para;
             this.detl = detl;
-            this.clcts = clcts;
+            List<TbLinkParaClctSystDto.TbLinkParaClctSystUpdReq> tmpClcts = clcts;
+            this.clcts = tmpClcts;
         }
 
     }

+ 2 - 1
src/main/java/com/its/op/dto/its/vms/TbVmsSymbLibDto.java

@@ -157,10 +157,11 @@ public class TbVmsSymbLibDto implements Serializable {
 
         @Builder
         public TbVmsSymbLibUpdReq(Integer symb_lib_nmbr, String rgst_dt, byte[] red_data, byte[] green_data, String symb_expl, byte[] imag_data, String symb_file_nm, String symb_type, byte[] avi_data, Long imag_size, Long play_tm, String del_yn, String updt_dt) {
+            byte[] tmpImagData = imag_data;
             this.symbLibNmbr = symb_lib_nmbr;
             this.rgstDt = rgst_dt;
             this.symbExpl = symb_expl;
-            this.imagData = imag_data;
+            this.imagData = tmpImagData;
             this.symbFileNm = symb_file_nm;
             this.symbType = symb_type;
             this.imagSize = imag_size;

+ 2 - 2
src/main/java/com/its/op/scheduler/ItsApiAfterTaskCompleted.java

@@ -36,10 +36,10 @@ public class ItsApiAfterTaskCompleted {
             ItsWebSocketSessionManager.getInstance().sendBroadcastUserMessage(itsMessage.getCommand(), new TextMessage(itsSttsJsonData));
         }
         catch(JsonProcessingException e){
-            log.error("ItsApiAfterTaskCompleted: executeFcltUserMsgNotify Json parsing Exception: {}", e.getMessage());
+            log.error("ItsApiAfterTaskCompleted: executeFcltUserMsgNotify Json parsing Exception");
         }
         catch (Exception ea) {
-            log.error("ItsApiAfterTaskCompleted: Exception: {}", ea.getMessage());
+            log.error("ItsApiAfterTaskCompleted: Exception");
         }
     }
 }

+ 2 - 2
src/main/java/com/its/op/scheduler/ItsOpSigPhaseListener.java

@@ -84,10 +84,10 @@ public class ItsOpSigPhaseListener {
             ItsWebSocketSessionManager.getInstance().sendBroadcastSigPhaseMessage(itsMessage.getCommand(), new TextMessage(itsSttsJsonData));
         }
         catch(JsonProcessingException e){
-            log.error("ItsOpSigPhaseListener: TbScSgnlCtlrPhaseDto Json parsing Exception: {}", e.getMessage());
+            log.error("ItsOpSigPhaseListener: TbScSgnlCtlrPhaseDto Json parsing Exception");
         }
         catch (Exception ea) {
-            log.error("ItsOpSigPhaseListener: Exception: {}", ea.getMessage());
+            log.error("ItsOpSigPhaseListener: Exception");
         }
 
         stopWatch.stop();

+ 2 - 2
src/main/java/com/its/op/scheduler/ItsOpSigPhaseListener_backup.java

@@ -48,7 +48,7 @@ public class ItsOpSigPhaseListener_backup implements DisposableBean, Runnable {
                 try {
                     Thread.sleep(delayMillis);
                 } catch (InterruptedException e) {
-                    log.error("{}", e.getMessage());
+                    log.error("RUN-InterruptedException");
                 }
             }
         } catch(Throwable t) {
@@ -95,7 +95,7 @@ public class ItsOpSigPhaseListener_backup implements DisposableBean, Runnable {
             this.thread.join();
             this.thread = null;
         } catch (InterruptedException e) {
-            log.error("{}", e.getMessage());
+            log.error("InterruptedException");
         }
     }
 

+ 2 - 2
src/main/java/com/its/op/scheduler/job/SigPhaseJobThread.java

@@ -44,10 +44,10 @@ public class SigPhaseJobThread {
             ItsWebSocketSessionManager.getInstance().sendBroadcastSigPhaseMessage(itsMessage.getCommand(), new TextMessage(itsSttsJsonData));
         }
         catch(JsonProcessingException e){
-            log.error("SigPhaseJobThread TbScSgnlCtlrPhaseDto Json parsing Exception: {}", e.getMessage());
+            log.error("SigPhaseJobThread TbScSgnlCtlrPhaseDto Json parsing JsonProcessingException");
         }
         catch (Exception ea) {
-            log.error("SigPhaseJobThread TbScSgnlCtlrPhaseDto Exception: {}", ea.getMessage());
+            log.error("SigPhaseJobThread TbScSgnlCtlrPhaseDto Exception");
         }
 
         stopWatch.stop();

+ 32 - 23
src/main/java/com/its/op/service/its/cctv/CctvControlService.java

@@ -121,7 +121,6 @@ public class CctvControlService {
                     while ((line = br.readLine()) != null) {
                         sb.append(line).append("\n");
                     }
-                    //br.close();
                     log.info("HTTP_OK: CCTV, {}, {}", ipAddr, sb);
                     result.setResult(0, sb.toString());
                 }
@@ -201,7 +200,6 @@ public class CctvControlService {
                     while ((line = br.readLine()) != null) {
                         sb.append(line).append("\n");
                     }
-                    //br.close();
                     log.info("HTTP_OK: CCTV, {}, {}", ipAddr, sb);
                     result.setResult(0, sb.toString());
                 }
@@ -320,7 +318,6 @@ public class CctvControlService {
                     while ((line = br.readLine()) != null) {
                         sb.append(line).append("\n");
                     }
-                    //br.close();
                     log.info("HTTP_OK: CCTV, {}, {}", ipAddr, sb);
                     result.setResult(0, sb.toString());
                 }
@@ -416,12 +413,13 @@ public class CctvControlService {
             StringBuilder sb = new StringBuilder();
             if (conn.getResponseCode() == HttpURLConnection.HTTP_OK) {
                 //Stream 을 처리해줘야 하는 귀찮음이 있음.
-                BufferedReader br = new BufferedReader(new InputStreamReader(conn.getInputStream(), "utf-8"));
-                String line;
-                while ((line = br.readLine()) != null) {
-                    sb.append(line).append("\n");
+                try (BufferedReader br = new BufferedReader(new InputStreamReader(conn.getInputStream(), "utf-8"));
+                ) {
+                    String line;
+                    while ((line = br.readLine()) != null) {
+                        sb.append(line).append("\n");
+                    }
                 }
-                br.close();
                 result = sb.toString();
                 //responseJson = new JSONObject(sb.toString());
             }
@@ -506,6 +504,8 @@ public class CctvControlService {
 
         log.info("post: {}, {}", apiUrl, params);
         HttpURLConnection conn = null;
+        OutputStreamWriter out = null;
+        BufferedWriter bw = null;
         String result = null;
         try {
             URL url = new URL(apiUrl);
@@ -519,33 +519,32 @@ public class CctvControlService {
             //conn.setRequestProperty("Connection", "keep-alive");
             conn.setDoOutput(true);
 
-
-            BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(conn.getOutputStream()));
-            // JSON 형식의 데이터 셋팅
+            out = new OutputStreamWriter(conn.getOutputStream());
+            bw = new BufferedWriter(out);
+                // JSON 형식의 데이터 셋팅
 //            JSONObject commands = new JSONObject();
 //            JSONArray jsonArray = new JSONArray();
-
-            // JSON 형식의 데이터 셋팅 끝
-
-            // 데이터를 STRING 으로 변경
+                // JSON 형식의 데이터 셋팅 끝
+                // 데이터를 STRING 으로 변경
 //            Gson gson = new GsonBuilder().setPrettyPrinting().create();
 //            String jsonOutput = gson.toJson(params);
 
-            //bw.write(params.toString());
+                //bw.write(params.toString());
             bw.write(params);
             bw.flush();
-            bw.close();
 
             // 보내고 결과값 받기
             int responseCode = conn.getResponseCode();
             if (responseCode == HttpURLConnection.HTTP_OK) {
-                BufferedReader br = new BufferedReader(new InputStreamReader(conn.getInputStream()));
-                StringBuilder sb = new StringBuilder();
-                String line = "";
-                while ((line = br.readLine()) != null) {
-                    sb.append(line);
+                try (BufferedReader br = new BufferedReader(new InputStreamReader(conn.getInputStream()));
+                ) {
+                    StringBuilder sb = new StringBuilder();
+                    String line = "";
+                    while ((line = br.readLine()) != null) {
+                        sb.append(line);
+                    }
+                    result = sb.toString();
                 }
-                result = sb.toString();
             }
             else {
                 log.error("post: {}: {}", apiUrl, conn.getResponseMessage());
@@ -557,6 +556,16 @@ public class CctvControlService {
             if (conn != null) {
                 conn.disconnect();
             }
+            try {
+                if (out != null) {
+                    out.close();
+                }
+                if (bw != null) {
+                    bw.close();
+                }
+            } catch (IOException e) {
+                throw new RuntimeException(e);
+            }
         }
 
         return result;

+ 1 - 1
src/main/java/com/its/op/service/its/link/TbLinkParaStupService.java

@@ -115,7 +115,7 @@ public class TbLinkParaStupService {
      * @return
      */
     @Transactional
-    public TbLinkParaStupDto deleteDataById(Long paramId) {
+    public TbLinkParaStupDto deleteDataById(Long paramId) throws NoSuchElementException, ConcurrentModificationException {
         if (paramId == 1) {
             throw new NoSuchElementException("첫번째 파라미터 정보는 삭제할 수 없습니다.: " + paramId);
         }

+ 57 - 65
src/main/java/com/its/op/service/its/scrs/ScFileDownloadService.java

@@ -49,8 +49,7 @@ public class ScFileDownloadService {
     private final TbScImgnDtctRawClctRepository dtctRawClctRepo;
     private final TbScAcrdStatHhRepository statHhRepo;
 
-    private final String systemDir = System.getProperty("user.dir");
-    private final String dataFilePath = "/signal_data/";
+    private String fileSystemDir;
     private final String createFilePath = "/signal_data/download/";
     private final String csvFileExtension = ".csv";
     private final int[] BOM_MARKERS = new int[] { 0xEF, 0xBB, 0xBF };
@@ -65,13 +64,16 @@ public class ScFileDownloadService {
     @PostConstruct
     void init() {
         ItsUtils.createUserDir(this.createFilePath);
+        this.fileSystemDir = System.getProperty("user.dir");
+        //this.fileSystemDir = this.fileSystemDir.replaceAll("\\.", "").replaceAll("/", "").replaceAll("\\\\", "");
     }
 
     public List<FileInfoDto> findAllOptimalTrafficFiles() {
         final String optimalFileTrafficPath = "raw-clct/";
         List<FileInfoDto> result = new ArrayList<>();
         int id = 1;
-        String filePath = this.dataFilePath + optimalFileTrafficPath;
+        String dataFilePath = "/signal_data/";
+        String filePath = dataFilePath + optimalFileTrafficPath;
         FileInfoDto rootFile = FileInfoDto.builder()
                 .files(new ArrayList<>())
                 .id(id)
@@ -82,7 +84,7 @@ public class ScFileDownloadService {
                 .fileSize(0L)
                 .build();
 
-        rootFile.setFiles(getFiles(id, this.systemDir, filePath));
+        rootFile.setFiles(getFiles(id, this.fileSystemDir, filePath));
         result.add(rootFile);
         return result;
     }
@@ -137,7 +139,7 @@ public class ScFileDownloadService {
                         .build();
 
                 //parentId = id;
-                fileInfo.setFiles(getFiles(id, this.systemDir, subDir));
+                fileInfo.setFiles(getFiles(id, this.fileSystemDir, subDir));
                 fileInfoList.add(fileInfo);
                 id += fileInfo.getFiles().size();
             }
@@ -167,14 +169,14 @@ public class ScFileDownloadService {
      * @throws NoSuchElementException
      */
     public ResponseEntity<Object> downloadFile(String fileNameUri, HttpServletRequest req)  throws NoSuchElementException{
-        Path fullFilePath = Paths.get(this.systemDir, fileNameUri);
+        Path fullFilePath = Paths.get(this.fileSystemDir, fileNameUri);
         File file = fullFilePath.toFile();
         if (!file.exists()) {
             throw new NoSuchElementException("파일이 존재하지 않습니다: " + fileNameUri);
         }
 
         String fileName = file.getName();
-        Resource resource = null;
+        Resource resource;
         try {
             resource = new InputStreamResource(Files.newInputStream(fullFilePath));
         } catch (IOException e) {
@@ -196,8 +198,8 @@ public class ScFileDownloadService {
      * @param fileNameUri
      * @return
      */
-    public FileInfoDto deleteFile(String fileNameUri) {
-        Path fullFilePath = Paths.get(this.systemDir, fileNameUri);
+    public FileInfoDto deleteFile(String fileNameUri) throws NoSuchElementException {
+        Path fullFilePath = Paths.get(this.fileSystemDir, fileNameUri);
         File file = fullFilePath.toFile();
         if (!file.exists()) {
             throw new NoSuchElementException("파일이 존재하지 않습니다: " + fileNameUri);
@@ -228,7 +230,7 @@ public class ScFileDownloadService {
         init();
         String fileName = "IXR_MNGM_" + ItsUtils.getSysDay() + this.csvFileExtension;
         String createFileName = this.createFilePath + "IXR_MNGM_" + ItsUtils.getSysDay() + "_" + (System.currentTimeMillis() / 1000) + this.csvFileExtension;
-        Path fullFilePath = Paths.get(this.systemDir, createFileName);
+        Path fullFilePath = Paths.get(this.fileSystemDir, createFileName);
 
         String[] csvHeader = {"IXR_ID",
                 "IXR_NM",
@@ -253,18 +255,15 @@ public class ScFileDownloadService {
                 "nodeId",
                 "sgnlIxrNmbr"};
         List<TbScIxrMngm> dataList = this.ixrMngmRepo.findAllOrderById();
-        try {
-            OutputStreamWriter outputWriter = new OutputStreamWriter(Files.newOutputStream(fullFilePath), "MS949");
-            ICsvBeanWriter csvWriter = new CsvBeanWriter(outputWriter, CsvPreference.STANDARD_PREFERENCE);//EXCEL_PREFERENCE);//STANDARD_PREFERENCE);
+        try (OutputStreamWriter outputWriter = new OutputStreamWriter(Files.newOutputStream(fullFilePath), "MS949");
+             ICsvBeanWriter csvWriter = new CsvBeanWriter(outputWriter, CsvPreference.STANDARD_PREFERENCE);//EXCEL_PREFERENCE);//STANDARD_PREFERENCE);
+        ) {
             csvWriter.writeHeader(csvHeader);
             for (TbScIxrMngm data : dataList) {
                 csvWriter.write(data, nameMapping);
             }
             csvWriter.flush();
             outputWriter.flush();
-            csvWriter.close();
-            outputWriter.close();
-
 //            FileWriter writer = new FileWriter("ixrMngm.csv", Charset.forName("MS949"));
 //            StatefulBeanToCsv<TbScIxrMngm> beanToCsv = new StatefulBeanToCsvBuilder<TbScIxrMngm>(writer)
 //                    .withSeparator(CSVWriter.DEFAULT_SEPARATOR)
@@ -297,7 +296,7 @@ public class ScFileDownloadService {
         init();
         String fileName = "CMRA_MNGM_" + ItsUtils.getSysDay() + this.csvFileExtension;
         String createFileName = this.createFilePath + "CMRA_MNGM_" + ItsUtils.getSysDay() + "_" + (System.currentTimeMillis() / 1000) + this.csvFileExtension;
-        Path fullFilePath = Paths.get(this.systemDir, createFileName);
+        Path fullFilePath = Paths.get(this.fileSystemDir, createFileName);
 
         String[] csvHeader = {"IXR_ID",
                 "CMRA_ID",
@@ -352,14 +351,13 @@ public class ScFileDownloadService {
                 "rtcSvrPort",
                 "rtcId"};
         List<TbScIxrCmraMngm> dataList = this.cmraMngmRepo.findAllOrderById();
-        try {
-            OutputStreamWriter outputWriter = new OutputStreamWriter(Files.newOutputStream(fullFilePath), "MS949");
-            ICsvBeanWriter csvWriter = new CsvBeanWriter(outputWriter, CsvPreference.STANDARD_PREFERENCE);//EXCEL_PREFERENCE);//STANDARD_PREFERENCE);
+        try (OutputStreamWriter outputWriter = new OutputStreamWriter(Files.newOutputStream(fullFilePath), "MS949");
+             ICsvBeanWriter csvWriter = new CsvBeanWriter(outputWriter, CsvPreference.STANDARD_PREFERENCE);//EXCEL_PREFERENCE);//STANDARD_PREFERENCE);
+        ) {
             csvWriter.writeHeader(csvHeader);
             for (TbScIxrCmraMngm data : dataList) {
                 csvWriter.write(data, nameMapping);
             }
-            csvWriter.close();
         } catch (IOException e) {
             throw new RuntimeException("파일 저장 중 오류가 발생했습니다.");
         }
@@ -380,7 +378,7 @@ public class ScFileDownloadService {
         init();
         String fileName = "IMGN_DTCT_RAW_CLCT_" + StringUtils.subString(fromDt, 12) + "_" + StringUtils.subString(toDt, 12) + this.csvFileExtension;
         String createFileName = this.createFilePath + "IMGN_DTCT_RAW_CLCT_" + StringUtils.subString(fromDt, 12) + "_" + StringUtils.subString(toDt, 12) + "_" + (System.currentTimeMillis() / 1000) + this.csvFileExtension;
-        Path fullFilePath = Paths.get(this.systemDir, createFileName);
+        Path fullFilePath = Paths.get(this.fileSystemDir, createFileName);
 
         String[] csvHeader = {"CLCT_DT",
                 "IXR_ID",
@@ -431,14 +429,13 @@ public class ScFileDownloadService {
                 "bikeLeftTfvl",
                 "bikeRghtTfvl"};
         List<TbScImgnDtctRawClct> dataList = this.dtctRawClctRepo.findAllByDateRange(fromDt, toDt);
-        try {
-            OutputStreamWriter outputWriter = new OutputStreamWriter(Files.newOutputStream(fullFilePath), "MS949");
-            ICsvBeanWriter csvWriter = new CsvBeanWriter(outputWriter, CsvPreference.STANDARD_PREFERENCE);//EXCEL_PREFERENCE);//STANDARD_PREFERENCE);
+        try (OutputStreamWriter outputWriter = new OutputStreamWriter(Files.newOutputStream(fullFilePath), "MS949");
+             ICsvBeanWriter csvWriter = new CsvBeanWriter(outputWriter, CsvPreference.STANDARD_PREFERENCE);//EXCEL_PREFERENCE);//STANDARD_PREFERENCE);
+        ) {
             csvWriter.writeHeader(csvHeader);
             for (TbScImgnDtctRawClct data : dataList) {
                 csvWriter.write(data, nameMapping);
             }
-            csvWriter.close();
         } catch (IOException e) {
             throw new RuntimeException("파일 저장 중 오류가 발생했습니다.");
         }
@@ -458,7 +455,7 @@ public class ScFileDownloadService {
         init();
         String fileName = "ACRD_HH_STAT_" + StringUtils.subString(fromDt, 12) + "_" + StringUtils.subString(toDt, 12) + this.csvFileExtension;
         String createFileName = this.createFilePath + "ACRD_HH_STAT_" + StringUtils.subString(fromDt, 12) + "_" + StringUtils.subString(toDt, 12) + "_" + (System.currentTimeMillis() / 1000) + this.csvFileExtension;
-        Path fullFilePath = Paths.get(this.systemDir, createFileName);
+        Path fullFilePath = Paths.get(this.fileSystemDir, createFileName);
 
         String[] csvHeader = {"CLCT_DT",
                 "IXR_ID",
@@ -499,14 +496,13 @@ public class ScFileDownloadService {
                 "busDvrsLaneGoTfvl",
                 "busDvrsLaneLeftTfvl"};
         List<TbScAcrdStatHh> dataList = this.statHhRepo.findAllByDateRange(fromDt, toDt);
-        try {
-            OutputStreamWriter outputWriter = new OutputStreamWriter(Files.newOutputStream(fullFilePath), "MS949");
-            ICsvBeanWriter csvWriter = new CsvBeanWriter(outputWriter, CsvPreference.STANDARD_PREFERENCE);//EXCEL_PREFERENCE);//STANDARD_PREFERENCE);
+        try (OutputStreamWriter outputWriter = new OutputStreamWriter(Files.newOutputStream(fullFilePath), "MS949");
+             ICsvBeanWriter csvWriter = new CsvBeanWriter(outputWriter, CsvPreference.STANDARD_PREFERENCE);//EXCEL_PREFERENCE);//STANDARD_PREFERENCE);
+        ) {
             csvWriter.writeHeader(csvHeader);
             for (TbScAcrdStatHh data : dataList) {
                 csvWriter.write(data, nameMapping);
             }
-            csvWriter.close();
         } catch (IOException e) {
             throw new RuntimeException("파일 저장 중 오류가 발생했습니다.");
         }
@@ -523,13 +519,13 @@ public class ScFileDownloadService {
      * @throws NoSuchElementException
      */
     public ResponseEntity<Object> downloadCreateFile(HttpServletRequest req, String fileNameUri, String fileName)  throws NoSuchElementException{
-        Path fullFilePath = Paths.get(this.systemDir, fileNameUri);
+        Path fullFilePath = Paths.get(this.fileSystemDir, fileNameUri);
         File file = fullFilePath.toFile();
         if (!file.exists()) {
             throw new NoSuchElementException("파일이 존재하지 않습니다: " + fileNameUri);
         }
 
-        Resource resource = null;
+        Resource resource;
         try {
             resource = new InputStreamResource(Files.newInputStream(fullFilePath));
         } catch (IOException e) {
@@ -547,34 +543,29 @@ public class ScFileDownloadService {
 
     public void test(HttpServletRequest request, HttpServletResponse response) {
         List<TbScIxrCmraMngm> dataList = this.cmraMngmRepo.findAll();
-        CSVPrinter printer = null;
-        try {
-            printer = new CSVPrinter(response.getWriter(), CSVFormat.DEFAULT);
-        } catch (IOException e) {
-            throw new RuntimeException("파일을 저장할 수 없습니다.");
-        }
-
-        response.setContentType("text/csv");
-        response.addHeader("Content-Disposition", "attachment; filename=\"student.csv\"");
 
-        for (TbScIxrCmraMngm entity : dataList) {
-            try {
-                printer.printRecord(entity);
-            } catch (IOException e) {
-                throw new RuntimeException("파일 저장 중 오류가 발생했습니다.");
+        try (CSVPrinter printer = new CSVPrinter(response.getWriter(), CSVFormat.DEFAULT);
+        ) {
+            response.setContentType("text/csv");
+            response.addHeader("Content-Disposition", "attachment; filename=\"student.csv\"");
+
+            for (TbScIxrCmraMngm entity : dataList) {
+                try {
+                    printer.printRecord(entity);
+                } catch (IOException e) {
+                    throw new RuntimeException("파일 저장 중 오류가 발생했습니다.");
+                }
             }
-        }
-        try {
-            printer.close();
         } catch (IOException e) {
-            //throw new RuntimeException(e);
+            throw new RuntimeException("파일을 저장할 수 없습니다.");
         }
     }
+
     public ResponseEntity<Object> findAllIxrMngmData2(HttpServletRequest request, HttpServletResponse response) {
 
         String fileName = "IXR_MNGM_" + ItsUtils.getSysDay() + this.csvFileExtension;
         String createFileName = this.createFilePath + "IXR_MNGM_" + ItsUtils.getSysTime() + this.csvFileExtension;
-        Path fullFilePath = Paths.get(this.systemDir, createFileName);
+        Path fullFilePath = Paths.get(this.fileSystemDir, createFileName);
         File file = fullFilePath.toFile();
 
         //response.setContentType("text/csv;charset=utf-8");
@@ -651,25 +642,26 @@ public class ScFileDownloadService {
 //        } catch (IOException e) {
 //            throw new RuntimeException("파일 저장 중 오류가 발생했습니다.");
 //        }
-
-        try {
-            //String UTF8_BOM = "\uFEFF";
-            OutputStream out = response.getOutputStream();
 //            for (int marker : this.BOM_MARKERS) {
 //                out.write(marker);
 //            }
 
-            OutputStreamWriter outputWriter = new OutputStreamWriter(out, StandardCharsets.UTF_8);// Charset.forName("EUC-KR"));//, StandardCharsets.UTF_8);
-            ICsvBeanWriter csvWriter = new CsvBeanWriter(outputWriter, CsvPreference.STANDARD_PREFERENCE);//EXCEL_PREFERENCE);//STANDARD_PREFERENCE);
-            csvWriter.writeHeader(csvHeader);
-            for (TbScIxrMngm data : dataList) {
-                csvWriter.write(data, nameMapping);
+        try (OutputStream out = response.getOutputStream();
+        ) {
+            try (OutputStreamWriter outputWriter = new OutputStreamWriter(out, StandardCharsets.UTF_8);// Charset.forName("EUC-KR"));//, StandardCharsets.UTF_8);
+                 ICsvBeanWriter csvWriter = new CsvBeanWriter(outputWriter, CsvPreference.STANDARD_PREFERENCE);//EXCEL_PREFERENCE);//STANDARD_PREFERENCE);
+            ) {
+                csvWriter.writeHeader(csvHeader);
+                for (TbScIxrMngm data : dataList) {
+                    csvWriter.write(data, nameMapping);
+                }
+                csvWriter.flush();
+                out.flush();
+            } catch (IOException e) {
+                throw new RuntimeException("파일 저장 중 오류가 발생했습니다.");
             }
-            csvWriter.flush();
-            out.flush();
-            csvWriter.close();
         } catch (IOException e) {
-            throw new RuntimeException("파일 저장 중 오류가 발생했습니다.");
+            throw new RuntimeException(e);
         }
 
         return downloadCreateFile(request, createFileName, fileName);

+ 1 - 1
src/main/java/com/its/op/service/its/xprotocol/CenterProtocol.java

@@ -228,7 +228,7 @@ public class CenterProtocol {
             socket.setSoTimeout(readTimeout);            /* InputStream 에서 데이터읽을때의 timeout */
             socket.connect(socketAddress, connTimeout);  /* socket 연결 자체에대한 timeout */
         } catch (IOException e) {
-            String errMessage = e.getMessage();
+            String errMessage = "서버에 연결 할 수 없습니다.";
             log.error("connectServer: {}::{}, {}", ipAddress, port, errMessage);
             throw e;
         }

+ 2 - 0
src/main/java/com/its/utils/CookieUtils.java

@@ -15,6 +15,7 @@ public class CookieUtils {
             encodeValue = URLEncoder.encode(value, "UTF-8");
         } catch (UnsupportedEncodingException e) {
             //throw new RuntimeException(e);
+            encodeValue = "RuntimeException";
         }
         Cookie cookie = new Cookie(key, encodeValue);
         //cookie.setMaxAge(maxAge);
@@ -48,6 +49,7 @@ public class CookieUtils {
                         result = URLDecoder.decode(cookies[ii].getValue(), "UTF-8");
                     } catch (UnsupportedEncodingException e) {
                         //throw new RuntimeException(e);
+                        result = "RuntimeException";
                     }
                 }
             }