From 2be3f62ad23503acdf35056e0ccaea5b7b9a06b8 Mon Sep 17 00:00:00 2001 From: remillet Date: Mon, 6 Nov 2017 08:08:42 -0800 Subject: [PATCH] DRYD-177: Fixed crashing issue with authority definitions with no initial terms defined. --- .../services/jaxrs/CSpaceResteasyBootstrap.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) 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 -- 2.47.3