문제) Map<String, String> 데이터를 루프를 돌려 값을 찍어보던 중 에러는 없었지만 값이 처음 몇 개만 찍히고 마지막까지 찍히지 않는 현상이 있었다.
문제가 발생된 소스
/**
* 문제가 발생되는 소스
* @param map
* @return
*/
protected static Map<String, String> server2Client(Map<String, String> map) {
LOGGER.debug("server2Client");
Iterator iterKey = map.keySet().iterator();
Map<String, String> resultMap = new HashMap<String, String>();
while (iterKey.hasNext()) {
String key = iterKey.next();
LOGGER.debug("key="+key+" --> "+revert+", val="+map.get(key));
}
return resultMap;
}
2020-05-13 12:22:16,038 server2Client
2020-05-13 12:22:16,038 key=TMI_NAME val=building_04.dae
2020-05-13 12:22:16,038 key=THUMB val=_screenshot.png
2020-05-13 12:22:16,038 key=TMI_REGDATE val=2020-05-07 11:39:21.0
해결) Map 데이터를 Map<String, Object> 형식으로 수정 후 문제가 해결되었다.
문제가 해소된 소스
/**
* 문제가 해소된 소스
* @param map
* @return
*/
protected static Map<String, Object> server2Client(Map<String, Object> map) {
LOGGER.debug("server2Client");
Iterator iterKey = map.keySet().iterator();
Map<String, Object> resultMap = new HashMap<String, Object>();
while (iterKey.hasNext()) {
String key = iterKey.next();
LOGGER.debug("key="+key+" --> "+revert+", val="+map.get(key));
}
return resultMap;
}
2020-05-13 12:22:40,760 server2Client
2020-05-13 12:22:40,760 key=TMI_NAME val=building_04.dae
2020-05-13 12:22:40,760 key=THUMB val=_screenshot.png
2020-05-13 12:22:40,760 key=TMI_REGDATE val=2020-05-07 11:39:21.0
2020-05-13 12:22:40,760 key=TMI_PRESYN val=D
2020-05-13 12:22:40,760 key=TMI_SEQ val=2
2020-05-13 12:22:40,760 key=ATCH_FILE_ID val=FILE_000000000000105
2020-05-13 12:22:40,760 server2Client
2020-05-13 12:22:40,760 key=TMI_NAME val=building_04.dae
2020-05-13 12:22:40,760 key=THUMB val=_screenshot.png
2020-05-13 12:22:40,760 key=TMI_REGDATE val=2020-05-07 11:47:52.0
2020-05-13 12:22:40,760 key=TMI_PRESYN val=D
2020-05-13 12:22:40,760 key=TMI_SEQ val=3
2020-05-13 12:22:40,760 key=ATCH_FILE_ID val=FILE_000000000000106