Merge remote-tracking branch 'origin/jenkins_with_weblogic' into jenkins_with_weblogic

This commit is contained in:
Rinjae
2026-02-04 10:38:05 +09:00
6 changed files with 100 additions and 42 deletions
@@ -438,19 +438,36 @@ public class LayoutSyncController extends OnlBaseAnnotationController implements
resultSet = sis.readLine(arg, total, 1024);
}
param.put("recvData", new String(arg, "UTF-8"));
// ===== 인코딩 확인 로그 시작 =====
logger.info("========== 인코딩 디버깅 정보 ==========");
logger.info("request.getCharacterEncoding(): " + request.getCharacterEncoding());
logger.info("request.getContentType(): " + request.getContentType());
logger.info("Content Length: " + arg.length + " bytes");
// 다양한 인코딩으로 읽어보기
String asDefaultEncoding = new String(arg);
String asUtf8 = new String(arg, "UTF-8");
String asEucKr = new String(arg, "EUC-KR");
logger.info("Default Encoding 전체 내용:\n" + asDefaultEncoding);
logger.info("UTF-8 전체 내용:\n" + asUtf8);
logger.info("EUC-KR 전체 내용:\n" + asEucKr);
logger.info("========================================");
// ===== 인코딩 확인 로그 끝 =====
param.put("recvData", new String(arg, "EUC-KR"));
} catch(Exception e) {
logger.error("MessageSync.err - don't read the XML File - " + new String(arg), e);
logger.error("MessageSync.err - don't read the XML File - " + new String(arg, "EUC-KR"), e);
param.put("recvData", "");
}
// byte[]로부터 XML 파싱 (BOM 제거)
String xmlContent = new String(arg, "UTF-8").trim();
// byte[]로부터 XML 파싱 (BOM 제거) - EUC-KR로 읽기
String xmlContent = new String(arg, "EUC-KR").trim();
// BOM 제거 (UTF-8 BOM: EF BB BF)
if (xmlContent.startsWith("\uFEFF")) {
xmlContent = xmlContent.substring(1);
}
Document doc = builder.build(new ByteArrayInputStream(xmlContent.getBytes("UTF-8")));
Document doc = builder.build(new ByteArrayInputStream(xmlContent.getBytes("EUC-KR")));
param.put("logPrcssSeqno", UUIDGenerator.getUUID());
// xml 1.1
@@ -512,7 +529,7 @@ public class LayoutSyncController extends OnlBaseAnnotationController implements
if (!"EAI".equalsIgnoreCase(useSystem) && !"FEP".equalsIgnoreCase(useSystem)) {
String errorMessage = "사용 시스템(" + useSystem + ")인 전문레이아웃은 EAI, FEP로 배포 안됨.";
logger.error(errorMessage);
throw new Exception(errorMessage);
throw new UseSystemException(errorMessage);
}
if( "ASCII".equals(format.getAttributeValue("msgType")) ) {
@@ -587,9 +604,15 @@ public class LayoutSyncController extends OnlBaseAnnotationController implements
logger.error("",e.getStackTrace()[0]);
try {
if( results != null ) {
results.getChild("Result").setText("False");
if (e instanceof UseSystemException) {
results.getChild("Result").setText("True");
} else {
results.getChild("Result").setText("False");
}
results.getChild("ResultMessage").setText( e.getMessage() );
resultS = StringUtils.toXMLString(rDoc, true);
}
if( param.get("logPrcssSeqno") == null ) {
@@ -607,10 +630,11 @@ public class LayoutSyncController extends OnlBaseAnnotationController implements
ServletOutputStream sos = null;
try {
response.setContentType("application/xml; charset=EUC-KR");
sos = response.getOutputStream();
sos.write(resultS.getBytes());
sos.write(resultS.getBytes("EUC-KR"));
} catch( Exception e ) {
e.printStackTrace();
e.printStackTrace();
} finally {
if( sis != null ) sis.close();
if( sos != null ) sos.close();
@@ -644,16 +668,16 @@ public class LayoutSyncController extends OnlBaseAnnotationController implements
// 초기화
DataSourceContextHolder.setDataSourceType(DataSourceTypeManager.getDataSourceType(schema));
try {
try {
// // 요청 전문
sis = request.getInputStream();
JSONObject json = (JSONObject) JSONValue.parse(new InputStreamReader(sis));
sis = request.getInputStream();
JSONObject json = (JSONObject) JSONValue.parse(new InputStreamReader(sis, "EUC-KR"));
// JJB 향후제거 shkim 2020-05-13 연계 테스트 체크
logger.error("\n\n MMI SYNC Request : " + json.toString());
// log 기록
// log 기록
byte[] arg = new byte[request.getContentLength()];
int resultSet =0;
int total = 0;
@@ -663,10 +687,10 @@ public class LayoutSyncController extends OnlBaseAnnotationController implements
total += resultSet;
resultSet = sis.readLine(arg, total, 1024);
}
param.put("recvData", new String(arg));
param.put("recvData", new String(arg, "EUC-KR"));
} catch(Exception e) {
logger.error("MessageSync.err - don't read the JSON File - " + new String(arg), e);
logger.error("MessageSync.err - don't read the JSON File - " + new String(arg, "EUC-KR"), e);
param.put("recvData", "");
}
@@ -707,10 +731,11 @@ public class LayoutSyncController extends OnlBaseAnnotationController implements
ServletOutputStream sos = null;
try {
response.setContentType("application/json; charset=EUC-KR");
sos = response.getOutputStream();
sos.write(resultS.toString().getBytes());
sos.write(resultS.toString().getBytes("EUC-KR"));
} catch( Exception e ) {
e.printStackTrace();
e.printStackTrace();
} finally {
if( sis != null ) sis.close();
if( sos != null ) sos.close();
@@ -0,0 +1,11 @@
package com.eactive.eai.rms.onl.manage.rule.layoutsync;
import com.eactive.eai.rms.onl.common.exception.EMSRuntimeException;
public class UseSystemException extends EMSRuntimeException {
public UseSystemException(String message) {
super(message);
}
}