[Dive4elements-commits] [PATCH] Morpho-Importer: Do not mask database exceptions as broken files

Wald Commits scm-commit at wald.intevation.org
Tue Mar 26 09:39:48 CET 2013


# HG changeset patch
# User Tom Gottfried <tom.gottfried at intevation.de>
# Date 1364287174 -3600
# Node ID 4ee97d914501a3301002bf963128aa73404a348c
# Parent  5bac3e75f59c0e0cdb876586106ad85992be37c9
Morpho-Importer: Do not mask database exceptions as broken files

diff -r 5bac3e75f59c -r 4ee97d914501 flys-backend/src/main/java/de/intevation/flys/importer/ImportBedHeightEpoch.java
--- a/flys-backend/src/main/java/de/intevation/flys/importer/ImportBedHeightEpoch.java	Tue Mar 26 09:40:05 2013 +0100
+++ b/flys-backend/src/main/java/de/intevation/flys/importer/ImportBedHeightEpoch.java	Tue Mar 26 09:39:34 2013 +0100
@@ -101,8 +101,7 @@
     }
 
     @Override
-    public void storeDependencies(River river) throws SQLException,
-        ConstraintViolationException {
+    public void storeDependencies(River river) {
         log.info("Store dependencies for epoch: '" + getDescription() + "'");
 
         BedHeightEpoch peer = getPeer(river);
diff -r 5bac3e75f59c -r 4ee97d914501 flys-backend/src/main/java/de/intevation/flys/importer/ImportBedHeightSingle.java
--- a/flys-backend/src/main/java/de/intevation/flys/importer/ImportBedHeightSingle.java	Tue Mar 26 09:40:05 2013 +0100
+++ b/flys-backend/src/main/java/de/intevation/flys/importer/ImportBedHeightSingle.java	Tue Mar 26 09:39:34 2013 +0100
@@ -100,9 +100,7 @@
     }
 
     @Override
-    public void storeDependencies(River river)
-    throws SQLException, ConstraintViolationException
-    {
+    public void storeDependencies(River river) {
         log.info("Store dependencies for single: '" + getDescription() + "'");
 
         if (type != null) {
diff -r 5bac3e75f59c -r 4ee97d914501 flys-backend/src/main/java/de/intevation/flys/importer/ImportDischargeZone.java
--- a/flys-backend/src/main/java/de/intevation/flys/importer/ImportDischargeZone.java	Tue Mar 26 09:40:05 2013 +0100
+++ b/flys-backend/src/main/java/de/intevation/flys/importer/ImportDischargeZone.java	Tue Mar 26 09:39:34 2013 +0100
@@ -43,9 +43,7 @@
     }
 
 
-    public void storeDependencies(River river)
-    throws SQLException, ConstraintViolationException
-    {
+    public void storeDependencies(River river) {
         log.debug("store dependencies");
 
         getPeer(river);
diff -r 5bac3e75f59c -r 4ee97d914501 flys-backend/src/main/java/de/intevation/flys/importer/ImportFlowVelocityMeasurement.java
--- a/flys-backend/src/main/java/de/intevation/flys/importer/ImportFlowVelocityMeasurement.java	Tue Mar 26 09:40:05 2013 +0100
+++ b/flys-backend/src/main/java/de/intevation/flys/importer/ImportFlowVelocityMeasurement.java	Tue Mar 26 09:39:34 2013 +0100
@@ -42,8 +42,7 @@
         this.values.add(value);
     }
 
-    public void storeDependencies(River river) throws SQLException,
-        ConstraintViolationException {
+    public void storeDependencies(River river) {
         log.debug("store dependencies");
 
         FlowVelocityMeasurement peer = getPeer(river);
diff -r 5bac3e75f59c -r 4ee97d914501 flys-backend/src/main/java/de/intevation/flys/importer/ImportFlowVelocityMeasurementValue.java
--- a/flys-backend/src/main/java/de/intevation/flys/importer/ImportFlowVelocityMeasurementValue.java	Tue Mar 26 09:40:05 2013 +0100
+++ b/flys-backend/src/main/java/de/intevation/flys/importer/ImportFlowVelocityMeasurementValue.java	Tue Mar 26 09:39:34 2013 +0100
@@ -51,9 +51,7 @@
 
 
 
-    public void storeDependencies(FlowVelocityMeasurement measurement)
-    throws SQLException, ConstraintViolationException
-    {
+    public void storeDependencies(FlowVelocityMeasurement measurement) {
         log.debug("store dependencies");
 
         getPeer(measurement);
diff -r 5bac3e75f59c -r 4ee97d914501 flys-backend/src/main/java/de/intevation/flys/importer/ImportFlowVelocityModel.java
--- a/flys-backend/src/main/java/de/intevation/flys/importer/ImportFlowVelocityModel.java	Tue Mar 26 09:40:05 2013 +0100
+++ b/flys-backend/src/main/java/de/intevation/flys/importer/ImportFlowVelocityModel.java	Tue Mar 26 09:39:34 2013 +0100
@@ -52,8 +52,7 @@
         this.values.add(value);
     }
 
-    public void storeDependencies(River river) throws SQLException,
-        ConstraintViolationException {
+    public void storeDependencies(River river) {
         log.debug("store dependencies");
 
         if (dischargeZone == null) {
diff -r 5bac3e75f59c -r 4ee97d914501 flys-backend/src/main/java/de/intevation/flys/importer/ImportFlowVelocityModelValue.java
--- a/flys-backend/src/main/java/de/intevation/flys/importer/ImportFlowVelocityModelValue.java	Tue Mar 26 09:40:05 2013 +0100
+++ b/flys-backend/src/main/java/de/intevation/flys/importer/ImportFlowVelocityModelValue.java	Tue Mar 26 09:39:34 2013 +0100
@@ -38,9 +38,7 @@
     }
 
 
-    public void storeDependencies(FlowVelocityModel model)
-    throws SQLException, ConstraintViolationException
-    {
+    public void storeDependencies(FlowVelocityModel model) {
         getPeer(model);
     }
 
diff -r 5bac3e75f59c -r 4ee97d914501 flys-backend/src/main/java/de/intevation/flys/importer/ImportMeasurementStation.java
--- a/flys-backend/src/main/java/de/intevation/flys/importer/ImportMeasurementStation.java	Tue Mar 26 09:40:05 2013 +0100
+++ b/flys-backend/src/main/java/de/intevation/flys/importer/ImportMeasurementStation.java	Tue Mar 26 09:39:34 2013 +0100
@@ -46,8 +46,7 @@
         return gauges.isEmpty() ? null : gauges.get(0);
     }
 
-    public boolean storeDependencies(River river) throws SQLException,
-        ConstraintViolationException {
+    public boolean storeDependencies(River river) {
         getPeer(river);
 
         return peer != null;
diff -r 5bac3e75f59c -r 4ee97d914501 flys-backend/src/main/java/de/intevation/flys/importer/ImportMorphWidth.java
--- a/flys-backend/src/main/java/de/intevation/flys/importer/ImportMorphWidth.java	Tue Mar 26 09:40:05 2013 +0100
+++ b/flys-backend/src/main/java/de/intevation/flys/importer/ImportMorphWidth.java	Tue Mar 26 09:39:34 2013 +0100
@@ -35,8 +35,7 @@
         this.unit = unit;
     }
 
-    public void storeDependencies(River river) throws SQLException,
-        ConstraintViolationException {
+    public void storeDependencies(River river) {
         log.info("store dependencies");
 
         MorphologicalWidth peer = getPeer(river);
diff -r 5bac3e75f59c -r 4ee97d914501 flys-backend/src/main/java/de/intevation/flys/importer/ImportRiver.java
--- a/flys-backend/src/main/java/de/intevation/flys/importer/ImportRiver.java	Tue Mar 26 09:40:05 2013 +0100
+++ b/flys-backend/src/main/java/de/intevation/flys/importer/ImportRiver.java	Tue Mar 26 09:39:34 2013 +0100
@@ -1237,15 +1237,8 @@
 
                 log.debug("name: " + desc);
 
-                try {
-                    single.storeDependencies(river);
-                }
-                catch (SQLException sqle) {
-                    log.error("File '" + desc + "' is broken!");
-                }
-                catch (ConstraintViolationException cve) {
-                    log.error("File '" + desc + "' is broken!");
-                }
+		single.storeDependencies(river);
+
             }
         }
         else {
@@ -1265,15 +1258,8 @@
 
                 log.debug("name: " + desc);
 
-                try {
-                    epoch.storeDependencies(river);
-                }
-                catch (SQLException sqle) {
-                    log.error("File '" + desc + "' is broken!");
-                }
-                catch (ConstraintViolationException cve) {
-                    log.error("File '" + desc + "' is broken!");
-                }
+		epoch.storeDependencies(river);
+
             }
         }
         else {
@@ -1292,15 +1278,8 @@
 
                 log.debug("name: " + desc);
 
-                try {
-                    density.storeDependencies(river);
-                }
-                catch (SQLException sqle) {
-                    log.error("File '" + desc + "' is broken!");
-                }
-                catch (ConstraintViolationException cve) {
-                    log.error("File '" + desc + "' is broken!");
-                }
+		density.storeDependencies(river);
+
             }
         }
     }
@@ -1312,15 +1291,9 @@
             River river = getPeer();
 
             for (ImportMorphWidth width: morphologicalWidths) {
-                try {
-                    width.storeDependencies(river);
-                }
-                catch (SQLException sqle) {
-                    log.error("Error while parsing file for morph. width.", sqle);
-                }
-                catch (ConstraintViolationException cve) {
-                    log.error("Error while parsing file for morph. width.", cve);
-                }
+
+		width.storeDependencies(river);
+
             }
         }
     }
@@ -1332,27 +1305,15 @@
             River river = getPeer();
 
             for (ImportFlowVelocityModel flowVelocityModel: flowVelocityModels){
-                try {
-                    flowVelocityModel.storeDependencies(river);
-                }
-                catch (SQLException sqle) {
-                    log.error("Error while storing flow velocity model.", sqle);
-                }
-                catch (ConstraintViolationException cve) {
-                    log.error("Error while storing flow velocity model.", cve);
-                }
+
+		flowVelocityModel.storeDependencies(river);
+
             }
 
             for (ImportFlowVelocityMeasurement m: flowVelocityMeasurements) {
-                try {
-                    m.storeDependencies(river);
-                }
-                catch (SQLException sqle) {
-                    log.error("Error while storing flow velocity measurement.", sqle);
-                }
-                catch (ConstraintViolationException cve) {
-                    log.error("Error while storing flow velocity measurement.", cve);
-                }
+
+		m.storeDependencies(river);
+
             }
         }
     }
@@ -1365,15 +1326,9 @@
             River river = getPeer();
 
             for (ImportSedimentYield sedimentYield: sedimentYields) {
-                try {
-                    sedimentYield.storeDependencies(river);
-                }
-                catch (SQLException sqle) {
-                    log.error("Error while storing sediment yield.", sqle);
-                }
-                catch (ConstraintViolationException cve) {
-                    log.error("Error while storing sediment yield.", cve);
-                }
+
+		sedimentYield.storeDependencies(river);
+
             }
         }
     }
@@ -1388,18 +1343,12 @@
             int count = 0;
 
             for (ImportMeasurementStation station: measurementStations) {
-                try {
-                    boolean success = station.storeDependencies(river);
-                    if (success) {
-                        count++;
-                    }
-                }
-                catch (SQLException sqle) {
-                    log.error("Error while storing measurement station.", sqle);
-                }
-                catch (ConstraintViolationException cve) {
-                    log.error("Error while storing measurement station.", cve);
-                }
+
+		boolean success = station.storeDependencies(river);
+		if (success) {
+		    count++;
+		}
+
             }
 
             log.info("stored " + count + " measurement stations.");
@@ -1416,16 +1365,10 @@
             int count = 0;
 
             for (ImportSQRelation sqRelation: sqRelations) {
-                try {
-                    sqRelation.storeDependencies(river);
-                    count++;
-                }
-                catch (SQLException sqle) {
-                    log.error("Error while storing sq relation.", sqle);
-                }
-                catch (ConstraintViolationException cve) {
-                    log.error("Error while storing sq relation.", cve);
-                }
+
+		sqRelation.storeDependencies(river);
+		count++;
+
             }
 
             log.info("stored " + count + " sq relations.");
diff -r 5bac3e75f59c -r 4ee97d914501 flys-backend/src/main/java/de/intevation/flys/importer/ImportSQRelation.java
--- a/flys-backend/src/main/java/de/intevation/flys/importer/ImportSQRelation.java	Tue Mar 26 09:40:05 2013 +0100
+++ b/flys-backend/src/main/java/de/intevation/flys/importer/ImportSQRelation.java	Tue Mar 26 09:39:34 2013 +0100
@@ -31,8 +31,7 @@
         this.values = new ArrayList<ImportSQRelationValue>();
     }
 
-    public void storeDependencies(River river) throws SQLException,
-        ConstraintViolationException {
+    public void storeDependencies(River river) {
         log.info("store dependencies");
 
         SQRelation peer = getPeer(river);
diff -r 5bac3e75f59c -r 4ee97d914501 flys-backend/src/main/java/de/intevation/flys/importer/ImportSedimentDensity.java
--- a/flys-backend/src/main/java/de/intevation/flys/importer/ImportSedimentDensity.java	Tue Mar 26 09:40:05 2013 +0100
+++ b/flys-backend/src/main/java/de/intevation/flys/importer/ImportSedimentDensity.java	Tue Mar 26 09:39:34 2013 +0100
@@ -48,8 +48,7 @@
         values.add(value);
     }
 
-    public void storeDependencies(River river) throws SQLException,
-        ConstraintViolationException {
+    public void storeDependencies(River river) {
         log.info("store dependencies");
 
         if (depth != null) {
diff -r 5bac3e75f59c -r 4ee97d914501 flys-backend/src/main/java/de/intevation/flys/importer/ImportSedimentYield.java
--- a/flys-backend/src/main/java/de/intevation/flys/importer/ImportSedimentYield.java	Tue Mar 26 09:40:05 2013 +0100
+++ b/flys-backend/src/main/java/de/intevation/flys/importer/ImportSedimentYield.java	Tue Mar 26 09:39:34 2013 +0100
@@ -54,8 +54,7 @@
         this.values.add(value);
     }
 
-    public void storeDependencies(River river) throws SQLException,
-        ConstraintViolationException {
+    public void storeDependencies(River river) {
         log.debug("store dependencies");
 
         if (grainFraction != null) {


More information about the Dive4elements-commits mailing list