Skip to content

Commit

Permalink
Make FileRegistry not fail the whole init procedure when no file acce…
Browse files Browse the repository at this point in the history
…ss rights are available
  • Loading branch information
sake committed Jun 24, 2015
1 parent 75edfe2 commit 952c35f
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions addon/src/main/java/org/openecard/addon/FileRegistry.java
Expand Up @@ -143,11 +143,15 @@ private HashMap<String, File> getFiles() {
* @param addonPath Path to the directory which shall be monitored.
*/
private void startFileMonitor(String addonPath) {
File f = new File(addonPath);
logger.debug("Starting file alteration monitor on path: {}", f.getPath());
FilesystemAlterationMonitor fam = new FilesystemAlterationMonitor();
fam.addListener(f, new PluginDirectoryAlterationListener(this, manager));
fam.start();
try {
File f = new File(addonPath);
logger.debug("Starting file alteration monitor on path: {}", f.getPath());
FilesystemAlterationMonitor fam = new FilesystemAlterationMonitor();
fam.addListener(f, new PluginDirectoryAlterationListener(this, manager));
fam.start();
} catch (SecurityException ex) {
logger.error("SecurityException seems like you don't have permissions to access the addons directory.", ex);
}
}

/**
Expand Down Expand Up @@ -284,6 +288,7 @@ private void loadExistingAddons() throws WSMarshallerException {
try {
File addonsDir = FileUtils.getAddonsDir();
File[] addons = addonsDir.listFiles(new JARFileFilter());
addons = addons == null ? new File[0] : addons;
ManifestExtractor mEx = new ManifestExtractor();

for (File addon : addons) {
Expand Down

0 comments on commit 952c35f

Please sign in to comment.