Skip to content

Commit 34c407c

Browse files
committed
Load setting file only when the configuration file exists
1 parent 41a45e3 commit 34c407c

File tree

3 files changed

+8
-1
lines changed

3 files changed

+8
-1
lines changed

src/main/java/root/core/repository/constracts/PropertyRepository.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010

1111
public interface PropertyRepository {
1212

13+
boolean isFileExist(String filePath);
14+
1315
PropertiesConfiguration getConfiguration(String config);
1416

1517
void save(String filePath, PropertiesConfiguration config);

src/main/java/root/core/repository/implement/PropertyRepositoryImpl.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,11 @@ public static PropertyRepository getInstance() {
3939

4040
/****************************************************************************/
4141

42+
@Override
43+
public boolean isFileExist(String filePath) {
44+
return new File(filePath).exists();
45+
}
46+
4247
/**
4348
* Configuration 객체를 반환한다.
4449
* TODO 굳이 메서드를 Wrapping 해서 호출할 필요가 있을까..? Controller와 의존성 제거목적으로 일단 이렇게 함..

src/main/java/root/javafx/Controller/SettingMenuController.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ public void initialize(URL location, ResourceBundle resources) {
117117
// remember.properties 파일에서, 최근 사용된 설정파일 경로가 있다면 해당 설정파일을 불러온다.
118118
String lastUsePropertiesFile = propertyRepository.getLastUseConnInfoFilePath();
119119
logger.debug("최근 사용된 프로퍼티파일: " + lastUsePropertiesFile);
120-
if (lastUsePropertiesFile != null) {
120+
if (lastUsePropertiesFile != null && propertyRepository.isFileExist(lastUsePropertiesFile)) {
121121
loadSelectedConfigFile(lastUsePropertiesFile);
122122
}
123123

0 commit comments

Comments
 (0)