From 54cfb8bea5e757c9e663c114ab1b1f60cc9109d9 Mon Sep 17 00:00:00 2001
From: bourgesl <bourges.laurent@gmail.com>
Date: Tue, 17 Jul 2018 13:48:32 +0200
Subject: [PATCH] Fixed base template handling when only 1 template found
 (geoLocation)

---
 src/main/java/fr/osug/doi/DoiTemplates.java | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/src/main/java/fr/osug/doi/DoiTemplates.java b/src/main/java/fr/osug/doi/DoiTemplates.java
index 7d91818..6c33030 100644
--- a/src/main/java/fr/osug/doi/DoiTemplates.java
+++ b/src/main/java/fr/osug/doi/DoiTemplates.java
@@ -72,6 +72,15 @@ public final class DoiTemplates {
                 }
             }
         }
+        
+        if (base == null) {
+            if (geoLocationPlaces.size() == 1) {
+                // Use the template for the single geoLocationPlace:
+                base = geoLocationPlaces.values().iterator().next();
+            } else {
+                logger.error("initialize: missing base template:\n" + templatePath);
+            }
+        }
 
         if (logger.isDebugEnabled()) {
             logger.debug("base: \n{}", base);
-- 
GitLab