changeset 5181:9d36ddf7dbd3

Change IllegalArgumentException to HibernateException.
author Raimund Renkert <rrenkert@intevation.de>
date Thu, 07 Mar 2013 10:44:27 +0100 (2013-03-07)
parents 520b4fea63bb
children 8aac391871f9
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, 11 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/FloodMapState.java	Thu Mar 07 10:22:30 2013 +0100
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/FloodMapState.java	Thu Mar 07 10:44:27 2013 +0100
@@ -50,6 +50,7 @@
 import org.geotools.feature.FeatureCollection;
 import org.geotools.feature.FeatureCollections;
 import org.geotools.feature.simple.SimpleFeatureBuilder;
+import org.hibernate.HibernateException;
 import org.opengis.feature.simple.SimpleFeature;
 import org.opengis.feature.simple.SimpleFeatureType;
 
@@ -621,7 +622,7 @@
         try {
             axes = RiverAxis.getRiverAxis(river);
         }
-        catch (IllegalArgumentException iae) {
+        catch (HibernateException iae) {
             logger.warn("No valid river axis found for " + river);
             return;
         }
--- a/flys-artifacts/src/main/java/de/intevation/flys/utils/GeometryUtils.java	Thu Mar 07 10:22:30 2013 +0100
+++ b/flys-artifacts/src/main/java/de/intevation/flys/utils/GeometryUtils.java	Thu Mar 07 10:44:27 2013 +0100
@@ -30,6 +30,7 @@
 import org.geotools.geometry.jts.JTS;
 import org.geotools.geometry.jts.ReferencedEnvelope;
 import org.geotools.referencing.CRS;
+import org.hibernate.HibernateException;
 import org.opengis.feature.simple.SimpleFeature;
 import org.opengis.feature.simple.SimpleFeatureType;
 import org.opengis.referencing.FactoryException;
@@ -71,7 +72,7 @@
                 return max;
             }
         }
-        catch(IllegalArgumentException iae) {
+        catch(HibernateException iae) {
             logger.warn("No vaild river axis forund for " + rivername);
             return null;
         }
--- a/flys-artifacts/src/main/java/de/intevation/flys/utils/RiverMapfileGenerator.java	Thu Mar 07 10:22:30 2013 +0100
+++ b/flys-artifacts/src/main/java/de/intevation/flys/utils/RiverMapfileGenerator.java	Thu Mar 07 10:44:27 2013 +0100
@@ -20,6 +20,7 @@
 import org.apache.log4j.Logger;
 
 import org.apache.velocity.Template;
+import org.hibernate.HibernateException;
 
 public class RiverMapfileGenerator extends MapfileGenerator {
 
@@ -70,7 +71,7 @@
             try {
                 riverAxis = RiverAxis.getRiverAxis(river.getName());
             }
-            catch (IllegalArgumentException iae) {
+            catch (HibernateException iae) {
                 logger.error("No valid riveraxis found for " + river.getName());
                 continue;
             }
--- a/flys-backend/src/main/java/de/intevation/flys/backend/SpatialInfo.java	Thu Mar 07 10:22:30 2013 +0100
+++ b/flys-backend/src/main/java/de/intevation/flys/backend/SpatialInfo.java	Thu Mar 07 10:44:27 2013 +0100
@@ -4,6 +4,7 @@
 
 import org.apache.log4j.Logger;
 
+import org.hibernate.HibernateException;
 import org.hibernate.Query;
 import org.hibernate.Session;
 
@@ -93,7 +94,7 @@
                 logger.warn("River has no RiverAxis.");
             }
         }
-        catch(IllegalArgumentException iae) {
+        catch(HibernateException iae) {
             logger.warn("No vaild river axis found for " + river.getName());
             return;
         }
--- a/flys-backend/src/main/java/de/intevation/flys/model/RiverAxis.java	Thu Mar 07 10:22:30 2013 +0100
+++ b/flys-backend/src/main/java/de/intevation/flys/model/RiverAxis.java	Thu Mar 07 10:44:27 2013 +0100
@@ -107,20 +107,15 @@
     }
 
     public static List<RiverAxis> getRiverAxis(String river, int kind)
-    throws IllegalArgumentException {
+    throws HibernateException {
         Session session = SessionHolder.HOLDER.get();
         Query query = session.createQuery(
             "from RiverAxis where river.name =:river AND kind.id =:kind");
         query.setParameter("river", river);
         query.setParameter("kind", kind);
 
-        try {
-            List<RiverAxis> list = query.list();
-            return list.isEmpty() ? null : list;
-        }
-        catch (RuntimeException re) {
-            throw re.getCause();
-        }
+        List<RiverAxis> list = query.list();
+        return list.isEmpty() ? null : list;
     }
 }
 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org