allenai / AMPT

Aquatic Mammal Photogrammetry Tool
Apache License 2.0
3 stars 0 forks source link

Plugin crashes at startup if config directory does not exist or is empty #40

Closed APatrickJ closed 3 years ago

APatrickJ commented 3 years ago

Trying to start the AMPT plugin on a fresh installation crashes because validation fails due to no config files being present.

In other words, validation is currently happening before the initial configs are copied over. As a result, it fails.

[INFO] Starting AMPT [INFO] Validating config: /home/patrickj/.imagej/AMPT_configuration/CueConfig.json [ERROR] com.vulcan.vmlci.orca.validator.JsonValidationException: Unable to read config file: /home/patrickj/.imagej/AMPT_configuration/CueConfig.json at com.vulcan.vmlci.orca.validator.JsonConfigValidator.validateConfig(JsonConfigValidator.java:84) at com.vulcan.vmlci.orca.validator.JsonConfigValidator.validateAllConfigs(JsonConfigValidator.java:64) at com.vulcan.vmlci.orca.helpers.ConfigurationManager.validateConfigs(ConfigurationManager.java:71) at com.vulcan.vmlci.orca.AMPT_Main.lambda$run$0(AMPT_Main.java:44) at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311) at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:758) at java.awt.EventQueue.access$500(EventQueue.java:97) at java.awt.EventQueue$3.run(EventQueue.java:709) at java.awt.EventQueue$3.run(EventQueue.java:703) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:74) at java.awt.EventQueue.dispatchEvent(EventQueue.java:728) at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:205) at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116) at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93) at java.awt.EventDispatchThread.run(EventDispatchThread.java:82) Caused by: java.io.FileNotFoundException: /home/patrickj/.imagej/AMPT_configuration/CueConfig.json (No such file or directory) at java.io.FileInputStream.open0(Native Method) at java.io.FileInputStream.open(FileInputStream.java:195) at java.io.FileInputStream.(FileInputStream.java:138) at com.fasterxml.jackson.core.JsonFactory.createParser(JsonFactory.java:916) at com.fasterxml.jackson.databind.ObjectMapper.readTree(ObjectMapper.java:2974) at com.vulcan.vmlci.orca.validator.JsonConfigValidator.validateConfig(JsonConfigValidator.java:82) ... 17 more

APatrickJ commented 3 years ago

Discussed the basic intended config loading flow with Paul earlier. Captured in the attached flowchart.

ConfigLoad