fix: jaxb library error fix

commons-collections -> commons-collections4로 변경(보안 취약점(vulnerable))
main
minuk926 2 years ago
parent 56037646a8
commit f5a0ac7e86

@ -459,10 +459,15 @@
<artifactId>commons-configuration</artifactId>
<version>1.10</version>
</dependency>
<!-- <dependency>-->
<!-- <groupId>commons-collections</groupId>-->
<!-- <artifactId>commons-collections</artifactId>-->
<!-- <version>3.2.2</version>-->
<!-- </dependency>-->
<dependency>
<groupId>commons-collections</groupId>
<artifactId>commons-collections</artifactId>
<version>3.2.1</version>
<groupId>org.apache.commons</groupId>
<artifactId>commons-collections4</artifactId>
<version>4.1</version>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
@ -472,7 +477,7 @@
<dependency>
<groupId>org.springmodules</groupId>
<artifactId>spring-modules-jakarta-commons</artifactId>
<version>0.8</version>
<version>0.8a</version>
<exclusions>
<exclusion>
<artifactId>jstl</artifactId>
@ -612,20 +617,36 @@
</dependency>
<!-- Rest docs -->
<!-- ClassNotFoundException: com.sun.xml.internal.bind.v2.ContextFactory에러 방지 -->
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.3.1</version>
</dependency>
<!-- &lt;!&ndash; MyBatis Framework &ndash;&gt;-->
<!-- <dependency>-->
<!-- <groupId>org.mybatis</groupId>-->
<!-- <artifactId>mybatis</artifactId>-->
<!-- <version>3.5.11</version>-->
<!-- </dependency>-->
<!-- &lt;!&ndash; Spring과 MyBatis 연동 Framework &ndash;&gt;-->
<!-- <dependency>-->
<!-- <groupId>org.mybatis</groupId>-->
<!-- <artifactId>mybatis-spring</artifactId>-->
<!-- <version>2.0.7</version>-->
<!-- </dependency>-->
<dependency>
<groupId>org.glassfish.jaxb</groupId>
<artifactId>jaxb-runtime</artifactId>
<version>2.3.1</version>
</dependency>
<!--
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-core</artifactId>
<version>2.3.0.1</version>
</dependency>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-impl</artifactId>
<version>2.3.1</version>
</dependency>
<dependency>
<groupId>org.javassist</groupId>
<artifactId>javassist</artifactId>
<version>3.25.0-GA</version>
</dependency>
-->
<!-- ClassNotFoundException: com.sun.xml.internal.bind.v2.ContextFactory에러 방지 -->
</dependencies>

@ -0,0 +1,151 @@
package kr.xit.fims.biz.ec.model;
import java.io.Serializable;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* <pre>
* interface
* XmlRootElement
* JAXBContext
* XmlAccessorType
* FIELD - (static transient ) XML
* NONE - XML .
* PROPERTY - getter/setter XML .
* PUBLIC_MEMBER - public getter/setter XML .
*
* comment / /
* / /
* </pre>
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
@XmlRootElement(name = "dmndinfo")
@XmlAccessorType(XmlAccessType.FIELD)
public class CtznStmtAnsSendDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* :
* PK : number(30) - YYYYMMDDHH24MISSFF+random(9)
*/
@XmlElement(name = "interface_seq_n")
private String interfaceSeqN;
/**
* :
* char(88)
* EC010008
*/
@XmlElement(name = "sys_gubun_c")
private String sysGubunC;
/**
* :
* varchar2(7)
* 1140100 / /
* ex) - 641000
*/
@XmlElement(name = "anc_code_v")
private String ancCodeV;
/**
* :
* char(3)
* 140:(-) / 180: / 140: (-)
*/
@XmlElement(name = "peti_gubun_c")
private String petiGubunC;
/**
* :
* varchar2(16)
* ( ), null .
* ( )
*/
@XmlElement(name = "peti_no_c")
private String petiNoC;
/**
* :
* varchar2(16)
* ( ), null .
* ( )"
*/
@XmlElement(name = "civil_no_c")
private String civilNoC;
//----------------------------------------------------------------------------------------------------
// 결과(응답) 처리
//----------------------------------------------------------------------------------------------------
/**
* :
* varchar2(512)
*
*/
@XmlElement(name = "civil_gist_v")
private String civilGistV;
/**
* :
* clob
*
*/
@XmlElement(name = "civil_abstract_l")
private String civilAbstractL;
/**
* :
* varchar2(7)
*/
@XmlElement(name = "pcd_dept_v")
private String pcdDeptV;
/**
* :
* varchar2(50)
*/
@XmlElement(name = "pcd_dept_nm_v")
private String pcdDeptNmV;
/**
* :
* varchar2(50)
*/
@XmlElement(name = "duty_id_v")
private String dutyIdV;
/**
* :
* varchar2(64)
*/
@XmlElement(name = "pcd_email_v")
private String pcdEmailV;
/**
* :
* varchar2(20)
*/
@XmlElement(name = "pcd_tel_v")
private String pcdTelV;
/**
* :
* clob
*/
@XmlElement(name = "pcd_rst_cont_l")
private String pcdRstContL;
}

@ -306,8 +306,8 @@ public class CtznStmtDTO implements Serializable { //extends ExtlEsbDataType {
*/
private String ancCodeV;
public static NatlNewspaperSendXmlDTO getCtznStmtAnsDTO(CtznStmtDTO.CtznStmtAns dto) {
return NatlNewspaperSendXmlDTO.builder()
public static CtznStmtAnsSendDTO getCtznStmtAnsDTO(CtznStmtDTO.CtznStmtAns dto) {
return CtznStmtAnsSendDTO.builder()
.interfaceSeqN(dto.getInterfaceSeqN())
.sysGubunC(dto.getSysGubunC())
.ancCodeV(dto.getAncCodeV())

@ -1,554 +0,0 @@
package kr.xit.fims.biz.ec.model;
import java.io.Serializable;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;
/**
* <pre>
* interface
* XmlRootElement
* JAXBContext
* XmlAccessorType
* FIELD - (static transient ) XML
* NONE - XML .
* PROPERTY - getter/setter XML .
* PUBLIC_MEMBER - public getter/setter XML .
*
* comment / /
* / /
* </pre>
*/
@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
@Builder
@ToString
@XmlRootElement(name = "dmndinfo")
@XmlAccessorType(XmlAccessType.FIELD)
public class NatlNewspaperSendXmlDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* :
* PK : number(30) - YYYYMMDDHH24MISSFF+random(9)
*/
@XmlElement(name = "interface_seq_n")
private String interfaceSeqN;
/**
* :
* char(88)
* EC010008
*/
@XmlElement(name = "sys_gubun_c")
private String sysGubunC;
/**
* :
* varchar2(7)
* 1140100 / /
* ex) - 641000
*/
@XmlElement(name = "anc_code_v")
private String ancCodeV;
/**
* :
* char(3)
* 140:(-) / 180: / 140: (-)
*/
@XmlElement(name = "peti_gubun_c")
private String petiGubunC;
/**
* :
* varchar2(7)
* ()
*/
@XmlElement(name = "peti_anc_code_v")
private String petiAncCodeV;
/**
* :
* varchar2(16)
* ( ), null .
* ( )
*/
@XmlElement(name = "peti_no_c")
private String petiNoC;
/**
* :
* varchar2(16)
* ( ), null .
* ( )"
*/
@XmlElement(name = "civil_no_c")
private String civilNoC;
//----------------------------------------------------------------------------------------------------
// 결과(응답) 처리
//----------------------------------------------------------------------------------------------------
/**
* :
* varchar2(512)
*
*/
@XmlElement(name = "civil_gist_v")
private String civilGistV;
/**
* :
* clob
*
*/
@XmlElement(name = "civil_abstract_l")
private String civilAbstractL;
/**
* :
* varchar2(7)
*/
@XmlElement(name = "pcd_dept_v")
private String pcdDeptV;
/**
* :
* varchar2(50)
*/
@XmlElement(name = "pcd_dept_nm_v")
private String pcdDeptNmV;
/**
* :
* varchar2(50)
*/
@XmlElement(name = "duty_id_v")
private String dutyIdV;
/**
* :
* varchar2(64)
*/
@XmlElement(name = "pcd_email_v")
private String pcdEmailV;
/**
* :
* varchar2(20)
*/
@XmlElement(name = "pcd_tel_v")
private String pcdTelV;
/**
* :
* clob
*/
@XmlElement(name = "pcd_rst_cont_l")
private String pcdRstContL;
/**
* :
* varchar2(14) : YYYYMMDDHH24MISS
*/
@XmlElement(name = "do_reg_d")
private String doRegD;
/**
* :
* char(1)
* Y = , N = (default)
*/
@XmlElement(name = "pcd_rst_cont_attach_yn_c")
private String pcdRstContAttachYnC;
/**
* :
* varchar2(7)
* ex) 6410000
*/
@XmlElement(name = "pcd_anc_code_v")
private String pcdAncCodeV;
/**
* :
* date
* sysdate(YYYYMMDDHH24MISS)
*/
@XmlElement(name = "reg_d")
private String regD;
/**
* :
* char(1)
* 1: / 2: / 1:
*/
@XmlElement(name = "send_yn_c")
private String sendYnC;
/**
*
* date : YYYYMMDDHH24MISS
*/
@XmlElement(name = "send_d")
private String sendD;
/**
* :
* date
* interface DB->XML sysdate(YYYYMMDDHH24MISS)
*/
@XmlElement(name = "apply_d")
private String applyD;
/**
* :
* char(1)
* :Y OR N (default:N , DB Y )
*/
@XmlElement(name = "apply_gubun_c")
private String applyGubunC;
//------------------------------------------------------------------------------------
/**
* 1:
* varchar2(400)
* 0 / / 0
*/
@XmlElement(name = "pcd_gubun_v")
private String pcdGubunV;
/**
* 2:
* varchar2(400)
*/
@XmlElement(name = "pcd_gubun2_v")
private String pcdGubun2V;
/**
* 3:
* varchar2(400)
*/
@XmlElement(name = "pcd_gubun3_v")
private String pcdGubun3V;
//-------------------------------------------------------------------------------------
/**
* xml :
* varchar2(10)
*/
@XmlElement(name = "ifid")
private String ifid;
/**
* :
* varchar2(7)
*
*/
@XmlElement(name = "srcorgcd")
private String srcorgcd;
/**
* :
* varchar2(7)
* insert 1140100
*/
@XmlElement(name = "tgtorgcd")
private String tgtorgcd;
/**
*
* date
*/
@XmlElement(name = "anc_reg_d")
private String ancRegD;
/**
*
* varchar2(4000)
*/
@XmlElement(name = "more_again_v")
private String moreAgainV;
//------------------------------------------------------------------------------
/**
* 1
* char(8)
*/
@XmlElement(name = "satisfy_c")
private String satisfyC;
/**
* 2
* char(8)
*/
@XmlElement(name = "satisfy2_c")
private String satisfy2C;
/**
* 3
* char(8)
*/
@XmlElement(name = "satisfy3_c")
private String satisfy3C;
//------------------------------------------------------------------------------
/**
*
* date
*/
@XmlElement(name = "satisfy_reg_d")
private String satisfyRegD;
/**
* : /
* varchar2(128)
*/
@XmlElement(name = "peter_name_v")
private String peterNameV;
/**
* : /
* varchar2(7)
*/
@XmlElement(name = "zip_code_c")
private String zipCodeC;
/**
* : /
* varchar2(400)
*/
@XmlElement(name = "address_v")
private String addressV;
/**
*
* varchar2(64)
*/
@XmlElement(name = "email_v")
private String emailV;
/**
*
* varchar2(20)
*/
@XmlElement(name = "cel_no_v")
private String celNoV;
/**
*
* varchar2(20)
*/
@XmlElement(name = "tel_no_v")
private String telNoV;
/**
* : /
* varchar2(500)
*/
@XmlElement(name = "peti_title_v")
private String petiTitleV;
/**
* : /
* clob
*/
@XmlElement(name = "peti_reason_l")
private String petiReasonL;
/**
* : /
* char(1)
* Y = , N = (default N)
* Y ()
* N
*/
@XmlElement(name = "open_yn_c")
private String openYnC;
/**
* : /
* date : YYYYMMDDHH24MISS
*/
@XmlElement(name = "peti_reg_d")
private String petiRegD;
/**
* :
* char(1)
* Y = , N = (default)
*/
@XmlElement(name = "peti_reason_attach_yn_c")
private String petiReasonAttachYnC;
/**
* :
* number(10)
*/
@XmlElement(name = "peti_file_size_n")
private String petiFileSizeN;
//-------------------------------------------------------------
/**
* 1
* varchar2(2000)
*/
@XmlElement(name = "peti_file_path1_v")
private String petiFilePath1V;
/**
* 2
* varchar2(2000)
*/
@XmlElement(name = "peti_file_path2_v")
private String petiFilePath2V;
/**
* 3
* varchar2(2000)
*/
@XmlElement(name = "peti_file_path3_v")
private String petiFilePath3V;
/**
* 4
* varchar2(2000)
*/
@XmlElement(name = "peti_file_path4_v")
private String petiFilePath4V;
/**
* 5
* varchar2(2000)
*/
@XmlElement(name = "peti_file_path5_v")
private String petiFilePath5V;
//-----------------------------------------------------------------------------
@XmlElement(name = "peti_path_gubun_c")
private String petiPathGubunC;
/**
*
* number(10)
*/
@XmlElement(name = "pcd_file_size_n")
private String pcdFileSizeN;
//------------------------------------------------------------------------
/**
* 1
* varchar2(2000)
*/
@XmlElement(name = "pcd_file_path1_v")
private String pcdFilePath1V;
/**
* 2
* varchar2(2000)
*/
@XmlElement(name = "pcd_file_path2_v")
private String pcdFilePath2V;
/**
* 3
* varchar2(2000)
*/
@XmlElement(name = "pcd_file_path3_v")
private String pcdFilePath3V;
/**
* 4
* varchar2(2000)
*/
@XmlElement(name = "pcd_file_path4_v")
private String pcdFilePath4V;
/**
* 5
* varchar2(2000)
*/
@XmlElement(name = "pcd_file_path5_v")
private String pcdFilePath5V;
//----------------------------------------------------------------------
/**
*
* number(5)
*/
@XmlElement(name = "peti_proc_dur_n")
private String petiProcDurN;
/**
*
* date
*/
@XmlElement(name = "peti_end_d")
private String petiEndD;
}

@ -17,8 +17,8 @@ import org.springframework.transaction.annotation.Transactional;
import kr.xit.fims.biz.FimsConst;
import kr.xit.fims.biz.ec.mapper.IEcCtznSttemntMapper;
import kr.xit.fims.biz.ec.model.CtznStmtAnsSendDTO;
import kr.xit.fims.biz.ec.model.CtznStmtDTO;
import kr.xit.fims.biz.ec.model.NatlNewspaperSendXmlDTO;
import kr.xit.framework.biz.cmm.model.CmmFileDTO;
import kr.xit.framework.biz.cmm.service.ICmmFileService;
import kr.xit.framework.support.exception.BizRuntimeException;
@ -162,7 +162,8 @@ public class EcCtznSttemntService implements IEcCtznSttemntService {
String tgtPath = uploadResPath + fileDtlList.get(0).getFileCours();
final String fileName = dto.getInterfaceSeqN() + ".xml";
String xmlStr = XmlParseUtils.writeObjectToXml(CtznStmtDTO.CtznStmtAns.getCtznStmtAnsDTO(dto), NatlNewspaperSendXmlDTO.class);
CtznStmtAnsSendDTO sendDto = CtznStmtDTO.CtznStmtAns.getCtznStmtAnsDTO(dto);
String xmlStr = XmlParseUtils.writeObjectToXml(sendDto, kr.xit.fims.biz.ec.model.CtznStmtAnsSendDTO.class);
byte[] bytes = xmlStr.getBytes();
Path path = Paths.get(tgtPath + "/" + fileName);

@ -12,9 +12,10 @@ import javax.xml.bind.JAXBException;
import javax.xml.bind.Marshaller;
import javax.xml.bind.Unmarshaller;
import kr.xit.fims.biz.ec.model.CtznStmtAnsSendDTO;
import kr.xit.fims.biz.ec.model.NatlNewspaperRcvXmlDTO;
import kr.xit.fims.biz.ec.model.NatlNewspaperSendXmlDTO;
import kr.xit.framework.support.exception.BizRuntimeException;
import kr.xit.framework.support.util.Checks;
import kr.xit.framework.support.util.constants.MessageKey;
import lombok.extern.slf4j.Slf4j;
@ -32,7 +33,11 @@ public class XmlParseUtils {
Object o = unmarshaller.unmarshal(fileInputStream);
return t.cast(o);
}catch(IOException | JAXBException e){
throw BizRuntimeException.create(MessageKey.CUSTOM_MSG, e.getMessage());
String msg = e.getMessage();
if(Checks.isEmpty(msg)) msg = e.getCause().toString();
log.error("XmlParseUtils::readXmlToObject - {}", msg);
e.printStackTrace();
throw BizRuntimeException.create(MessageKey.CUSTOM_MSG, msg);
}
}
@ -60,14 +65,18 @@ public class XmlParseUtils {
// xml 파일 생성
marshaller.marshal(t, sw);
}catch(JAXBException e){
throw BizRuntimeException.create(MessageKey.CUSTOM_MSG, e.getMessage());
String msg = e.getMessage();
if(Checks.isEmpty(msg)) msg = e.getCause().toString();
log.error("XmlParseUtils::writeObjectToXml - {}", msg);
e.printStackTrace();
throw BizRuntimeException.create(MessageKey.CUSTOM_MSG, msg);
}
return sw.toString();
}
public static void main(String[] args) {
NatlNewspaperSendXmlDTO sendDto = NatlNewspaperSendXmlDTO.builder()
CtznStmtAnsSendDTO sendDto = CtznStmtAnsSendDTO.builder()
.interfaceSeqN("999999")
.pcdRstContL("1. 교통질서 확립에 힘써주신 점에 대해 감사드립니다.\n"
+ "\n"
@ -80,9 +89,8 @@ public class XmlParseUtils {
+ " 나. 따라서, 위반 차량에 대해 주?정차 위반 과태료 부과 처분이 이루어졌음을 알려드립니다.\n"
+ "\n"
+ "5. 안전을 위한 시민 정신에 감사드리며, 답변 내용에 대한 추가 설명이 필요한 경우 군포시청 차량관리과 주차단속팀 박효주 주무관(☏031-390-0291)에게 연락 주시면 친절히 안내해 드리도록 하겠습니다. 감사합니다.")
.addressV("ldlldl")
.applyGubunC("Y").build();
String xmlStr = XmlParseUtils.writeObjectToXml(sendDto, NatlNewspaperSendXmlDTO.class);
.build();
String xmlStr = XmlParseUtils.writeObjectToXml(sendDto, CtznStmtAnsSendDTO.class);
log.debug(xmlStr);
log.debug("\n\n\n");

Loading…
Cancel
Save