[Dive4elements-commits] [PATCH 1 of 2] Test if artifact in a MINFO artifact to avoid NPE when getting unit data

Wald Commits scm-commit at wald.intevation.org
Tue Jun 18 13:26:10 CEST 2013


# HG changeset patch
# User Raimund Renkert <rrenkert at intevation.de>
# Date 1371554727 -7200
# Node ID 682a73729fdad9731ac5b4b521129b99b051b532
# Parent  01ff5cd6abfa102dcf1680381d8be6c3dac44618
Test if artifact in a MINFO artifact to avoid NPE when getting unit data.

diff -r 01ff5cd6abfa -r 682a73729fda artifacts/src/main/java/org/dive4elements/river/exports/minfo/SedimentLoadLSGenerator.java
--- a/artifacts/src/main/java/org/dive4elements/river/exports/minfo/SedimentLoadLSGenerator.java	Tue Jun 18 13:14:51 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/exports/minfo/SedimentLoadLSGenerator.java	Tue Jun 18 13:25:27 2013 +0200
@@ -17,6 +17,7 @@
 import org.dive4elements.artifactdatabase.state.ArtifactAndFacet;
 import org.dive4elements.artifactdatabase.state.Facet;
 import org.dive4elements.river.artifacts.D4EArtifact;
+import org.dive4elements.river.artifacts.MINFOArtifact;
 import org.dive4elements.river.artifacts.access.RangeAccess;
 import org.dive4elements.river.artifacts.access.SedimentLoadAccess;
 import org.dive4elements.river.artifacts.model.FacetTypes;
@@ -225,7 +226,7 @@
     @Override
     protected String getDefaultYAxisLabel(int pos) {
         String label = "default";
-        if (pos == YAXIS.L.idx) {
+        if (pos == YAXIS.L.idx && artifact instanceof MINFOArtifact) {
             SedimentLoadAccess access = new SedimentLoadAccess(artifact);
             if (access.getUnit().equals("m3_per_a")) {
                 label = msg(I18N_YAXIS_LABEL_2, I18N_YAXIS_LABEL_DEFAULT_2);


More information about the Dive4elements-commits mailing list