changeset 5173:14d19313268a

Catch IllegalArgumentException instead of RuntimeException, added logging.
author Raimund Renkert <rrenkert@intevation.de>
date Tue, 05 Mar 2013 09:51:55 +0100 (2013-03-05)
parents a51515056c45
children b3a15fa3d88e
files flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/FloodMapState.java flys-artifacts/src/main/java/de/intevation/flys/utils/GeometryUtils.java flys-artifacts/src/main/java/de/intevation/flys/utils/RiverMapfileGenerator.java flys-backend/src/main/java/de/intevation/flys/backend/SpatialInfo.java flys-backend/src/main/java/de/intevation/flys/model/RiverAxis.java
diffstat 5 files changed, 10 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/FloodMapState.java	Mon Mar 04 17:46:22 2013 +0100
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/FloodMapState.java	Tue Mar 05 09:51:55 2013 +0100
@@ -621,7 +621,8 @@
         try {
             axes = RiverAxis.getRiverAxis(river);
         }
-        catch (RuntimeException e) {
+        catch (IllegalArgumentException iae) {
+            logger.warn("No valid river axis found for " + river);
             return;
         }
         if (axes == null || axes.isEmpty()) {
--- a/flys-artifacts/src/main/java/de/intevation/flys/utils/GeometryUtils.java	Mon Mar 04 17:46:22 2013 +0100
+++ b/flys-artifacts/src/main/java/de/intevation/flys/utils/GeometryUtils.java	Tue Mar 05 09:51:55 2013 +0100
@@ -71,7 +71,8 @@
                 return max;
             }
         }
-        catch(RuntimeException e) {
+        catch(IllegalArgumentException iae) {
+            logger.warn("No vaild river axis forund for " + rivername);
             return null;
         }
 
--- a/flys-artifacts/src/main/java/de/intevation/flys/utils/RiverMapfileGenerator.java	Mon Mar 04 17:46:22 2013 +0100
+++ b/flys-artifacts/src/main/java/de/intevation/flys/utils/RiverMapfileGenerator.java	Tue Mar 05 09:51:55 2013 +0100
@@ -70,7 +70,7 @@
             try {
                 riverAxis = RiverAxis.getRiverAxis(river.getName());
             }
-            catch (RuntimeException he) {
+            catch (IllegalArgumentException iae) {
                 logger.error("No valid riveraxis found for " + river.getName());
                 continue;
             }
--- a/flys-backend/src/main/java/de/intevation/flys/backend/SpatialInfo.java	Mon Mar 04 17:46:22 2013 +0100
+++ b/flys-backend/src/main/java/de/intevation/flys/backend/SpatialInfo.java	Tue Mar 05 09:51:55 2013 +0100
@@ -93,7 +93,8 @@
                 logger.warn("River has no RiverAxis.");
             }
         }
-        catch(RuntimeException e) {
+        catch(IllegalArgumentException iae) {
+            logger.warn("No vaild river axis found for " + river.getName());
             return;
         }
  
--- a/flys-backend/src/main/java/de/intevation/flys/model/RiverAxis.java	Mon Mar 04 17:46:22 2013 +0100
+++ b/flys-backend/src/main/java/de/intevation/flys/model/RiverAxis.java	Tue Mar 05 09:51:55 2013 +0100
@@ -102,12 +102,12 @@
 
 
     public static List<RiverAxis> getRiverAxis(String river)
-    throws RuntimeException {
+    throws IllegalArgumentException {
         return getRiverAxis(river, KIND_CURRENT);
     }
 
     public static List<RiverAxis> getRiverAxis(String river, int kind)
-    throws RuntimeException {
+    throws IllegalArgumentException {
         Session session = SessionHolder.HOLDER.get();
         Query query = session.createQuery(
             "from RiverAxis where river.name =:river AND kind.id =:kind");
@@ -119,10 +119,8 @@
             return list.isEmpty() ? null : list;
         }
         catch (RuntimeException re) {
-            throw iae;
+            throw re.getCause();
         }
-
-
     }
 }
 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org