Skip to content

Commit

Permalink
Merge branch 'master' into bugfix/incorrect-dropdown
Browse files Browse the repository at this point in the history
  • Loading branch information
chan-j-d committed Jul 10, 2023
2 parents c41a1d7 + c84383f commit 5484d94
Showing 1 changed file with 23 additions and 20 deletions.
43 changes: 23 additions & 20 deletions src/main/java/reposense/model/ConfigRunConfiguration.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
package reposense.model;

import java.io.FileNotFoundException;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
Expand Down Expand Up @@ -40,27 +41,29 @@ public List<RepoConfiguration> getRepoConfigurations()
List<AuthorConfiguration> authorConfigs;
List<GroupConfiguration> groupConfigs;

try {
authorConfigs = new AuthorConfigCsvParser(cliArguments.getAuthorConfigFilePath()).parse();
RepoConfiguration.merge(repoConfigs, authorConfigs);
RepoConfiguration.setHasAuthorConfigFileToRepoConfigs(repoConfigs, true);
} catch (FileNotFoundException fnfe) {
// FileNotFoundException thrown as author-config.csv is not found.
// Ignore exception as the file is optional.
} catch (IOException | InvalidCsvException e) {
// for all IO and invalid csv exceptions, log the error and continue
logger.log(Level.WARNING, e.getMessage(), e);
Path authorConfigFilePath = cliArguments.getAuthorConfigFilePath();
Path groupConfigFilePath = cliArguments.getGroupConfigFilePath();


if (authorConfigFilePath != null && Files.exists(authorConfigFilePath)) {
try {
authorConfigs = new AuthorConfigCsvParser(cliArguments.getAuthorConfigFilePath()).parse();
RepoConfiguration.merge(repoConfigs, authorConfigs);
RepoConfiguration.setHasAuthorConfigFileToRepoConfigs(repoConfigs, true);
} catch (IOException | InvalidCsvException e) {
// for all IO and invalid csv exceptions, log the error and continue
logger.log(Level.WARNING, e.getMessage(), e);
}
}

try {
groupConfigs = new GroupConfigCsvParser(cliArguments.getGroupConfigFilePath()).parse();
RepoConfiguration.setGroupConfigsToRepos(repoConfigs, groupConfigs);
} catch (FileNotFoundException fnfe) {
// FileNotFoundException thrown as groups-config.csv is not found.
// Ignore exception as the file is optional.
} catch (IOException | InvalidCsvException e) {
// for all other IO and invalid csv exceptions, log the error and continue
logger.log(Level.WARNING, e.getMessage(), e);
if (groupConfigFilePath != null && Files.exists(groupConfigFilePath)) {
try {
groupConfigs = new GroupConfigCsvParser(cliArguments.getGroupConfigFilePath()).parse();
RepoConfiguration.setGroupConfigsToRepos(repoConfigs, groupConfigs);
} catch (IOException | InvalidCsvException e) {
// for all IO and invalid csv exceptions, log the error and continue
logger.log(Level.WARNING, e.getMessage(), e);
}
}

return repoConfigs;
Expand Down

0 comments on commit 5484d94

Please sign in to comment.