public void afterPropertiesSet() throws FdlException {
try {
egovProperties = new ExtendedProperties();
// 외부파일이 정의되었을때
if (extFileName != null) {
refreshPropertyFiles();
}
Iterator it = properties.entrySet().iterator();
while (it.hasNext()) {
Map.Entry entry = (Map.Entry) it.next();
String key = (String) entry.getKey();
String value = (String) entry.getValue();
if (EgovPropertyService.LOGGER.isDebugEnabled()) {
EgovPropertyService.LOGGER.debug(messageSource.getMessage(
"debug.properties.property",
new String[] {key, value }, Locale.getDefault()));
}
if (key == null || key.equals("")) {
if (EgovPropertyService.LOGGER.isErrorEnabled())
EgovPropertyService.LOGGER.error(messageSource
.getMessage("error.properties.check.essential",
new String[] {}, Locale.getDefault()));
throw new FdlException(messageSource,
"error.properties.check.essential", null);
}
egovProperties.put(key, value);
}
} catch (Exception e) {
if (e instanceof FdlException)
throw (FdlException) e;
else {
if (EgovPropertyService.LOGGER.isErrorEnabled())
EgovPropertyService.LOGGER.error(messageSource.getMessage(
"error.properties.initialize.reason", new String[] {},
Locale.getDefault()));
throw new FdlException(messageSource,
"error.properties.initialize", e);
}
}
}
위의 코드에서
egovProperties.put(key, value);
이 부분이 버그이다.
이 소스를 그대로 쓰면
public class Test {
private EgovPropertyService propertiesService;
public void showKeys() {
Iterator keys = soapPropertiesService.getKeys();
while(keys.hasNext()) {
System.out.println(keys.next());
}
}
}
위와 같이 했을 경우 key값이 절대로 나오질 않는다.
ExtendedProperties 가 hashMap을 상속받아서
addProperties란 메소드를 쓰지 않으면 keys 들어가질 않는다.
put으로 HashTable에서 직접 key,value을 넣으니 기능을 잘돌아가지만
getKeys로 해서 가져올려고 할 경우엔 값이 나오질 않는 버그가 있다. ㅡㅡa
만들어 놓고 테스트도 안하고 배포 하는거 같다.