[PATCH] Log errors instead of starting WSPLGEN if required arguments are missing

Wald Commits scm-commit at wald.intevation.org
Thu Oct 31 11:57:10 CET 2013


# HG changeset patch
# User Tom Gottfried <tom at intevation.de>
# Date 1383217005 -3600
# Node ID 1c365fa9d5a1a58d145ebf5d12e445584193a4db
# Parent  2803a70177c23adcb2462a70a3ec43afb8dd10b2
Log errors instead of starting WSPLGEN if required arguments are missing.

diff -r 2803a70177c2 -r 1c365fa9d5a1 artifacts/src/main/java/org/dive4elements/river/artifacts/model/map/WSPLGENJob.java
--- 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 :


More information about the Dive4elements-commits mailing list