[PATCH 5 of 9] Fixed NPE when loading folders from datacage

Wald Commits scm-commit at wald.intevation.org
Thu Jul 3 12:31:33 CEST 2014


# HG changeset patch
# User Raimund Renkert <rrenkert at intevation.de>
# Date 1404380021 -7200
# Branch facet-metadata
# Node ID 5277483044d934298616a8d302afc9af7335d3a3
# Parent  928891df0173613ec407ba40e77489e0527802df
Fixed NPE when loading folders from datacage.

diff -r 928891df0173 -r 5277483044d9 artifacts/src/main/java/org/dive4elements/river/exports/process/BedDiffYearProcessor.java
--- a/artifacts/src/main/java/org/dive4elements/river/exports/process/BedDiffYearProcessor.java	Thu Jul 03 11:32:22 2014 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/exports/process/BedDiffYearProcessor.java	Thu Jul 03 11:33:41 2014 +0200
@@ -50,17 +50,21 @@
             boolean          visible
     ) {
         CallContext context = generator.getCallContext();
-        Object data = bundle.getData(context);
         Map<String, String> metaData =
             bundle.getFacet().getMetaData(bundle.getArtifact(), context);
         yAxisLabel = metaData.get("Y");
+
+        setSubtitleRadius(generator, bundle, context);
+
+        Object data = bundle.getData(context);
+        if (data == null) {
+            return;
+        }
+
         if (!(data instanceof double[][])) {
             logger.error("Can't process " + data.getClass().getName() + " objects");
             return;
         }
-
-        setSubtitleRadius(generator, bundle, context);
-
         double[][] bData = (double[][]) data;
 
         StyledXYSeries series = new StyledXYSeries(bundle.getFacetDescription(), theme);
diff -r 928891df0173 -r 5277483044d9 artifacts/src/main/java/org/dive4elements/river/exports/process/BedHeightProcessor.java
--- a/artifacts/src/main/java/org/dive4elements/river/exports/process/BedHeightProcessor.java	Thu Jul 03 11:32:22 2014 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/exports/process/BedHeightProcessor.java	Thu Jul 03 11:33:41 2014 +0200
@@ -82,6 +82,9 @@
         yAxisLabel = metaData.get("Y");
 
         Object raw = bundle.getData(context);
+        if (raw == null) {
+            return null;
+        }
         if (!(raw instanceof double[][])) {
             logger.error("Unkown datatype: " + raw.getClass().getName());
             return null;
diff -r 928891df0173 -r 5277483044d9 artifacts/src/main/java/org/dive4elements/river/exports/process/BedQualityDensityProcessor.java
--- a/artifacts/src/main/java/org/dive4elements/river/exports/process/BedQualityDensityProcessor.java	Thu Jul 03 11:32:22 2014 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/exports/process/BedQualityDensityProcessor.java	Thu Jul 03 11:33:41 2014 +0200
@@ -44,6 +44,9 @@
         yAxisLabel = metaData.get("Y");
 
         Object data = bundle.getData(context);
+        if (data == null) {
+            return;
+        }
         if (!(data instanceof double[][])) {
             logger.error("Unknown data type: " + data.getClass().getName());
             return;
diff -r 928891df0173 -r 5277483044d9 artifacts/src/main/java/org/dive4elements/river/exports/process/BedQualityDiameterProcessor.java
--- a/artifacts/src/main/java/org/dive4elements/river/exports/process/BedQualityDiameterProcessor.java	Thu Jul 03 11:32:22 2014 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/exports/process/BedQualityDiameterProcessor.java	Thu Jul 03 11:33:41 2014 +0200
@@ -43,6 +43,9 @@
         series.putMetaData(metaData, bundle.getArtifact(), context);
         yAxisLabel = metaData.get("Y");
         Object data = bundle.getData(context);
+        if (data == null) {
+            return;
+        }
         if (!(data instanceof double[][])) {
             logger.error("Unknown data type: " + data.getClass().getName());
             return;
diff -r 928891df0173 -r 5277483044d9 artifacts/src/main/java/org/dive4elements/river/exports/process/BedQualityPorosityProcessor.java
--- a/artifacts/src/main/java/org/dive4elements/river/exports/process/BedQualityPorosityProcessor.java	Thu Jul 03 11:32:22 2014 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/exports/process/BedQualityPorosityProcessor.java	Thu Jul 03 11:33:41 2014 +0200
@@ -45,6 +45,9 @@
         yAxisLabel = metaData.get("Y");
 
         Object raw = bundle.getData(context);
+        if (raw == null) {
+            return;
+        }
         if (!(raw instanceof double[][])) {
             logger.error("Unknown data type: " + raw.getClass().getName());
             return;
diff -r 928891df0173 -r 5277483044d9 artifacts/src/main/java/org/dive4elements/river/exports/process/MiddleBedHeightProcessor.java
--- a/artifacts/src/main/java/org/dive4elements/river/exports/process/MiddleBedHeightProcessor.java	Thu Jul 03 11:32:22 2014 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/exports/process/MiddleBedHeightProcessor.java	Thu Jul 03 11:33:41 2014 +0200
@@ -51,6 +51,9 @@
         yAxisLabel = metaData.get("Y");
 
         Object raw = bundle.getData(context);
+        if (raw == null) {
+            return;
+        }
         if (!(raw instanceof double[][])) {
             logger.error("Unkonwn data type: " + raw.getClass().getName());
             return;


More information about the Dive4Elements-commits mailing list