[Dive4elements-commits] [PATCH] Catch IllegalArgumentException instead of RuntimeException, added logging
Wald Commits
scm-commit at wald.intevation.org
Tue Mar 5 09:52:21 CET 2013
# HG changeset patch
# User Raimund Renkert <rrenkert at intevation.de>
# Date 1362473515 -3600
# Node ID 14d19313268adda471b94ea8292ca3f45d4b01a5
# Parent a51515056c45096eb5fd5f0e179465696d1d41d0
Catch IllegalArgumentException instead of RuntimeException, added logging.
diff -r a51515056c45 -r 14d19313268a flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/FloodMapState.java
--- 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()) {
diff -r a51515056c45 -r 14d19313268a flys-artifacts/src/main/java/de/intevation/flys/utils/GeometryUtils.java
--- 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;
}
diff -r a51515056c45 -r 14d19313268a flys-artifacts/src/main/java/de/intevation/flys/utils/RiverMapfileGenerator.java
--- 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;
}
diff -r a51515056c45 -r 14d19313268a flys-backend/src/main/java/de/intevation/flys/backend/SpatialInfo.java
--- 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;
}
diff -r a51515056c45 -r 14d19313268a flys-backend/src/main/java/de/intevation/flys/model/RiverAxis.java
--- 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 :
More information about the Dive4elements-commits
mailing list