From 8ae1dc30e15f6ac33452fe21ff88e44c5d95d422 Mon Sep 17 00:00:00 2001 From: Dave Hladky Date: Tue, 17 Mar 2015 11:12:59 -0500 Subject: [PATCH] Omaha #3888 found more un-safe nulls Former-commit-id: 50344c998e94bc8efe79e57b6dcde80b32050dac [formerly 708517862de976050198a9004a348fc8a586d09c [formerly 8034764082e63aee5ed4d79ae79ed911494ca259]] Former-commit-id: 708517862de976050198a9004a348fc8a586d09c Former-commit-id: db56f95f9604779c7a2e9ed83e2b82b45e4b7b05 --- .../uf/viz/monitor/data/ObHourReports.java | 27 +++++++++++-------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/cave/com.raytheon.uf.viz.monitor/src/com/raytheon/uf/viz/monitor/data/ObHourReports.java b/cave/com.raytheon.uf.viz.monitor/src/com/raytheon/uf/viz/monitor/data/ObHourReports.java index d4a4ff156f..a16a2a84fb 100755 --- a/cave/com.raytheon.uf.viz.monitor/src/com/raytheon/uf/viz/monitor/data/ObHourReports.java +++ b/cave/com.raytheon.uf.viz.monitor/src/com/raytheon/uf/viz/monitor/data/ObHourReports.java @@ -23,7 +23,6 @@ import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.Set; import java.util.concurrent.CopyOnWriteArrayList; import com.raytheon.uf.common.monitor.data.CommonConfig; @@ -47,6 +46,7 @@ import com.raytheon.uf.viz.monitor.thresholds.AbstractThresholdMgr; * Oct.29, 2012 1297 skorolev Changed HashMap to Map * Oct.31 2012 1297 skorolev Cleaned code. * Sep 04 2014 3220 skorolev Added updateZones method. + * Mar 17 2015 3888 dhladky check for nulls * * * @@ -227,8 +227,11 @@ public class ObHourReports { List stations = new CopyOnWriteArrayList( hourReports.get(zone).getZoneHourReports().keySet()); for (String stn : stations) { - if (!zoneStationMap.get(zone).contains(stn)) { - hourReports.get(zone).getZoneHourReports().remove(stn); + if (zoneStationMap.get(zone) != null) { + if (!zoneStationMap.get(zone).contains(stn)) { + hourReports.get(zone).getZoneHourReports() + .remove(stn); + } } } if (!zoneStationMap.keySet().contains(zone)) { @@ -241,14 +244,16 @@ public class ObHourReports { List stations = new CopyOnWriteArrayList( zoneStationMap.get(zone)); for (String stn : stations) { - if (!hourReports.get(zone).getZoneHourReports() - .containsKey(stn)) { - hourReports - .get(zone) - .getZoneHourReports() - .put(stn, - new ObStnHourReports(nominalTime, zone, - stn, appName, thresholdMgr)); + if (hourReports.get(zone) != null) { + if (!hourReports.get(zone).getZoneHourReports() + .containsKey(stn)) { + hourReports + .get(zone) + .getZoneHourReports() + .put(stn, + new ObStnHourReports(nominalTime, zone, + stn, appName, thresholdMgr)); + } } } if (!hourReports.containsKey(zone)) {