From: remillet Date: Mon, 6 Nov 2017 16:08:42 +0000 (-0800) Subject: DRYD-177: Fixed crashing issue with authority definitions with no initial terms defined. X-Git-Url: https://git.aero2k.de/?a=commitdiff_plain;h=2be3f62ad23503acdf35056e0ccaea5b7b9a06b8;p=tmp%2Fjakarta-migration.git DRYD-177: Fixed crashing issue with authority definitions with no initial terms defined. --- diff --git a/services/JaxRsServiceProvider/src/main/java/org/collectionspace/services/jaxrs/CSpaceResteasyBootstrap.java b/services/JaxRsServiceProvider/src/main/java/org/collectionspace/services/jaxrs/CSpaceResteasyBootstrap.java index 29936c9c5..d0ad3dd4d 100644 --- a/services/JaxRsServiceProvider/src/main/java/org/collectionspace/services/jaxrs/CSpaceResteasyBootstrap.java +++ b/services/JaxRsServiceProvider/src/main/java/org/collectionspace/services/jaxrs/CSpaceResteasyBootstrap.java @@ -45,7 +45,10 @@ public class CSpaceResteasyBootstrap extends ResteasyBootstrap { Dispatcher disp = deployment.getDispatcher(); disp.getDefaultContextObjects().put(ResourceMap.class, app.getResourceMap()); - initializeAuthorities(app.getResourceMap()); + String initAuthsString = System.getProperty("org.collectionspace.services.authorities.init", Boolean.TRUE.toString()); // Property can be set in the tomcat/bin/setenv.sh (or setenv.bat) file + if (Boolean.valueOf(initAuthsString) == true) { + initializeAuthorities(app.getResourceMap()); + } logger.log(Level.INFO, String.format("%tc [INFO] CollectionSpace Services' JAX-RS application started.", new Date())); } catch (Exception e) { @@ -162,6 +165,10 @@ public class CSpaceResteasyBootstrap extends ResteasyBootstrap { Response response = null; TermList termListElement = authorityInstance.getTermList(); + if (termListElement == null) { + return; + } + for (Term term : termListElement.getTerm()) { // // Check to see if the term already exists