changeset 7479:1c365fa9d5a1

Log errors instead of starting WSPLGEN if required arguments are missing.
author Tom Gottfried <tom@intevation.de>
date Thu, 31 Oct 2013 11:56:45 +0100
parents 2803a70177c2
children 2a2e89c01588
files artifacts/src/main/java/org/dive4elements/river/artifacts/model/map/WSPLGENJob.java
diffstat 1 files changed, 17 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/map/WSPLGENJob.java	Thu Oct 31 11:44:09 2013 +0100
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/map/WSPLGENJob.java	Thu Oct 31 11:56:45 2013 +0100
@@ -16,6 +16,8 @@
 import java.util.ArrayList;
 import java.util.List;
 
+import org.apache.log4j.Logger;
+
 import org.dive4elements.artifacts.CallContext;
 
 import org.dive4elements.river.artifacts.D4EArtifact;
@@ -23,6 +25,7 @@
 
 
 public class WSPLGENJob {
+    private static Logger log = Logger.getLogger(WSPLGENJob.class);
 
     public static final String GEL_SPERRE   = "SPERRE";
     public static final String GEL_NOSPERRE = "NOSPERRE";
@@ -303,7 +306,7 @@
         writeWsp(writer);    // required
         writeWspTag(writer); // required
         writeLin(writer);
-        writeAxis(writer);
+        writeAxis(writer);   // required
         writeArea(writer);
         writeOut(writer);
         writeOutFile(writer);
@@ -311,7 +314,7 @@
         writeDelta(writer);
         writeGel(writer);
         writeDist(writer);
-        writePro(writer);
+        writePro(writer);    // required
         writeDgm(writer);    // required
     }
 
@@ -326,6 +329,7 @@
             return;
         }
 
+        log.error("Required WSP missing!");
         throw new IllegalArgumentException("Required WSP missing!");
     }
 
@@ -339,6 +343,7 @@
             return;
         }
 
+        log.error("Required WSPTAG missing!");
         throw new IllegalArgumentException("Required WSPTAG missing!");
     }
 
@@ -361,7 +366,11 @@
 
         if (axis != null && axis.length() > 0) {
             writer.println("-ACHSE=\"" + axis + "\"");
+            return;
         }
+
+        log.error("Required axis missing!");
+        throw new IllegalArgumentException("Required axis missing!");
     }
 
     protected void writeGel(PrintWriter writer)
@@ -464,7 +473,11 @@
     {
         if (pro != null && pro.length() > 0) {
             writer.println("-PRO=\"" + getPro() + "\"");
+            return;
         }
+
+        log.error("Required cross section tracks missing!");
+        throw new IllegalArgumentException("Required cross section tracks missing!");
     }
 
     protected void writeDgm(PrintWriter writer)
@@ -475,7 +488,8 @@
             return;
         }
 
-        throw new IllegalArgumentException("Required DGM missing!");
+        log.error("Required DEM missing!");
+        throw new IllegalArgumentException("Required DEM missing!");
     }
 }
 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :

http://dive4elements.wald.intevation.org