- Timestamp:
- 01/28/20 10:19:55 (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/main/java/geniusweb/profilesserver/AutoUpdatingProfilesFactory.java
r1 r8 9 9 import java.util.List; 10 10 import java.util.logging.Level; 11 12 import com.fasterxml.jackson.databind.ObjectMapper;13 11 14 12 import geniusweb.issuevalue.Domain; … … 42 40 public class AutoUpdatingProfilesFactory extends DefaultProfilesFactory { 43 41 42 private static final String PROFILES_ROOTDIR = "PROFILES_ROOTDIR"; 44 43 private static final String DOMAINSREPO = "domainsrepo"; 45 44 private static final String JSON = ".json"; … … 47 46 private Path rootdir; 48 47 private final Reporter log; 49 private static final ObjectMapper jackson = new ObjectMapper();50 48 51 49 public AutoUpdatingProfilesFactory(Reporter logger) { … … 217 215 Profile profile = null; 218 216 try { 219 profile = jackson.readValue(profilefile, Profile.class);217 profile = Jackson.instance().readValue(profilefile, Profile.class); 220 218 } catch (IOException e) { 221 219 log.log(Level.WARNING, "File " + profilefile … … 250 248 String expectedName = withoutExtension(domainfile.getName()); 251 249 try { 252 domain = jackson.readValue(domainfile, Domain.class);250 domain = Jackson.instance().readValue(domainfile, Domain.class); 253 251 } catch (IOException e) { 254 252 log.log(Level.WARNING, "File " + domainfile … … 341 339 // Search back upwards to projectroot. 342 340 Path dir; 341 String path = System.getenv(PROFILES_ROOTDIR); 342 if (path != null) { 343 dir = Paths.get(path); 344 if (!dir.toFile().exists()) 345 throw new RuntimeException("Hard set path PROFILES_ROOTDIR='" 346 + PROFILES_ROOTDIR + "' does not exist "); 347 return dir; 348 } 343 349 try { 344 350 dir = Paths.get(getClass().getProtectionDomain().getCodeSource() … … 355 361 dir = dir.getParent(); 356 362 } 357 return Paths.get(DOMAINSREPO); // bit silly, it's not there, but we need 358 // to do something. 363 throw new RuntimeException("Path to " + DOMAINSREPO + " was not found"); 359 364 } 360 365
Note:
See TracChangeset
for help on using the changeset viewer.