changeset 5416:4ee97d914501

Morpho-Importer: Do not mask database exceptions as broken files
author Tom Gottfried <tom.gottfried@intevation.de>
date Tue, 26 Mar 2013 09:39:34 +0100
parents 5bac3e75f59c
children 5422a798f105
files flys-backend/src/main/java/de/intevation/flys/importer/ImportBedHeightEpoch.java flys-backend/src/main/java/de/intevation/flys/importer/ImportBedHeightSingle.java flys-backend/src/main/java/de/intevation/flys/importer/ImportDischargeZone.java flys-backend/src/main/java/de/intevation/flys/importer/ImportFlowVelocityMeasurement.java flys-backend/src/main/java/de/intevation/flys/importer/ImportFlowVelocityMeasurementValue.java flys-backend/src/main/java/de/intevation/flys/importer/ImportFlowVelocityModel.java flys-backend/src/main/java/de/intevation/flys/importer/ImportFlowVelocityModelValue.java flys-backend/src/main/java/de/intevation/flys/importer/ImportMeasurementStation.java flys-backend/src/main/java/de/intevation/flys/importer/ImportMorphWidth.java flys-backend/src/main/java/de/intevation/flys/importer/ImportRiver.java flys-backend/src/main/java/de/intevation/flys/importer/ImportSQRelation.java flys-backend/src/main/java/de/intevation/flys/importer/ImportSedimentDensity.java flys-backend/src/main/java/de/intevation/flys/importer/ImportSedimentYield.java
diffstat 13 files changed, 40 insertions(+), 113 deletions(-) [+]
line wrap: on
line diff
--- 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);
--- 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) {
--- 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);
--- 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);
--- 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);
--- 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) {
--- 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);
     }
 
--- 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;
--- 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);
--- 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.");
--- 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);
--- 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) {
--- 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) {

http://dive4elements.wald.intevation.org