Skip to content

v0.2.54..v0.2.55 changeset PullOverpassCommand.java

Garret Voltz edited this page Aug 14, 2020 · 1 revision
diff --git a/hoot-services/src/main/java/hoot/services/controllers/grail/PullOverpassCommand.java b/hoot-services/src/main/java/hoot/services/controllers/grail/PullOverpassCommand.java
index 3ce8e19..adb8ac6 100644
--- a/hoot-services/src/main/java/hoot/services/controllers/grail/PullOverpassCommand.java
+++ b/hoot-services/src/main/java/hoot/services/controllers/grail/PullOverpassCommand.java
@@ -141,12 +141,7 @@ class PullOverpassCommand implements InternalCommand {
         String overpassQuery;
 
         if (query == null || query.equals("")) {
-            File overpassQueryFile = new File(HOME_FOLDER, GRAIL_OVERPASS_QUERY);
-            try {
-                overpassQuery = FileUtils.readFileToString(overpassQueryFile, "UTF-8");
-            } catch(Exception exc) {
-                throw new IllegalArgumentException("Grail pull overpass error. Couldn't read overpass query file: " + overpassQueryFile.getName());
-        }
+            overpassQuery = getDefaultOverpassQuery();
         } else {
             overpassQuery = query;
         }
@@ -176,4 +171,17 @@ class PullOverpassCommand implements InternalCommand {
         }
         return inputStream;
     }
+
+    static String getDefaultOverpassQuery() {
+        String overpassQuery;
+
+        File overpassQueryFile = new File(HOME_FOLDER, GRAIL_OVERPASS_QUERY);
+        try {
+            overpassQuery = FileUtils.readFileToString(overpassQueryFile, "UTF-8");
+        } catch(Exception exc) {
+            throw new IllegalArgumentException("Grail pull overpass error. Couldn't read overpass query file: " + overpassQueryFile.getName());
+        }
+
+        return overpassQuery;
+    }
 }
Clone this wiki locally