Mercurial > dive4elements > river
changeset 3294:5e52202302e5
SQ relation: Handle the error case of accessing wrong indexed SQ relation more smoothly.
flys-artifacts/trunk@4973 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Fri, 13 Jul 2012 08:25:13 +0000 (2012-07-13) |
parents | c15738c831db |
children | 4fc442f1b4f6 |
files | flys-artifacts/ChangeLog flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/sq/Measurements.java |
diffstat | 2 files changed, 13 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/flys-artifacts/ChangeLog Thu Jul 12 22:27:50 2012 +0000 +++ b/flys-artifacts/ChangeLog Fri Jul 13 08:25:13 2012 +0000 @@ -1,3 +1,9 @@ +2012-07-13 Sascha L. Teichmann <sascha.teichmann@intevation.de> + + * src/main/java/de/intevation/flys/artifacts/model/sq/Measurements.java: + Handle the error case of accessing wrong indexed SQ relation + more smoothly. + 2012-07-13 Sascha L. Teichmann <sascha.teichmann@intevation.de> * src/main/java/de/intevation/flys/artifacts/model/sq/Measurement.java:
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/sq/Measurements.java Thu Jul 12 22:27:50 2012 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/sq/Measurements.java Fri Jul 13 08:25:13 2012 +0000 @@ -1,10 +1,14 @@ package de.intevation.flys.artifacts.model.sq; +import java.util.ArrayList; import java.util.List; -import java.util.ArrayList; + +import org.apache.log4j.Logger; public class Measurements { + private static final Logger log = Logger.getLogger(Measurements.class); + public interface SExtractor { double getS(Measurement measument); } // interface SExtractor @@ -104,8 +108,8 @@ case 4: return S_BL_CG(); case 5: return S_BL(); } - // XXX: Should we throw an exception? - return null; + log.error("THIS SHOULD NOT HAPPEN: Tried to access SQ[" + index + "]"); + return new ArrayList<SQ>(0); } @Override