취약적 patch version

This commit is contained in:
임장현
2026-09-07 20:59:12 +09:00
parent 7409a497b9
commit 7f98f9715e
32 changed files with 439 additions and 102 deletions
@@ -222,6 +222,9 @@ public class BatchDirUtil
if (propKey.equals(REQUEST_RCV_ROOT_DIR )) throw new Exception(ExceptionUtil.getErrorCode("BECEAICUT009", new String[] {"요구수신", "ROOT" })); //배치 {1} {2} 디렉토리 정보를 프라퍼티에서 찾을 수 없습니다.
else if (propKey.equals(REQUEST_RCV_ERROR_DIR )) throw new Exception(ExceptionUtil.getErrorCode("BECEAICUT009", new String[] {"요구수신", "ERROR" }));
}
//위 분기에서 처리되지 않은 조합도 반드시 예외로 종료 (null 역참조 방지)
throw new Exception(ExceptionUtil.getErrorCode("BECEAICUT009", new String[] { propGroupKey, propKey }));
}
//디렉토리 맨끝에 "/" 가 있으면 빼고 리턴
return batchDir.endsWith("/")? batchDir.substring(0, batchDir.length()-1) : batchDir;
@@ -201,17 +201,17 @@ public class StringUtil
"/"; //default(unix)
}
public static String getRandomDigit(long digitLen) {
if (digitLen <= 0) return "";
String format = "";
for (int i=0; i<digitLen; i++) format += "0";
DecimalFormat df = new DecimalFormat(format);
long randomDigit = (long) (Math.random() * Long.parseLong("1"+format));
return df.format(randomDigit);
}
// public static String getRandomDigit(long digitLen) {
// if (digitLen <= 0) return "";
//
// String format = "";
// for (int i=0; i<digitLen; i++) format += "0";
//
// DecimalFormat df = new DecimalFormat(format);
// long randomDigit = (long) (Math.random() * Long.parseLong("1"+format));
//
// return df.format(randomDigit);
// }
public static String concateString(String[] valueArray) {
return concateString(valueArray, ",");
@@ -478,8 +478,9 @@ public class StringUtil
public static String getDump(Throwable t) {
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
t.printStackTrace(pw);
try (PrintWriter pw = new PrintWriter(sw)) {
t.printStackTrace(pw);
}
return sw.toString();
}
@@ -10,6 +10,7 @@ import com.eactive.eai.batch.scheduler.JobFileTransferVO;
import com.eactive.eai.common.dao.BaseDAO;
import com.eactive.eai.common.dao.DAOException;
import com.eactive.eai.common.exception.ExceptionUtil;
import com.eactive.eai.common.util.DatetimeUtil;
public class LogDAO extends BaseDAO implements LogQuery
{
@@ -1051,4 +1052,44 @@ public class LogDAO extends BaseDAO implements LogQuery
disconnect();
}
}
public int selectRemainRetry(BatchDoc batchDoc) throws DAOException {
ResultSet rs = null;
int index = 0;
String bjobMsgScheId = StringUtil.nvlTrim(batchDoc.getBatchMsg().getHeader().getScheduleCode() ); //UUID
String fileName = StringUtil.nvlTrim(batchDoc.getBatchMsg().getHeader().getFileName()); //실제파일명
String today = DatetimeUtil.getCurrentDate() + "%";
try {
this.connect(SELECT_REMAIN_RETRY );
logger.debug("{ LogDAO.selectRemainRetry() } 수행 SQL 문 : \n"+ SELECT_REMAIN_RETRY);
index = 1;
this.preparedStatement.setString(index++, bjobMsgScheId ); logger.debug("{ LogDAO.selectRemainRetry() } 바인드("+(index-1)+") : ["+ bjobMsgScheId +"]");
this.preparedStatement.setString(index++, bjobMsgScheId ); logger.debug("{ LogDAO.selectRemainRetry() } 바인드("+(index-1)+") : ["+ bjobMsgScheId +"]");
this.preparedStatement.setString(index++, fileName ); logger.debug("{ LogDAO.selectRemainRetry() } 바인드("+(index-1)+") : ["+ fileName +"]");
this.preparedStatement.setString(index++, today ); logger.debug("{ LogDAO.selectRemainRetry() } 바인드("+(index-1)+") : ["+ today +"]");
int remainRetry = -1; // 기본값 0
rs = executeQuery();
if (rs.next()) {
int val = rs.getInt("REMAIN_RETRY");
remainRetry = rs.wasNull() ? -1 : val;
}
logger.info("[ 남은 시도 횟수 ] ==> "+ remainRetry +" ["+ bjobMsgScheId +" / "+ fileName +"]");
return Math.max(remainRetry, 0);
} catch (DAOException ex) {
throw ex;
} catch (Exception ex) {
// TODO :: 에러 코드 새로 정의
String errMsg = ExceptionUtil.getErrorCode(ex, "BECEAICLG020", new String[] {bjobMsgScheId, bjobMsgScheId, fileName});
throw new DAOException(errMsg); //배치 DB로그 File 데이터 존재여부 조회시 오류가 발생하였습니다. [UUID: {1}] [SUB_UUID: {2}]
} finally {
disconnect();
}
}
}
@@ -475,4 +475,9 @@ public class LogManager
LogDAO dao = (LogDAO)DAOFactory.newInstance().create(LogDAO.class);
return dao.getFileLogSuccessCheck( procCode, instiCode, bizCode, fileName);
}
public int selectRemainRetry(BatchDoc msgDoc) throws Exception {
LogDAO dao = (LogDAO)DAOFactory.newInstance().create(LogDAO.class);
return dao.selectRemainRetry(msgDoc);
}
}
+22 -1
View File
@@ -335,5 +335,26 @@ public interface LogQuery
"AND SndrcvFileName = ? \n" +
"AND FileTrsmtStartHMS LIKE TO_CHAR( SYSDATE, 'YYYYMMDD' ) || '%' \n" +
"AND BjobPtrnDstcd IN ( 'AR', 'RR' ) \n" +
"AND ThisStgePrcssRsultCd = 'T' \n";
"AND ThisStgePrcssRsultCd = 'T' \n";
public static final String SELECT_REMAIN_RETRY =
"WITH DEFINED_RETRY AS ( \n" +
" SELECT RQSTRECVRETRALCNT AS CNT FROM " + Keys.TABLE_OWNER + "TSEAIBS01 \n" +
" WHERE TRIM(BJOBMSGSCHEID) = ? \n" +
") \n" +
"SELECT \n" +
" CASE \n" +
" WHEN COUNT(CASE WHEN J03.TRANPRCSSDSTCD = 'T' THEN 1 END) > 0 THEN 0 \n" +
" ELSE DR.CNT - COUNT(CASE WHEN J03.TRANPRCSSDSTCD = 'E' THEN 1 END) \n" +
" END AS REMAIN_RETRY \n" +
"FROM " + Keys.TABLE_OWNER + "TSEAIBJ03 J03 \n" +
"JOIN " + Keys.TABLE_OWNER + "TSEAIBJ08 J08 \n" +
" ON J08.BJOBDMNDMSGID = J03.BJOBDMNDMSGID \n" +
" AND J08.BJOBDMNDSUBMSGID = J03.BJOBDMNDSUBMSGID \n" +
"CROSS JOIN DEFINED_RETRY DR \n" +
"WHERE TRIM(J03.BJOBMSGSCHEID) = ? \n" +
"AND J08.SNDRCVFILENAME = ? \n" +
"AND J03.TRANSTARTHMS LIKE ? \n" +
"GROUP BY DR.CNT \n";
}
@@ -125,7 +125,7 @@ public class BatchRunningJobManager
+" / "+ batchDoc.getBatchMsg().getHeader().getProcessName()
+" / "+ batchDoc.getBatchMsg().getHeader().getInstitutionName()
+" / L="+ (service.getCurrentSocket() == null ? "" : service.getCurrentSocket().getLocalAddress().getHostAddress() +":"+ service.getCurrentSocket().getLocalPort())
+" / R="+ (service.getCurrentSocket() == null ? "" : service.getCurrentSocket().getInetAddress().getHostAddress() +":"+ service.getCurrentSocket().getPort())
+" / R="+ (service.getCurrentSocket() == null || service.getCurrentSocket().getInetAddress() == null ? "" : service.getCurrentSocket().getInetAddress().getHostAddress() +":"+ service.getCurrentSocket().getPort())
);
}else{
// UUID / 업무유형 / 업무구분 / 대외기관
@@ -1210,8 +1210,8 @@ public class SchedulerMessageDAO extends BaseDAO implements SchedulerMessageQuer
schedule.setSndrcvCyclTypName(rs.getString("SndrcvCyclTypName"));
schedule.setUapplCd (rs.getString("UapplCd" ));
schedule.setThisMsgChrgIDs (rs.getString("ThisMsgChrgIDs" ));
schedule.setSndrcvStartHMS (rs.getString("SndrcvStartHMS" ).trim());
schedule.setSndrcvEndHMS (rs.getString("SndrcvEndHMS" ).trim());
schedule.setSndrcvStartHMS (StringUtil.nvlTrim(rs.getString("SndrcvStartHMS" )));
schedule.setSndrcvEndHMS (StringUtil.nvlTrim(rs.getString("SndrcvEndHMS" )));
alist.add(schedule);
}
@@ -285,10 +285,14 @@ public class SchedulerMessageManager
BufferedInputStream bis = null;
try {
bis = new BufferedInputStream (new FileInputStream(file));
bis.skip(countPos);
bis.read(countBuffer);
long skipped = bis.skip(countPos);
int readLen = bis.read(countBuffer);
if (skipped != countPos || readLen != countLen) {
throw new RuntimeException("데이터 건수 읽기 실패 - skip=" + skipped + "/" + countPos + ", read=" + readLen + "/" + countLen);
}
} catch (Exception e) {
logger.error(e.getMessage(), e);
continue;
}finally{
if ( bis != null )
bis.close();
@@ -52,7 +52,7 @@ public class TelegramDAO extends BaseDAO implements TelegramQuery
{
// telegramitem 순서값은 런타임시에는 사용하지 않는다. 대신 TelegramVO에서 item이 추가될때 순서를 부여한다.
// 이러한 이유는 TSEAIBM02에서 수정작업을 편하게 하도록 하기 위함이다.
TelegramItemVO itemVO = new TelegramItemVO(rs.getString(3).trim(), rs.getString(4).trim(), rs.getString(5).trim(), rs.getString(6).trim());
TelegramItemVO itemVO = new TelegramItemVO(StringUtil.nvlTrim(rs.getString(3)), StringUtil.nvlTrim(rs.getString(4)), StringUtil.nvlTrim(rs.getString(5)), StringUtil.nvlTrim(rs.getString(6)));
// 전문 필드중에 가변부가 있으면 전문의 variableFieldCheckTag를 true로 세팅한다.
if (StringUtil.nvlTrim(rs.getString(5)).trim().toUpperCase().equals("XX"))