소나큐브 버그 수정

main
이범준 7 months ago
parent 21c8e710b1
commit f77710844f

@ -107,7 +107,9 @@ public class OutsourcingFileWriter {
File file = new File(metaFilePath); File file = new File(metaFilePath);
if (!file.exists()) { if (!file.exists()) {
file.createNewFile(); if(!file.createNewFile()) {
throw new RuntimeException("외주파일생성 중 오류가 발생하였습니다.");
};
} }
FileWriter fw = new FileWriter(file); FileWriter fw = new FileWriter(file);
BufferedWriter writer = new BufferedWriter(fw); BufferedWriter writer = new BufferedWriter(fw);

@ -107,7 +107,9 @@ public class HWPWriter {
kr.dogfoot.hwplib.writer.HWPWriter.toFile(baseFile, basePath); kr.dogfoot.hwplib.writer.HWPWriter.toFile(baseFile, basePath);
for(int i=2; i <= partFileList.size();i++) { for(int i=2; i <= partFileList.size();i++) {
(new File(partFileList.get(i-1))).delete(); if(!(new File(partFileList.get(i-1))).delete()) {
throw new RuntimeException("한글 파일 출력 중 오류가 발생하였습니다.");
}
} }
} }
@ -118,9 +120,7 @@ public class HWPWriter {
result.put("file", new File(filePath)); result.put("file", new File(filePath));
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace();
throw new RuntimeException("한글 파일 출력 중 오류가 발생하였습니다."); throw new RuntimeException("한글 파일 출력 중 오류가 발생하였습니다.");
} }
return result; return result;

@ -26,6 +26,7 @@ import java.util.function.Function;
import java.util.regex.Matcher; import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import java.util.stream.Stream;
import javax.imageio.ImageIO; import javax.imageio.ImageIO;
@ -203,10 +204,15 @@ public class CmmnUtil {
* @return * @return
*/ */
public static void removeDuplicateFileName(String root) { public static void removeDuplicateFileName(String root) {
try { List<Path> fileList = null;
try (Stream<Path> pathStream = Files.walk(Paths.get(root))){
List<Path> fileList = Files.walk(Paths.get(root)).filter(Files::isRegularFile).toList(); fileList = pathStream.filter(Files::isRegularFile).toList();
} catch (IOException e) {
e.printStackTrace();
}
if(fileList != null && !fileList.isEmpty()) {
Map<String, List<Path>> byFileName = fileList.stream().collect(Collectors.groupingBy(item -> item.toFile().getName())); Map<String, List<Path>> byFileName = fileList.stream().collect(Collectors.groupingBy(item -> item.toFile().getName()));
Iterator<String> keys = byFileName.keySet().iterator(); Iterator<String> keys = byFileName.keySet().iterator();
@ -224,15 +230,13 @@ public class CmmnUtil {
for(Path sameNameFile : sameNameFileList) { for(Path sameNameFile : sameNameFileList) {
if(!sameNameFile.equals(latest)) { if(!sameNameFile.equals(latest)) {
sameNameFile.toFile().delete(); if(!sameNameFile.toFile().delete()) {
throw new RuntimeException("[F]파일 삭제 오류");
}
} }
} }
} }
} catch (IOException e) {
e.printStackTrace();
} }
} }
/** /**

@ -102,20 +102,21 @@ public class FTPUtil {
} }
if(client.isConnected()) {
client.disconnect();
}
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); if(client.isConnected()) {
throw new RuntimeException("오류 발생");
} finally {
// ftp 커넥션이 연결되어 있으면 종료한다.
try { try {
if (client.isConnected()) {
client.disconnect(); client.disconnect();
} } catch (IOException e1) {
} catch (Throwable e) {
throw new RuntimeException("오류 발생"); throw new RuntimeException("오류 발생");
} }
} }
throw new RuntimeException("오류 발생");
}
return true; return true;
} }

Loading…
Cancel
Save