보안성 소스코드 점검 조치
This commit is contained in:
@@ -209,10 +209,10 @@ public class StandardMessageCoordinatorDJB extends DefaultStandardMessageCoordin
|
|||||||
msgList.setSize(1);
|
msgList.setSize(1);
|
||||||
LinkedHashMap<String, StandardItem> row = msgList.getArrayChilds(0, true);
|
LinkedHashMap<String, StandardItem> row = msgList.getArrayChilds(0, true);
|
||||||
if (row != null) {
|
if (row != null) {
|
||||||
if (row.containsKey("outp_msg_cd")) row.get("outp_msg_cd").setValue(siteErrCode);
|
setIfPresent(row, "outp_msg_cd", siteErrCode);
|
||||||
if (row.containsKey("outp_msg_ctnt")) row.get("outp_msg_ctnt").setValue(siteErrMsg);
|
setIfPresent(row, "outp_msg_ctnt", siteErrMsg);
|
||||||
if (row.containsKey("outp_msg_desc")) row.get("outp_msg_desc").setValue(siteErrDesc);
|
setIfPresent(row, "outp_msg_desc", siteErrDesc);
|
||||||
if (row.containsKey("err_occu_loct")) row.get("err_occu_loct").setValue(errCode);
|
setIfPresent(row, "err_occu_loct", errCode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -259,6 +259,17 @@ public class StandardMessageCoordinatorDJB extends DefaultStandardMessageCoordin
|
|||||||
// private helpers
|
// private helpers
|
||||||
// ----------------------------------------------------------------
|
// ----------------------------------------------------------------
|
||||||
|
|
||||||
|
/**
|
||||||
|
* row 에 해당 키의 StandardItem 이 존재할 때만 값을 설정한다.
|
||||||
|
* containsKey + get 이중 조회를 제거하고 널 역참조 가능성을 차단한다.
|
||||||
|
*/
|
||||||
|
private void setIfPresent(LinkedHashMap<String, StandardItem> row, String key, String value) {
|
||||||
|
StandardItem item = row.get(key);
|
||||||
|
if (item != null) {
|
||||||
|
item.setValue(value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void resolveCallPropRefValues(StandardMessage standardMessage, Properties prop) {
|
private void resolveCallPropRefValues(StandardMessage standardMessage, Properties prop) {
|
||||||
if (prop == null) return;
|
if (prop == null) return;
|
||||||
resolveCallPropInChilds(standardMessage.getChilds(), prop);
|
resolveCallPropInChilds(standardMessage.getChilds(), prop);
|
||||||
@@ -275,7 +286,8 @@ public class StandardMessageCoordinatorDJB extends DefaultStandardMessageCoordin
|
|||||||
if (m.matches()) {
|
if (m.matches()) {
|
||||||
String key = m.group(1);
|
String key = m.group(1);
|
||||||
String defaultVal = m.group(2) != null ? m.group(2) : "";
|
String defaultVal = m.group(2) != null ? m.group(2) : "";
|
||||||
String resolved = resolveCallPropValue(prop, key);
|
// 패턴상 group(1)은 필수 캡처 그룹이나, 널 역참조 정적분석 지적 대응으로 방어코드 추가
|
||||||
|
String resolved = (key != null) ? resolveCallPropValue(prop, key) : null;
|
||||||
item.setValue(resolved != null ? resolved : defaultVal);
|
item.setValue(resolved != null ? resolved : defaultVal);
|
||||||
}
|
}
|
||||||
} else if (type == StandardType.GROUP) {
|
} else if (type == StandardType.GROUP) {
|
||||||
|
|||||||
Reference in New Issue
Block a user